ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

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() 
  {
    nh.initNode();
    nh.advertise(pubyaw_pitch_roll);

     //main problem here
      mpu.calibrateGyro();
  }

  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 );
    nh.spinOnce();

    delay(100);
  }

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)

edit retag flag offensive close merge delete

Comments

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
0

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

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

edit flag offensive delete link more

Question Tools

2 followers

Stats

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

Seen: 2,227 times

Last updated: Jan 29 '18