lardemua / atom

Calibration tools for multi-sensor, multi-modal robotic systems
GNU General Public License v3.0
250 stars 26 forks source link

calibrate creashes when using flag uic (use incomplete collections) #866

Closed miguelriemoliveira closed 8 months ago

miguelriemoliveira commented 8 months ago

Created after #860

In the merged riwmpbot dataset, if we use only complete collections we have only 33, which is still small.

When running calibration using the -uic flag to use incomplete collections we get this error:

clear && rosrun atom_calibration calibrate  -json ~/datasets/riwmpbot_real/merged/dataset.json -uic \
-v -jsf "lambda x: True"  \
-csf "lambda x: int(x) not in [25,27,29,32,34,45, 57]"

we get the error:

Creating parameters ...
Traceback (most recent call last):
  File "/home/mike/workspaces/catkin_ws/devel/lib/atom_calibration/calibrate", line 15, in <module>
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/mike/workspaces/catkin_ws/src/calibration/atom/atom_calibration/scripts/calibrate", line 706, in <module>
    main()
  File "/home/mike/workspaces/catkin_ws/src/calibration/atom/atom_calibration/scripts/calibrate", line 432, in main
    raise ValueError("Cannot set initial estimate for pattern " + Fore.BLUE +
ValueError: Cannot set initial estimate for pattern forearm_pattern at collection 000

From #860, we can see that collection 000 is detected in two patterns,

miguelriemoliveira commented 8 months ago

This is a tricky one

The problem is here

https://github.com/lardemua/atom/blob/c8a2e8a29f8daef60c1d8a55723188362bda96f9/atom_calibration/scripts/calibrate#L420-L452

the dataset['patterns'] in fact has no detection for collection 000. However, the pattern is fixed, and there are other collections which have detected the pattern ... We should be using one of those ...

image

miguelriemoliveira commented 8 months ago

So I traced the creation if the 'transforms_initial' to the data_collector.py script, to a function called estimatePatternPosesForCollection

https://github.com/lardemua/atom/blob/c8a2e8a29f8daef60c1d8a55723188362bda96f9/atom_calibration/src/atom_calibration/collect/patterns.py#L436-L455

So I think that this should remain untouched, since that changing this will deprecate all datasets.

The strategy should be in calibrate, if the pattern is fixed select the first collection which provides a transform initial and use that one.

miguelriemoliveira commented 8 months ago

Fixed. Calibrating with 63 collections ...

image