ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to merge laser TF with other TF frames?

asked 2017-11-01 20:38:00 -0600

updated 2017-11-14 06:14:39 -0600

I am new to ROS and I am sure my question reflects this.. Thanks in advance for your time.

I am using Ubuntu 14.04 on a Lenovo W530 laptop. I am running ROS indigo that I installed with apt-get.

I have a physical robot I am trying to ROSify. I was lucky to be instructed on how to begin this process ( https://answers.ros.org/question/2718... both robot and how to rosify can be seen there). I was told to first create a URDF file, which I did (see here: https://pastebin.com/Hzy5jpwP ). After this objective I focused on the next task as per the post, and created a robot state publisher. This code is a really ugly and I apologize in advance, I will clean it up soon. You can see it here: https://pastebin.com/NQVzuUD0 . Right now as I manually rotate my LMS, RViz shows it move in real time.... it's so cool!

The problem that I have is that I am not able to visualize all my frames in a single RViz session at the same time. I can open RViz and create a TF and RobotModel types and there are no errors and everything looks good. However as soon as I add a LaserScan type I get a TF error Transform[sender=unknown_publisher] for frame [laser]: Frame [laser] does not exist:

image description :

To get the Sick LMS to publish it's data I followed this tutorial for sicktoolbox_wrapper: http://wiki.ros.org/sicktoolbox_wrapp... . However I could not see any scans, to see my LMS laser scans I followed the second answer in this post ( https://answers.ros.org/question/7928... ). When I follow the answer I am able to see the laser but the TF and RobotModel in RViz fault out with this message: Fixed Frame [laser] does not exist. image description.

Can you please explain how to amalgamate all the frames so that I can see the TF, RobotModel and LaserScan data types all at the same time without any errors? What code do I need to add to my cpp file or URDF file? If you could please explain with a small code snippet I would really appreciate it.

If I can add any information please let me know.

Thanks in advance.

**********EDIT #1****************

Clarification on implementing the first part of your answer:

In the URDF code snippet you provided, you are suggesting I create a joint between the LaserScanner device that is publishing to the /scan topic and another frame in the URDF file. I can't figure out how to refer to the LaserSensor within the URDF file. Initially I had no sensor tag, so I tried to add a sensor tag ( http://wiki.ros.org/urdf/XML/sensor ) and use it alone, but the error remained the same (as in the first screen shot in this question). Next I tried to create a joint between it and another frame but I started getting errors: [ERROR] [1510628866.601958478]: Failed to ... (more)

edit retag flag offensive close merge delete

Comments

I don't think <sensor> does anything, but <link name="sicklms" /> should make the urdf work.

lucasw gravatar image lucasw  ( 2017-11-14 08:03:05 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-11-02 09:06:32 -0600

lucasw gravatar image

updated 2017-11-14 07:22:01 -0600

You should add a joint between a frame on your robot and laser to your urdf.

<!-- need to make a placeholder link for the laser frame -->
<link name="laser" />  
<joint name="base_to_laser" type="fixed">
    <parent link="base_link"/>
    <child link="laser"/>
    <origin rpy="0 1.57075 0" xyz="0 -0.22 0.25"/>
</joint>

Where instead of the rpy (roll pitch yaw) and xyz above you insert the position of the laser relative to base_link. Or instead of base_link use another frame (lms_link) already in your urdf that is close to where the laser is mounted.

To experiment with different transforms live instead of launching and relaunching with minor changes to the urdf you can publish a transform from the command line (and comment out base_to_laser if it is in the urdf), then lock the values that work best into the urdf: http://wiki.ros.org/tf#static_transfo...

If lms_link is already the correct frame and an additional joint isn't needed then having sicklms publish the laser_scan relative to that is an easy alternative to the above:

rosrun sicktoolbox_wrapper sicklms _frame_id:=lms_link

(or provide it in a launch file with ` within the sicklms node launching xml)

edit flag offensive delete link more

Comments

@lucasw Thanks for your answer! I was able to make a part of it work, but am struggling with implementing it "properly". Could you please have a look at my questions below the "Edit #1" section? Thank you very much for your time.

BuilderMike gravatar image BuilderMike  ( 2017-11-13 21:29:25 -0600 )edit

You can do param setting within the launch file:

<node name="sick_lms_scan_publisher" ... >
  <param name="frame_id" value="lms_link" />
</node>
lucasw gravatar image lucasw  ( 2017-11-14 07:19:16 -0600 )edit

@lucasw thank you very much for your help! Your answer got me unstuck and going. Thanks again for your time, expertise, and reading my project's life story :-)

BuilderMike gravatar image BuilderMike  ( 2017-11-14 16:12:48 -0600 )edit

Question Tools

4 followers

Stats

Asked: 2017-11-01 20:38:00 -0600

Seen: 2,104 times

Last updated: Nov 14 '17