unable to integrate MPU6050 with ros
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)
Answer is working for you ?
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
--isafter this when i try to run
make
its giving me many warnings and when i try to runmake check
its showingTestsuite summary for bcm2835 1.50 ============================================================================ # TOTAL: 1 # PASS: 0 # SKIP: 0 # XFAIL: 0 # FAIL: 1 # XPASS: 0
bro i not work on that till now so i don't know much Sorry