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

[SOLVED] gmapping fails to build map

asked 2020-10-23 06:56:00 -0500

leorobot gravatar image

updated 2020-10-30 05:55:55 -0500

Hello everyone, I've been struggling on this one for a week now. I am using the husarion rosbot 2.0 on ros melodic and I'm trying to build a map while driving the robot around. I don't record a bag because I need to look at the map building itself in real time in rviz. In the launch file I've set the following parameters, base_frame, map_frame, odom_frame, maxRange, maxUrange, minUrange, map_update_interval, xmax, xmin, ymax, ymin and delta.

When I launch the system the first mapping is correct, but as soon as i start driving the robot around, it looks like the the scans are not on the same world frame. I started to look the frames of tf, map frame is static, the base frame is moving like the robot, and odom frame is moving weirdly. I can't understand why this odom frame is moving and i feel like this is where the problem come from but i can't find what is really the problem and how i can fix it. I drive the robot very slowly so there's no drifting.

I would like to add captures of my code and of rviz but I'm new here so I've less than 5 points and I can't paste some code here, don't know why.

I have no errors while running but a warning "Transform from imu_link to base_link was unavailable for the time requested. Using latest instead." but I don't think it is the problem, is it?

Here is the TF tree (if the tabs aren't displayed : odom is child of map, base_link is child of odom, imu_link and laser are chlidren of base_link) :

└── map
└── odom [/slam_gmapping]
└── base_link [/rosbot_ekf]
├── imu_link [/imu_publisher]
└── laser [/link1_broadcaster]

The /pose topic (suscribed by msg_conversion) and the /odom topic are coherent to the robot moves but the tf transformation beetween mad to odom are not.

Please tell me if I can add anything to the question that would help you to help me, I'm quite new to ROS. If anyone could help me here it would be very appreciated I'm starting to loose my mind over this thing.

edit retag flag offensive close merge delete

Comments

I would suspect that your TF is wrong. Can you paste your TF tree here? You can use ros-blessed to get an ascii representation of your tree.

chfritz gravatar image chfritz  ( 2020-10-24 11:27:51 -0500 )edit

It looks like a TF problem because thanks to ros-blessed I can see that the transformation between map and odom moves over time even if the robot stays at the same spot from launching to shutdown. Is it possible to edit the tf transforms (I haven't made any of these because it was already implemented on the robot by the constructor).

leorobot gravatar image leorobot  ( 2020-10-26 04:38:27 -0500 )edit

Thanks for adding the tree. I assume rosbot_ekf is a robot_localization node. If so then I suspect the problem to be in the config of that. Could you post that here?

chfritz gravatar image chfritz  ( 2020-10-26 09:44:13 -0500 )edit

There is a robot_localization package in /opt/ros/melodic/share/ that is launched by rosbot_ekf but I can't find the file that is called, and the parameters of the localization are in rosbot_ekf/params. I'm a bit lost in these big packages but here is the params file of rosbot_ekf. Please tell me if I misunderstood what you're asking for ! https://github.com/husarion/rosbot_ek...

leorobot gravatar image leorobot  ( 2020-10-27 07:55:45 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2020-10-24 00:49:22 -0500

miura gravatar image

Changing the orientation of the sensor you are using to scan might work.

This can be useful if the orientation of the robot and the direction of the sensor do not match. The robot is moving forward, but the sensor is moving backwards, which can cause the mapping to fail.

edit flag offensive delete link more

Comments

I tried to do so with a static_transform_publisher in the launch file. It does not resolves the problem.

leorobot gravatar image leorobot  ( 2020-10-26 04:26:36 -0500 )edit
1

You were right but it was about changing the orientation of the sensor but by modifying the original node. Adding a new static_transform_publisher causes errors in all the others frames transformations, I don't know why. You can find the name of the node publishing on tf using ros-blessed, then use "grep -r name_of_the_nodeyour_workspace" to find where the node is initialised and modify the orientation there. Thank you Miura and Chfritz for your help, it is very appreciated.

leorobot gravatar image leorobot  ( 2020-10-30 05:55:36 -0500 )edit

I'm glad I was able to help.

miura gravatar image miura  ( 2020-10-30 21:53:14 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-10-23 06:56:00 -0500

Seen: 683 times

Last updated: Oct 30 '20