Robotics StackExchange | Archived questions

Using static_transform_publisher for laser tf with slam

Hello!

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

Thanks

Asked by sirsomething on 2017-04-27 06:37:18 UTC

Comments

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.

Asked by angeltop on 2017-04-27 08:38:52 UTC

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?

Asked by sirsomething on 2017-04-27 08:56:08 UTC

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

Asked by angeltop on 2017-04-27 09:06:39 UTC

@angeltop what do you mean my tf is not correct? This is my urdf model: http://textuploader.com/drxbo 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

Asked by sirsomething on 2017-04-27 09:14:20 UTC

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"/>

Asked by sirsomething on 2017-04-27 09:15:40 UTC

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

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

Asked by sirsomething on 2017-04-27 09:16:23 UTC

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. http://wiki.ros.org/urdf/Tutorials/Using%20urdf%20with%20robot_state_publisher#Launch_File

Asked by angeltop on 2017-04-27 09:22:52 UTC

@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

Asked by sirsomething on 2017-04-27 20:26:01 UTC

robot_state_publisher publishes tf for all URDF links. if you publish the joint_state of the wheel joint at /joint_states and load URDF and robot_state_publisher you get tf for all URDF links. http://wiki.ros.org/robot_state_publisher. With fixed links, it makes no diff if you use static tf

Asked by angeltop on 2017-04-28 01:33:52 UTC

Answers