ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Rotate Kinect frame for turtlebot localization? [closed]

asked 2016-06-28 20:51:17 -0600

Drumzone gravatar image

Hello !

I'm currently working on SLAM method with turtlebot2. I followed all tutorials about mapping and localization and everything works well.

But I'd like to add some more features: my kinect is actually not directly fixed to the turtlebot but it's mounted on a Dynamixel Motor to allow a rotation on the Z axis.

So my problem is that the localization is well working when the kinect frame is aligned with the turtlebot frame (the Kinect orientation on the vertical axis is the same as the turtlebot's one) but as soon as the orientations are not the same, I have a problem in the localization. This is pretty normal but I'd like to allow the Kinect to rotate and still have a good localization.

In theory, I "just" have to apply a rotation matrix between the Kinect frame and the turtlebot frame depending on the Dynamixel angle but I have honestly no idea how to apply this transformation...

I had a look on tf tutorials and I did the tutorials tf tutorials but I'm quite locked here.

So my questions are:

  1. How can I apply the theoretical rotation matrix between Kinect frame and Turtlebot frame?

  2. Where should I implement the rotation transformation between the frames (because there are not a lot of files in turtlebot_navigation folder)?

  3. Is it possible to update the angle for the rotation transformation as often as the motor angle changes?

Let me know if wasn't clear in my explanations.

Thank you for your answers and your advices!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Drumzone
close date 2016-07-06 00:54:31.692856

1 Answer

Sort by ยป oldest newest most voted

answered 2016-06-29 02:50:57 -0600

jorge gravatar image

So did you integrated your rotating kinect and servo in your turtleblot xacro file? This is the common way to go in ROS. Take a look at this tutorial. Maybe there' re other better ones, but this covers what you need. Basically, you must do 3 things:

  • Integrate the servo and kinect in the robot description (xacro file). The joint linking the servo and the kinect must be of revolute type (as the gripper in the tutorial)
  • The driver controlling your servo must regularly provide the joint state by publishing on /joints_state topic, the higher the rate the better (typically between 20 and 50 Hz)
  • Ensure that you SLAM use kinect tf properly. I mean, it doesn't make assumptions like the kinect orientation is fixed and so on (as amcl or gmapping do, afaik)

Here you have a simple example for the first point, the mounting of a cannon that can tilt (though in your case you want to pan)

Hope the explanation is clear enough and I'm not missing something!

edit flag offensive delete link more


Thank you so much for your reply!! I didn't have knowledge about the xacro file. I'll try and let you know how it's going. But about the 3rd point you mentioned, amcl and gmapping are assuming that Kinect is immobile? Is there another method which take kinect orientation into account?

Drumzone gravatar image Drumzone  ( 2016-06-29 03:12:36 -0600 )edit

well, amcl and gmapping are 2D navigation tools, so they use a 2D laser scan. You can use a kinect because we use the depthimage_to_laser_scan package that takes a slice of the 3D image from kinect.

jorge gravatar image jorge  ( 2016-06-29 07:52:07 -0600 )edit

as your kinect rotates in the Z axis, you can still use the same trick... only different is that you rotate the camera instead of the robot. As for 3D slam packages, I tried long time ago RGBDSlam, but I'm pretty sure there must be newer and better packages out there

jorge gravatar image jorge  ( 2016-06-29 07:54:54 -0600 )edit

OK! So now I have an accurate model of my robot but I'm now facing problems with the joint_state_publisher... Same as Pi robot example I created a launch file including the joint_state_publisher but once everything is launched (robot, openni, dynamixel, Rviz), the joint_state published (1/2)

Drumzone gravatar image Drumzone  ( 2016-07-05 01:46:25 -0600 )edit

by the dynamixel doesn't seem to be used by Rviz. Do you know I could set this up? I'd like to 'force" Rviz to get the message?

Thank you again for your help! (2/2)

Drumzone gravatar image Drumzone  ( 2016-07-05 01:49:50 -0600 )edit

note that the joint name you publish on joint_states topic and the revolute joint name in the xacro file must match. If still fails after checking this, please update your quesiton with your xacro file

jorge gravatar image jorge  ( 2016-07-05 05:24:49 -0600 )edit

Of course the topics should be the same. I worked on it again and I found a solution: I modified the Kobuki joint state publisher for the wheels and I add the publisher for the Dynamixel motor. So now it's all good! Thank you again for your help and your advices !!

Drumzone gravatar image Drumzone  ( 2016-07-06 00:52:05 -0600 )edit

cool, glad to hear that. However, you can publish joint_states messages from any place, typically from your servo driver. robot_state_publisher collects all the different joints coming to the topic from different sources. Btw, I marked the answer as correct, if you agree it is.

jorge gravatar image jorge  ( 2016-07-06 02:12:29 -0600 )edit

Question Tools


Asked: 2016-06-28 20:51:17 -0600

Seen: 333 times

Last updated: Jun 29 '16