Rosanswers logo


Does anybody know how exactly the Gyro messages (imu/data; imu/raw) are subscribed/published in the turtle-bot node?

I have an ICreate Robot that doesn't have an inbuilt Gyro..But when I launch the turtlebot dashboard, it displays some random values in place of Gyro messages! I am not sure why that happens! I am trying to use an external Gyroscope (it publishes IMU messages) to publish the Gyro messages instead of the default ones published from the turtlebot node... Can anyone tell me how to go about doing it?

I realized a simple "remapping" of messages wouldn't work in this case!

Would really appreciate any kind of help that you can provide!

Thanks. Divya

Originally posted by Divya on ROS Answers with karma: 46 on 2011-12-07

Post score: 0


2 Answers 2


Rosanswers logo

The TurtleBot power board has a gyro attached to the analog in. The create reads the data from the analog input and publishes it on imu/data. Set the has_gyro parameter to false and then it should not publish gyro data anymore.

To publish your own gyro data to ROS you need to either use an existing ROS driver for your gyro or write your own ROS drive to publish an Imu msg on the imu/data topic.

Originally posted by mmwise with karma: 8372 on 2011-12-08

This answer was ACCEPTED on the original site

Post score: 2

Original comments

Comment by mmwise on 2011-12-12:
I edited by answer above and what type of gyro do you own?

Comment by Divya on 2011-12-11:
thank you. It worked. But do you also know how I can use the output from my own gyroscope and send it to the turtlebot?

Comment by chao on 2014-03-05:
@mmwise, i suppose that the answer you provided is specifically for move_base roomba only? do you have any idea how can i do this for kobuki?

Comment by tfoote on 2014-03-05:
@chao please be more specific about what "this" is. All Kobuki's have the gyro so I'm not sure how this is relevant.

Comment by chao on 2014-03-05:
@tfoote, i have created a question for this @ http://answers.ros.org/question/136046/external-imu-published-by-robot_pose_ekf-for-gmapping/. please help.


Rosanswers logo

For those interested in adding a cheap angular rate gyro to their robot designs for helping with odometry calcs, here's some pseudo code for calculating the orientation that might help:

calibration = [] // array for building calibration offset
loop() {
  gyro_adc = get_gyro_value_from_analog()
  if (robotIsNotMoving) {
      total = 0;
      for each( float reading, calibration )
        total += reading;
      cal_offset = total / calibration.size()

  this_reading_time = get_current_time()
  dt = this_reading_time - last_reading_time
  max_value = 255; // 8 bit ADC 
  v_ref = 5; // arduino is a 5V ref
  zero_rate_v = cal_offset * v_ref / max_value
  sensitivity = 0.013 // get from gyro data sheet

  rate = (gyro_adc * v_ref / max_value - zero_rate_v) / sensitivity

  orientation += rate * dt
  // do something with orientation (put it in an IMU msg, etc.)
  // ...
  last_reading_time = this_reading_time

Originally posted by JeffRousseau with karma: 1607 on 2012-05-17

This answer was NOT ACCEPTED on the original site

Post score: 1


Your Answer

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