0
$\begingroup$

Rosanswers logo

I bought a quite decent IMU called Bosch BN055. It is a 9-DOF IMU. The thing is, I have a differential drive robot and runs on a flat surface, which means I do not need roll and pitch, only YAW.

I am using robot_localization to fuse odometry vx,vy and IMU roll, pitch and yaw. My robot sometimes creates a vibration which causes my IMU to drift and making my robot to spin and roll.

I have tried to fuse robot_localization with only YAW values but after some time, ROS will throw an error stating that the combined quaternion value should equal to 1 and I get it, as I making roll and pitch to be 0, when IMU thinks it has been rotated in those directions, the YAW values become different.

How can I cope with that?


Originally posted by stevemartin on ROS Answers with karma: 361 on 2019-01-21

Post score: 1


Original comments

Comment by Hamid Didari on 2019-01-21:
do you convert yaw in quarternian by yourself or using tf?(if you convert by yourself can you share your code)

Comment by stevemartin on 2019-01-21:
@hamid I am using library which you can find here: LINK

Comment by Hamid Didari on 2019-01-21:
that code doesn't convert eurl angle to quarternian if i realize correctly you set imu_msg.orientation.x and imu_msg.orientation.y to zero and publish the msg?am i right?

Comment by stevemartin on 2019-01-21:
@hamid the libary publishes imu msg to /imu. Yes, I did that before but after sometime that will give me an error as quaternion should add up to 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

if you want to use only yaw , first you have to convert quarternian to eurl angle and then convert yaw in quarternian then publish msg . you can use something like this code:

  float yaw;
  tf::Quaternion robot_imu;
  robot_imu.setX(msg->orientation.x);
  robot_imu.setY(msg->orientation.y);
  robot_imu.setZ(msg->orientation.z);
  robot_imu.setW(msg->orientation.w);
  yaw_ = tf::getYaw(robot_imu);
  tf::Quaternion yaw(tf::createQuaternionFromYaw(yaw_));
  

you can't simply set x and y to zero.


Originally posted by Hamid Didari with karma: 1769 on 2019-01-21

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by stevemartin on 2019-01-22:
@hamid okay that makes sense, so in yaw format, I would just cancel out roll and pitch and keep only way and convert back to Q

$\endgroup$

Your Answer

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