Ask Your Question

unable to integrate MPU6050 with ros

asked 2018-01-27 11:48:05 -0500

khansaadbinhasan gravatar image

I am trying to get yaw pitch roll from an MPU6050 imu using the following code(some parts of code removed for clarity). Its getting uploaded

  #include <I2Cdev.h>
  #include <Wire.h>
  #include <MPU6050.h>

  #include <ros.h>
  #include <geometry_msgs/Vector3.h>

  ros::NodeHandle nh;
  geometry_msgs::Vector3 yaw_pitch_roll;
  ros::Publisher pubyaw_pitch_roll("yaw_pitch_roll", &yaw_pitch_roll);

  MPU6050 mpu;

  // Timers
  unsigned long timer = 0;
  float timeStep = 0.01;

  // Pitch, Roll and Yaw values
  float pitch = 0;
  float roll = 0;
  float yaw = 0;

  void setup() 

     //main problem here

  void loop()
    timer = millis();
    yaw_pitch_roll.x = yaw;
    yaw_pitch_roll.y = pitch;
    yaw_pitch_roll.z = roll;
    pubyaw_pitch_roll.publish( &yaw_pitch_roll );


But when i try to run the following command in terminal after uploading:

rosrun rosserial_python /dev/ttyACM0 _baud:=57600

I get the following error:

[ERROR] [1517073128.320418]: Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

Now, I have run many arduino programs using same configurations( baud_rate) and commands. But this is the only program thats giving me a tough time.

Also when i remove the following line: mpu.calibrateGyro(); the program runs fine.

Can anyone suggest me any workaround for this?

NOTE: I have tried to change the baudrate to 115200 and serial port is also right(other programs run fine) and message is not too big( i have sent the same message in other programs)

edit retag flag offensive close merge delete


Answer is working for you ?

lagankapoor gravatar image lagankapoor  ( 2018-01-30 03:41:18 -0500 )edit

No. In the second link it is mentioned to run many commands. Everything works fine till ./configure After this I suppose an error crawls in here: checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes /tmp/bcm2835-1.50/missing: Unknown--is

khansaadbinhasan gravatar image khansaadbinhasan  ( 2018-01-30 11:43:30 -0500 )edit

after this when i try to run make its giving me many warnings and when i try to run make check its showing Testsuite summary for bcm2835 1.50 ============================================================================ # TOTAL: 1 # PASS: 0 # SKIP: 0 # XFAIL: 0 # FAIL: 1 # XPASS: 0

khansaadbinhasan gravatar image khansaadbinhasan  ( 2018-01-30 11:44:59 -0500 )edit

bro i not work on that till now so i don't know much Sorry

lagankapoor gravatar image lagankapoor  ( 2018-01-30 22:40:31 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-01-29 00:17:26 -0500

Here is the the solution for your problem Only need to do some modification according to needs

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-01-27 11:48:05 -0500

Seen: 1,411 times

Last updated: Jan 29 '18