-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix the issue (#198) that loop closures can rotate the map 180° if the lidar is mounted backwards #326
fix the issue (#198) that loop closures can rotate the map 180° if the lidar is mounted backwards #326
Conversation
…ap 180° if the lidar is mounted backwards Set the edges (constraints) based on the robot base frame (base_footprint) instead of sensor frame (laser).
So by backwards, you do not mean up-side down, correct? By the way, just going to chat on this PR since all the others are the same, I'll just merge them all at once but use this as the proxy. #198 (comment) <-- Can you show that you can work on this dataset and have it work? They give a pretty good backwards-lidar dataset here. We resolved this by changing a loss function, so please make sure you don't use that one for your testing to show that it also fixes the issue (and does so more reliably). So I think we're getting more to the root of all these rplidar problems then. It sounds like there were CPU (fixed), backwards (or rather, non-directionally aligned), and 360 param read in wrong (fixed). There's also this "flipping" problem only 360 lidar users report (#281) that I also wonder if this would fix if this indeed is a functional solution... (also makes me wonder if this was my issue with the multi-lidar support testing... mhm...). It would be mighty convenient if this fixed that too. I've never been able to replicate on professional 270 lidars so its been hard for me to be able to spend the time to fix it. Something along these lines could be the root cause or at least a new way of thinking I can use to see if I can spot other locations in the Karto code this is wrong. I'll review in a moment. I super appreciate you digging into this code. It's been hard to fix all these issues without someone else to bounce ideas off of that's dug into the core SLAM code. 👏 |
I've recorded a video of mapping process using #198 dataset. |
Thanks for the verification. @coderkarl also verified which is good to have an external thumbs up. I agree this is an issue and now I agree that your solution is workable. Now we're just on the details of making sure this is the right place to put it / if there's a better way to accomplish the same task. |
When I try localization mode with new code, every time loop closure comes, there comes a warning of ceres |
The only difference I can tell is that old L1611 Did you check the inputs / outputs of the new function to make sure its working properly? If mapping works OK and just localization, I feel like it does, but just checking. I highly doubt its the issue, but also try removing |
I mean b0800ed, not just 5cb6690. |
To repeat that back to you, you think this change makes the serialized data wrong so things are failing? that would make sense, we're messing with things at a somewhat low level. ABI breaking changes like this might impact any data you've previously recorded, but its necessary to fix the bug. What happens if you run it over a newly generated serialized file done with the code in this PR after the change? |
Firstly I tried to find the problem with deserialization when I use "1 line change" solution, and (after adding lots of print function) I found that the problem is from |
I don't understand why calling Update would change Ceres's ability to find a solution. Update is messing with the point values and resetting
Does A single small dataset of 9 loop closures having it appear once might not be the worst-case situation. I don't think it was happening at all prior. If we have new serialized files with the new code, then it should be acting at least as good as before in localization mode if we did everything correctly, yes? |
@WLwind any update? Just trying to iterate on the best solution to this issue so that it doesn't come back and bite you |
I'm busy these days and have little time to consider about this issue, sorry. |
Closed the other 2 PRs since we're still working on getting this one passing completely |
Thank you for testing! I really don't have time to test it these weeks. |
Thanks for identifying this issue so we can finally put this issue to bed! |
Set the edges (constraints) based on the robot base frame (base_footprint) instead of sensor frame (laser).
Basic Info
Description of contribution in a few bullet points
The reason of weird results of loop closures when lidars are mounted backwards is that the vertices and the edges of the solver are not based on the same frame. The original code sets the pose of the base link (base_footprint) as the vertex pose, but the edges are constraints of 2 poses of sensor frame (laser). That's really unreasonable because the tf between base poses and the tf between their corresponding sensor poses are not the same! The differences are significantly big especially when the sensor is at the opposite orientation of the robot base. So this uncommon loop closure will always happen (more or less) unless the sensor frame is at the exact pose of the base. This is regardless of whether the lidar is 360° or whether it's an RPLIDAR.
I made the edges and vertices based on the same frame. I simply set the edges (constraints) based on the robot base frame (base_footprint) instead of sensor frame (laser).
It works well with my backwards mounted RPLIDAR A2.
Description of documentation updates required from your changes
Future work that may be required in bullet points
I don't have a ROS2 robot yet. Is anyone there be kind to test this modification on a ROS2 robot?