Using static_transform_publisher for laser tf with slam

asked 2017-04-27 06:37:18 -0500

sirsomething gravatar image


I want to use slam with a mobile robot but I'm not sure if I can use static_transform_publisher to publish the tf between the laser and the base_link. Is that a good practice? Because, so far, I don't think the laser scans are good with this static_transform.


edit retag flag offensive close merge delete



Does the laser scanner rotate? if so it should be in the URDF model and let the robot state publisher do its job with the tf publication.

angeltop gravatar imageangeltop ( 2017-04-27 08:38:52 -0500 )edit

Not yet. I still have it fixed because I was trying to solve this problem. I ended up using laser_scan_matcher to do the tf between odom and base_link and it started working. Do you mean that when I put the laser servo the robot_state publisher will to this tf automatically?

sirsomething gravatar imagesirsomething ( 2017-04-27 08:56:08 -0500 )edit

Then the tf you are using is probably not correct.It does not matter if you publish it with static tf publisher. If you can add the laser link in the URDF with the correct values then it would be easier for you to get the correct tf when the servo is added on the actual robot and URDF model

angeltop gravatar imageangeltop ( 2017-04-27 09:06:39 -0500 )edit

@angeltop what do you mean my tf is not correct? This is my urdf model: and I used: <node pkg="tf" type="static_transform_publisher" name="base_link_to_laser" args="0 0 0.1 0 0 0 1 base_link laser 40" /> to make the tf between the laser and the base_link

sirsomething gravatar imagesirsomething ( 2017-04-27 09:14:20 -0500 )edit

Then i used<node pkg="laser_scan_matcher" type="laser_scan_matcher_node" name="laser_scan_matcher_node" output="screen"> <remap from="scan" to="/laser/scan"/> <remap from="odom" to="/diff_drive_controller/scan"/> <param name="fixed_frame" value = "odom"/>

sirsomething gravatar imagesirsomething ( 2017-04-27 09:15:40 -0500 )edit

<param name="max_iterations" value="10"/> </node>

To publish the tf between the odom and base_link and now I have a +/- accurate map

sirsomething gravatar imagesirsomething ( 2017-04-27 09:16:23 -0500 )edit

I think that there is a confusion. If laser is in the URDF, why would you use a static tf? Publish joint info in joint_states, load URDF and robot_state_publisher. No need for static_tf.

angeltop gravatar imageangeltop ( 2017-04-27 09:22:52 -0500 )edit

@angeltop Since my laser joint is fixed the joint_state_controller/JointStateController is not publishing the laser joint, that's why i'm using the static_transform_publisher to publish the laser joint state. I guess if I use a rotating laser the joint state will be automatically published

sirsomething gravatar imagesirsomething ( 2017-04-27 20:26:01 -0500 )edit