[SOLVED] gmapping fails to build map
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.
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.
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).
Thanks for adding the tree. I assume
rosbot_ekf
is arobot_localization
node. If so then I suspect the problem to be in the config of that. Could you post that here?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...