Ask Your Question
0

publishing and subscribing Gyro msgs in a Turtlebot

asked 2011-12-08 02: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 delete

5 answers

Sort by ยป oldest newest most voted
1

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

mmwise gravatar image

updated 2011-12-12 11: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 publish 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 ( 2011-12-12 01:06:11 -0500 )edit
I edited by answer above and what type of gyro do you own? mmwise ( 2011-12-12 11: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 ( 2014-03-05 08: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 ( 2014-03-05 13:00:31 -0500 )edit

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

chao ( 2014-03-05 20:35:36 -0500 )edit
0

answered 2012-05-15 15: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 publish link more
0

answered 2012-05-17 17: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 publish link more
0

answered 2012-05-17 21: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 publish link more
0

answered 2012-05-18 10: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 publish 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 ( 2012-05-18 10:09:27 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Follow
1 follower

Stats

Asked: 2011-12-08 02:16:11 -0500

Seen: 653 times

Last updated: May 18 '12