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

publishing and subscribing Gyro msgs in a Turtlebot

asked 2011-12-07 20:16:11 -0500

Divya gravatar image

Hello,

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

edit retag flag offensive close merge delete

5 Answers

Sort by ยป oldest newest most voted
2

answered 2011-12-08 06:48:39 -0500

mmwise gravatar image

updated 2011-12-12 05:13:17 -0500

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.

edit flag offensive delete link more

Comments

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?
Divya gravatar image Divya  ( 2011-12-11 19:06:11 -0500 )edit
I edited by answer above and what type of gyro do you own?
mmwise gravatar image mmwise  ( 2011-12-12 05:13:35 -0500 )edit

@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?

chao gravatar image chao  ( 2014-03-05 02:55:02 -0500 )edit

@chao please be more specific about what "this" is. All Kobuki's have the gyro so I'm not sure how this is relevant.

tfoote gravatar image tfoote  ( 2014-03-05 07:00:31 -0500 )edit
chao gravatar image chao  ( 2014-03-05 14:35:36 -0500 )edit
0

answered 2012-05-18 05:08:16 -0500

rohan gravatar image

@jjcf89 Thanks a lot for the link.

I forgot to mention one thing the z and w under the orientation heading is unstable.

It starts decreasing from 0.999 to 0.00 and the again goes up.

Is this normal?

edit flag offensive delete link more

Comments

When i publish the analog input it is stable at 514 . So i think the gyro is working fine. http://answers.ros.org/question/34298/gyro-for-turtlebot

rohan gravatar image rohan  ( 2012-05-18 05:09:27 -0500 )edit
1

answered 2012-05-17 16:08:16 -0500

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) {
      calibration.push_back(gyro_adc)
      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
}
edit flag offensive delete link more
0

answered 2012-05-17 12:45:40 -0500

jjcf89 gravatar image

This is an answer to @rohan. Gyro data will drift. I found this link to be quite helpful. http://www.instructables.com/id/Guide-to-gyro-and-accelerometer-with-Arduino-inclu/

edit flag offensive delete link more
0

answered 2012-05-15 10:38:35 -0500

rohan gravatar image

Hi, I echoed the topic /imu/raw and found out that the z and w keeps on changing. When w increases the z decreases. I kept the turtlebot at the same position , w decreases and then after some time it started increasing .

The data from the gyro was never stable.

Is it normal or is there something wrong in the gyro?

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2011-12-07 20:16:11 -0500

Seen: 2,696 times

Last updated: May 18 '12