Rosanswers logo

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 serial_node.py /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)

Originally posted by khansaadbinhasan on ROS Answers with karma: 94 on 2018-01-27

Post score: 1

Original comments

Comment by lagankapoor on 2018-01-30:
Answer is working for you ?

Comment by khansaadbinhasan on 2018-01-30:
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

Comment by khansaadbinhasan on 2018-01-30:
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

Comment by lagankapoor on 2018-01-30:
bro i not work on that till now so i don't know much Sorry


1 Answer 1


Rosanswers logo

Here is the the solution for your problem https://github.com/superjax/tinyIMU_arduino https://github.com/chrisspen/ros_mpu6050_node Only need to do some modification according to needs

Originally posted by lagankapoor with karma: 216 on 2018-01-29

This answer was ACCEPTED on the original site

Post score: 0


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.