-
Notifications
You must be signed in to change notification settings - Fork 123
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
Sensor model constraints with initial guess from current graph optimization #300
Comments
You could take the most recent pose in the graph (T0), then use all the odometry and imu measurements that came after that pose to estimate the relative change from it. You could do that by directly using fuse's hash graph to add whatever odometry and imu constraints between T0 and your pose at the desired timestamp (T1) to do a standalone optimisation in your sensor model. The initial guess for T1 could be obtained from the odometry? Then optimizing with the imu constraints as well gives you the fused initial estimate |
|
Hello @svwilliams. Thank you for your great feedback! I will start with point 1 and 2 and last evaluate point 0 because this takes a bit longer:
Now last to point 0:After your answer I got the feeling that this is not at all intended and therefore today looked again more closer to give you more insights.
You will notice that in graph_6500000000.txt there are two new added variables in the transaction, ecaa765f-54f9-504a-87aa-286d4f1012c4 (line 246) and fe745f27-6e2e-59d4-806c-57c8a7b9a99c (line 236). They are part of our ScanToScanConstraint, the Unicycle2DStateKinematicConstraint, and ScanToMapConstraint. Both are not initialized although we would have expected that they are getting initialized by the motion model of the unicycle_motion_model. They are also new and the latest stamp in the graph. This is the behavior that I meant with uninitialized. That same value is then of course used in our pose estimation outlined above in step 2. However, by thinking about this problem again I found out that I can get around this issue by adding to the scan-to-map model the latest graph pose timestamp to the involvedStamps. By using that, the pending transaction of scan-to-map also gets added motion model prediction containing from the last graph pose to the new pose from the scan-to-map timestamp and is then nicely initialized. It then still overwrites the same variable from (in the case above) scan-to-scan with its value but as all motion model kinematics from the same timestamp are cached, this is no problem. The final question for me is now: Is the change in our implementation then just a workaround or do you see this as an intended function? (which means this is no bug) |
I believe the issue you are experiencing is a bug in the TimestampManager. The intent of this block is to update the variables in the sensor transaction to match the motion model, even for existing motion model segments. In your example, a scan-to-scan constraint is first added between 6.4s and 6.5s. I would expect And And I would expect this block to be skipped because the 6.4->6.5 motion mode segment does not exist yet. And the variables in the transaction are updated to match the motion model here: From your logs, that appears to be working as expected. And then a second constraint is processed, this time containing a scan-to-map constraint at 6.5s. After rereading the code carefully, I would expect Because there is only one entry, no timestamp pairs are created here: And thus, the variables in the sensor constraint will never execute the "update variable" code here: When you modified your code to add a second timestamp to the scan-to-map Transaction, you allowed timestamp pairs to be created, and thus allowed the current code to update the transaction variables. I'll put together a unit test to recreate the scenario and verify it fails. Then I'll work on updating the logic to handle this case correctly. Thanks for providing the debugging logs; that was extremely helpful. I'll let you know when I have something ready to test. |
I've created two unit tests for the TimestampManager to recreate your example: I have confirmed that when creating a transaction on the single most recent variable, that variable does not get updated with the value from the motion model. But when adding a transaction involving two or more variables, all variable values do get updated to match the motion model like we would expect. This is definitely a bug in the TimestampManager. It may take me a few days, but I'll work out a fix and let you know when it is ready. |
I have a potential fix available for review: To the best of my knowledge, this should fix the missing initial conditions issues you described. |
Hi,
We are fusing sensor data from odometry, IMU and laser data scan-to-scan and scan-to-map using fuse with the fixed lag smoother optimizer and noticed an issue for our scan-to-scan and scan-to-map sensor models/constraints. Especially our used scan-to-map algorithm needs a good initial guess and therefore we wrote our own ceres cost function to take the guess from the optimization loop. At our own cost function we take at the overridden function
Evaluate
the (first) incoming guess, compute the scan-to-map pose estimate, cache it for subsequent calls, and then calculate the residuals and jacobians based on the pose error and covariance of the pose estimate.This approach works most times fine but at some strange situations we noticed that our localization is moving either just shortly for a few samples but sometimes even permanent although the robot is at standstill. We found then out that the initial guess at the
Evaluate
function of the cost function is sometimes uninitialized and exactly zero which in some situations causes the above described behavior.So our questions are now:
If you have any further questions, don't hesitate asking.
Thanks,
Fabian
The text was updated successfully, but these errors were encountered: