Ask Your Question
0

How can I show two lasers in rviz (one of them in different position)?

asked 2014-07-04 00:25:29 -0600

Rodolfo gravatar image

updated 2014-07-05 16:22:29 -0600

Hello. I am new on ROS and I am trying to display two lasers on ROS. I have been trying with tf with no results. The problem is that I have the same origin for both, so the data of on is over the data of the other. I want to explain somehow that one of them is one meter to the left of the other.

Do you have any hint for doing this?

Now i am getting one laser data over the other, as you can see here: https://www.dropbox.com/s/bwk8718wykw...

Thanks

Edit: I am using this as launch file:

 <launch>
  <node pkg="sicktoolbox_wrapper2" name="lms5xx_110" type="sicklms_5xx">
  <remap from="scan" to="laser1" />
    <param name="ip_add" value="192.168.0.110" />
    <param name="frame_id" value="world" />
  </node>


  <node pkg="sicktoolbox_wrapper2" name="lms5xx_111" type="sicklms_5xx">
  <remap from="scan" to="laser2" />
    <param name="ip_add" value="192.168.0.111" />
    <param name="frame_id" value="world" />
  </node>

<node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="0 0 0 0 0 0 world laser1 100" />

<node pkg="tf" type="static_transform_publisher" name="link2_broadcaster" args="4 0 0 0 0 0 world laser2 100" />

</launch>
edit retag flag offensive close merge delete

Comments

The problem is that I have the same origin for both, so the data of on is over the data of the other. I want to explain somehow that one of them is one meter to the left of the other.

Rodolfo gravatar imageRodolfo ( 2014-07-04 01:02:29 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2014-07-05 22:51:29 -0600

ahendrix gravatar image

updated 2014-07-06 01:49:35 -0600

Try this modification of your launch file. Note that I've changed the frame IDs of the laser to match the frame IDs of the static transform broadcasters. You should be able to view both lasers relative to each other by setting your fixed frame in rviz to world.

<launch>
  <node pkg="sicktoolbox_wrapper2" name="lms5xx_110" type="sicklms_5xx">
  <remap from="scan" to="laser1" />
    <param name="ip_add" value="192.168.0.110" />
    <param name="frame_id" value="laser1" />
  </node>


  <node pkg="sicktoolbox_wrapper2" name="lms5xx_111" type="sicklms_5xx">
  <remap from="scan" to="laser2" />
    <param name="ip_add" value="192.168.0.111" />
    <param name="frame_id" value="laser2" />
  </node>

<node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="0 0 0 0 0 0 world laser1 100" />

<node pkg="tf" type="static_transform_publisher" name="link2_broadcaster" args="4 0 0 0 0 0 world laser2 100" />

</launch>
edit flag offensive delete link more
0

answered 2014-07-04 00:37:18 -0600

sai gravatar image

I hope you were able to first display one laser data atleast in Rviz/

Create a \world frame and with respect to that create two new frames called \laser1 and \laser2 on to which the data from different lasers is published. This can be done by setting the frame id in the header of the messages that are being published.

Then in Rviz, display two laser display plugins and set the target frame in Rviz consistently.

edit flag offensive delete link more

Comments

Thanks for your answer. I am able to display both lasers on Rviz. The problem is that I have the same origin for both, so the data of on is over the data of the other. I want to explain somehow that one of them is one meter to the left of the other.

Rodolfo gravatar imageRodolfo ( 2014-07-04 00:56:00 -0600 )edit
0

answered 2014-07-04 01:58:49 -0600

Hi @Rodolfo,

an easy way to do it is using tf's static_transform_publisher the details are well explained in the wiki.

Of course, using tf's API in C++ or python you could create a node to broadcast these transformations, but it is slightly more difficult.

You can also create a robot description using URDF and publish the transformations of this file using robot_state_publisher.

Good luck!

edit flag offensive delete link more

Comments

Thanks for your reply. I tried with the static_transform_publisher but there are no new subscribers to the topic of the laser, as seen in this picture: www.dropbox.com/s/ns8cu6i09sor4r9/SS.png .(the subscriber is rviz) I added the launch file in the original question.

Rodolfo gravatar imageRodolfo ( 2014-07-04 02:36:50 -0600 )edit

have you ticked the Hide Debug option in rqt_graph? It works to me, find my example launch file and screenshot at https://gist.github.com/martimorta/64bc08ba9934b1ad7a02 .

martimorta gravatar imagemartimorta ( 2014-07-04 03:18:08 -0600 )edit

From your launch file, your static transform has wrong child and parent frame_ids, check out my example. (You don't need a frequency of 1000Hz either)

martimorta gravatar imagemartimorta ( 2014-07-04 03:20:45 -0600 )edit

Thanks for the complete answer. I tried what you say and this is the result: https://www.dropbox.com/s/bwk8718wykwzwd7/lasers.png As you can see there, the position of one laser referred to the other is the same, so one scan is over the other. (I updated the launch file in the question)

Rodolfo gravatar imageRodolfo ( 2014-07-04 11:39:31 -0600 )edit

You should set the frame_id for each laser to the frames that you're broadcasting; laser1 and laser2

ahendrix gravatar imageahendrix ( 2014-07-05 20:43:26 -0600 )edit

you mean that I should use <node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="0 0 0 0 0 0 laser1 WHAT_HERE? 100"/>

Rodolfo gravatar imageRodolfo ( 2014-07-05 21:33:48 -0600 )edit

Nope. I mean that in your laser node you should set the frame_id to laser1 or laser2

ahendrix gravatar imageahendrix ( 2014-07-05 21:35:01 -0600 )edit

And how can I view the two lasers on rviz with different fixed frames? Because if I set frame_id to laser1 or laser2, I should change the fixed frame in rviz and I can see only one laser each time

Rodolfo gravatar imageRodolfo ( 2014-07-05 22:12:31 -0600 )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

Stats

Asked: 2014-07-04 00:25:29 -0600

Seen: 726 times

Last updated: Jul 06 '14