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

Change direction of map/scanmatcher Hector Slam

asked 2022-10-29 14:17:48 -0500

Pieter90 gravatar image

updated 2022-10-29 14:27:42 -0500

My LiDAR is set up in the correct facing position according to the guide and raw data. However, when mapping the "device" and "map" orientation are in the opposite direction (180°). Is there an easy method of either inverting the frame or rotating it by 180°? I found a similar unanswered question in this post.

I have a saved map file which indicates the direction ending as described, which is incorrect.

In integrating the LiDAR the mapping_default.launch file was edited as suggested by this gitHub post.

It should be an easy fix but I do not know which file to edit and I do not wish to break something that technically works.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2023-01-28 23:02:20 -0500

adityatandon gravatar image

From my understanding, your LIDAR frame (laser) is in the opposite direction when compared to your base frame (base_link). The solution is, as you've mentioned, to rotate the frame by 180 degrees.

You can do this by changing the values in the static transform publisher that you've written. The tf publisher accepts arguments in the format - 'x y z yaw pitch roll' with ypr values in radians. Assuming your Z axis is facing upwards, the rotation about the Z axis corresponds to a yaw movement rotation of 3.1416 radians, and that needs to be added to the tf argument.

Simply put, replace the line you added :

node pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster" args="0 0 0 0 0 0 base_link laser 100"

with

node pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster" args="0 0 0 3.1416 0 0 base_link laser 100"

Hoping this helps

edit flag offensive delete link more

Comments

A yaw rotation like this is going to swap the left and right sides of the robot, so a roll may also be needed. I say "may" because there is another complication: the rplidar physically spins clockwise, but ros wants the LaserScan data presented as if the sensor was spinning counter-clockwise.

The rplidarNode driver has a ros param named inverted which can be set to true if you want the driver to reorder the LaserScan data for you (in which case you shouldn't also compensate with the static transform.)

Mike Scheutzow gravatar image Mike Scheutzow  ( 2023-01-29 07:38:44 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-10-29 14:17:48 -0500

Seen: 196 times

Last updated: Jan 28 '23