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

How to merge two LaserScans to one LaserScan with different frame_ids

asked 2021-12-08 08:27:14 -0500

sincoy gravatar image

Hello everbody,

I have to implement a mobile robot which contains two lasers (sensor_1 and sensor_2).

sensor_1 has the topic /scan_1 and sensor_2 has the topic /scan_2.

The scans from my sensors should captured in an output topic "scan" which should reference to the specified frame_ids (sensor_1 and sensor_2).

The problem on my mobile robot is that one sensor is placed in the front left and the other sensor is placed in the back right. Therefore, I cannot use the common frame base_link for both sensors, because a map is created from the base_link and not from the respective sensors.

Is there maybe a solution for this?

Thank you in advance! I appreciate your help!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2021-12-09 06:19:13 -0500

miura gravatar image

Why don't you create a launch file like the following?

Connect sensor_1, sensor_2, and the merged scan frames with static_transform_publisher to see how they relate to base_link.

  <node pkg="tf" type="static_transform_publisher" name="link0" args=" 0.000   0.000 0.000 0.000 0.00 0.00 base_link laser 100" />
  <node pkg="tf" type="static_transform_publisher" name="link1" args=" 0.250  -0.267 0.000 0.000 0.00 0.00 base_link sensor_1 100" />
  <node pkg="tf" type="static_transform_publisher" name="link2" args="-0.250   0.267 0.000 0.000 0.00 0.00 base_link sensor_2 100" />

  <node name="LiDAR_front" pkg="urg_node" type="urg_node">
    <param name="ip_address" value="192.168.0.1"/>
    <param name="frame_id" value="sensor_1"/>
    <remap from="scan" to="scan_1" />
  </node>
  <node name="LiDAR_back_left" pkg="urg_node" type="urg_node">
    <param name="ip_address" value="192.168.0.2"/>
    <param name="frame_id" value="sensor_2"/>
    <remap from="scan" to="scan_2" />
  </node>

  <node pkg="ira_laser_tools" name="laserscan_multi_merger" type="laserscan_multi_merger">
    <param name="destination_frame" value="laser"/>
    <param name="scan_destination_topic" value="/scan"/>
    <param name="laserscan_topics" value ="/scan_1 /scan_2" />
  </node>
edit flag offensive delete link more

Comments

Thanks four your reply! I checked again the ira_laser_tools package and determined that the merged laserscan is published correctly. So it is only necessary to use the node of ira laser tools. The code considers the transformation.

But now my problem is that the SLAM algorithm is mapping from the base_link. Do you have any idea for that? I will try to launch my slam with your mentioned transformation nodes.

sincoy gravatar image sincoy  ( 2021-12-09 11:43:08 -0500 )edit
1

answered 2021-12-09 05:30:18 -0500

3473f gravatar image

This can be achieved using the Laserscan_merger from the ira_laser_tools package. This will allow you to merge the two scans and reference the resulting scan to a specific frame using the destination_frame parameter.

edit flag offensive delete link more

Comments

Thank you for your reply! The problem is that I need two destination frames in this case. But the ira laser tool supports only one destination frame

sincoy gravatar image sincoy  ( 2021-12-09 05:42:33 -0500 )edit
1

why don't you create a new frame at the mid-point between the two laser scanners and use it as a reference for the merged scan?

3473f gravatar image 3473f  ( 2021-12-09 06:54:23 -0500 )edit

the ira laser tool works fine! It considers the transformations. The SLAM algortihm is mapping from the base_link and not from the sensors, I thought that the merged scan is making this trouble.

sincoy gravatar image sincoy  ( 2021-12-09 11:47:04 -0500 )edit
1

Which algorithm are you using? Most algorithms will allow you to set the reference frame as a parameter in the launch file.

3473f gravatar image 3473f  ( 2021-12-10 04:22:30 -0500 )edit

I am using gmapping as algorithm

sincoy gravatar image sincoy  ( 2021-12-10 12:15:26 -0500 )edit
1

@3473f Perhaps it is better to discuss it here. https://answers.ros.org/question/3925...

miura gravatar image miura  ( 2021-12-10 18:50:06 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2021-12-08 08:27:14 -0500

Seen: 1,645 times

Last updated: Dec 09 '21