-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add finalize option in write state service. #613
Conversation
Thanks. Can you explain how you want to use this? Should I imagine that you have a robot running SLAM, then you want to save the optimized state to disk. Now your cartographer_node is not consuming sensor data anymore as all trajectories have been finished. What do you do now with that cartographer_node? Do you want to start a new trajectory now and localize against the existing ones? |
Yes, I can start a new trajectory to localize the robot or to extend the existing map without killing the robot. Since our robots should be operatable 24/7, I need to achieve the followings without killing the cartographer_node.
Also, I had a trouble to find a moment to save the pose graph after SLAM programmatically when optimization takes longer than robot's actual movement. As a cartographer developer, I can more or less tell when to save the map by checking terminal logs( |
Ok, makes sense to me. I am just wondering whether conflating state writing and finishing and running optimization is the right thing. Currently WriteState is a "const" functions so to speak. Setting We already have a call to finish a trajectory. I am wondering whether it wouldn't be possible to add a ROS method that forces an optimization and returns when the optimization is done. This way you could
This way other people might be more easily able to reuse these building blocks in a different way for their own use case. WDYT? |
Sounds good to me. Basically, Then, how about creating a ros service that finishes all trajectories and call |
Yes I was also wondering about how difficult it is to make such a |
Ok. Let me know how your investigation goes. FYI, this check in constraint builder was being evil when I was trying to refactor HandleWorkQueue logics as we discussed in cartographer-project/cartographer#563. |
I agree about adding a Regarding the work queue, I think that |
Small update: I spent some time today studying the concurrency in PoseGraph / ConstraintBuilder but I need to think about this a little more before I understand it fully. |
@jihoonl To separate the issues from cartographer-project/cartographer#563 from this discussion here, could upload a PR where you show how you tried to refactor
check in |
@ojura I looked at your custom constraints PR. Why do you think refactoring
One thing I guess is that the trimmers are not invoked as part of the current |
It's really been a while since I wrote that code so I don't remember right now, but my guess would be the following: I have multiple things (such as I still have a really tight schedule, but I will get back to this when I can :) |
I noticed that @jihoonl opened the PR #726 which performs a similar thing. As discussed in cartographer-project/cartographer_ros#613 (@cschuet has already taken a look), I pulled this out of #481 (a really old PR whose merging has been postponed), which is an example where re-running optimization is triggered from elsewhere as well (besides from `ComputeConstraintsForNode`). This refactoring makes libcartographer friendlier for use cases such as that one. An important detail is that I have changed the condition in `WaitForAllComputations` to also check if the work queue is empty. If there are other things on the worker queue besides `ComputeConstraintsForNode`, currently we will wrongfully conclude that all computations are done. (This detail was merged in #754, so it's no longer in the diff of this PR). Also missing is the same thing for 3D. I can add that when we settle on this. Also, I suggest that `run_loop_closure` gets renamed to `run_optimization`.
…n. (#729) I noticed that @jihoonl opened the PR #726 which performs a similar thing. As discussed in cartographer-project/cartographer_ros#613 (@cschuet has already taken a look), I pulled this out of #481 (a really old PR whose merging has been postponed), which is an example where re-running optimization is triggered from elsewhere as well (besides from `ComputeConstraintsForNode`). This refactoring makes libcartographer friendlier for use cases such as that one. An important detail is that I have changed the condition in `WaitForAllComputations` to also check if the work queue is empty. If there are other things on the worker queue besides `ComputeConstraintsForNode`, currently we will wrongfully conclude that all computations are done. (This detail was merged in #754, so it's no longer in the diff of this PR). Also missing is the same thing for 3D. I can add that when we settle on this. Also, I suggest that `run_loop_closure` gets renamed to `run_optimization`. Original commit: cartographer-project/cartographer@58d94aa
I am closing this PR since we decided not to take this approach. |
…r-project#729) I noticed that @jihoonl opened the PR cartographer-project#726 which performs a similar thing. As discussed in cartographer-project/cartographer_ros#613 (@cschuet has already taken a look), I pulled this out of cartographer-project#481 (a really old PR whose merging has been postponed), which is an example where re-running optimization is triggered from elsewhere as well (besides from `ComputeConstraintsForNode`). This refactoring makes libcartographer friendlier for use cases such as that one. An important detail is that I have changed the condition in `WaitForAllComputations` to also check if the work queue is empty. If there are other things on the worker queue besides `ComputeConstraintsForNode`, currently we will wrongfully conclude that all computations are done. (This detail was merged in cartographer-project#754, so it's no longer in the diff of this PR). Also missing is the same thing for 3D. I can add that when we settle on this. Also, I suggest that `run_loop_closure` gets renamed to `run_optimization`.
This changes the origin of accumulated range data from the zero vector (which could be far off) to the origin of the first range data in the accumulation.
I noticed that @jihoonl opened the PR #726 which performs a similar thing. As discussed in cartographer-project/cartographer_ros#613 (@cschuet has already taken a look), I pulled this out of #481 (a really old PR whose merging has been postponed), which is an example where re-running optimization is triggered from elsewhere as well (besides from `ComputeConstraintsForNode`). This refactoring makes libcartographer friendlier for use cases such as that one. An important detail is that I have changed the condition in `WaitForAllComputations` to also check if the work queue is empty. If there are other things on the worker queue besides `ComputeConstraintsForNode`, currently we will wrongfully conclude that all computations are done. (This detail was merged in #754, so it's no longer in the diff of this PR). Also missing is the same thing for 3D. I can add that when we settle on this. Also, I suggest that `run_loop_closure` gets renamed to `run_optimization`.
to support saving of fully optimized state without killing the cartographer node.
Reopen of #611.