Ask Your Question

How do I write this transform

asked 2018-04-16 21:56:48 -0500

elgarbe gravatar image

I have a Hokuyo LIDAR mounted on a 3d printed part attached to a stepper motor. This is a video of the setup

I need to write a tf from laser_link to base_link. I wrote this:

  t.header.frame_id = base_link;
  t.child_frame_id = laser_link;
  t.transform.translation.z = 0.055;
  t.transform.translation.x = 0.035;
  t.transform.rotation.x = 0.0;
  t.transform.rotation.y = sin(mot_curr_pos * 2.0 * 3.141592/360.0);
  t.transform.rotation.z = 0.0;
  t.transform.rotation.w = cos(mot_curr_pos * 2.0 * 3.141592/360.0);;

but I get this on rviz

the problem is that the center of the LIDAR is rotating around the motor axis. It seems like I need to redefine the origin point of the LIDAR, but I don't know how to do that....


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-04-17 01:03:34 -0500

mgruhler gravatar image

I'm not sure if there is a more elegant way (such as redefining the center of rotation for a transform). What you do need is to have the laser_link at the position where you take your readings, assuming this is what you write in your sensor_msgs::LaserScan as the frame_id.

What we have done in this case so far, is to provide a third "mount" link.

I.e.: base_link->laser_mount_link->laser_link, where base_link->laser_mount_link is basically what you have, except for translation.z, and laser_mount_link->laser_link is really just a static transform only containing the translation.z component. (It goes without saying that this can be adapted the way you need/want)

edit flag offensive delete link more


Ok, I've just understand what is happening. The convention is translate first and then rotate. But I need to rotate the base of the scanner and then translate to the center point of the laser. So, I could add another frame or I can compose a rotation + translation (in that order) Thank!

elgarbe gravatar image elgarbe  ( 2018-04-17 08:48:50 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2018-04-16 21:56:48 -0500

Seen: 101 times

Last updated: Apr 17 '18