lardemua / atom

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

Bagfile for spjbot in atom examples missing #859

Closed brunofavs closed 8 months ago

brunofavs commented 8 months ago

Hey,

I noticed I didn't have any bagfile for spjbot.

I tried downloading again the files by executing

rosrun atom_calibration download_atom_examples_data

And nothing downloaded regarding spjbot.

I downloaded this bagfile referenced in the spjbot's readme : https://github.com/lardemua/atom/blob/57c8407ffc3309d12649e60cdb4f94b0c473725e/atom_examples/spjbot/README.md#L37-L38

But this bafile's joint_state message doesn't match the joints defined in the scara_xacro urdf, hence popping up this error when running the configuration : ATOM Error: Bagfile /joint_states message do not contain joint ['j1_joint', 'j2_joint', 'j3_joint', 'j4_joint'] (wrist_3_joint in bagfile)

Which I checked and validated by running the bagfile and echo'ing the /joint_state message

header: 
  seq: 44386
  stamp: 
    secs: 2665
    nsecs: 283000000
  frame_id: ''
name: 
  - elbow_joint
  - shoulder_lift_joint
  - shoulder_pan_joint
  - wrist_1_joint
  - wrist_2_joint
  - wrist_3_joint
position: [0.3768785831792094, -0.8497662110263313, -1.4176506551958186, -0.9177547060502302, -1.7342235011927372, -2.6839941245174783]
velocity: [0.0004162651498339359, 0.019066057811052445, -0.00023113907204973794, 0.0003425896073790541, -2.1663502830267488e-05, 2.3462068841774864e-05]
effort: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

And the names don't match.

@miguelriemoliveira if you don't have the correct bagfile, I can record a new one to replace it.

miguelriemoliveira commented 8 months ago

Hi @brunofavs ,

thanks for trying this out.

I added the spjbot train.bag I had on my computer and added it to atom_examples.yml.

Run

rosrun atom_calibration download_atom_examples_data 

again and you should have it. I do not have datasets, so please create one and see if it works. If all runs well please send the dataset to me so I can include it.

brunofavs commented 8 months ago

Hey @miguelriemoliveira

I recorded the dataset and the calibration went smoothly, I had a few hiccups on the prior configuration but nothing critical.

I had to change the keyword "joint_type" to "xacro_joint_type", like in #852, due to the bagfile being old I reckon.

Also, I noticed that whenever there was a example in atom_examples.yml without a complete entry, such as this one ... https://github.com/lardemua/atom/blob/dbb2ed00173e0e29a0eb88a5454d0c440eb39f4e/atom_calibration/scripts/utilities/atom_examples.yml#L123-L127 (missing dataset key)

... the download_atom_examples_data script would crash.

I fixed this in 729c913fa94444bbcc6580db6dd58dbc5082d80c, just by checking whether the key was present before executing.

Regarding the calibration, here are the results of the calibration with the new dataset.

Errors per collection (anchored sensor,  max error per sensor, not detected as "---")
+------------+---------------+
| Collection | rgb_hand [px] |
+------------+---------------+
|    000     |     0.6350    |
|    001     |     0.2477    |
|    002     |     0.5467    |
|    003     |     0.6217    |
|    004     |     0.2206    |
|    005     |     1.4416    |
|    006     |     0.5861    |
|    007     |     0.8387    |
|    009     |     0.7486    |
|    010     |     1.6940    |
|    011     |     0.4009    |
|  Averages  |     0.7256    |
+------------+---------------+

And finally, here is the updated dataset :

train.zip

I think the issue can be closed, please download the updated dataset and close it whenever you can :)

PS : I also fixed the roslaunch command in the spjbot readme, as it was incomplete, only had 3 joints and no joint bias parameters (-jbp) in dbb2ed00173e0e29a0eb88a5454d0c440eb39f4e

miguelriemoliveira commented 8 months ago

Hi @brunofavs ,

thanks.

I am not sure what you mean by

I fixed this in https://github.com/lardemua/atom/commit/729c913fa94444bbcc6580db6dd58dbc5082d80c, just by checking whether the key was present before executing.

There should not be any change in the code. If the field "joint_type" does not exist, the problem is the dataset is deprecated. Can you explain? The link does not help a lot ...

PS : I also fixed the roslaunch command in the spjbot readme, as it was incomplete, only had 3 joints and no joint bias parameters (-jbp) in https://github.com/lardemua/atom/commit/dbb2ed00173e0e29a0eb88a5454d0c440eb39f4e

Thanks

brunofavs commented 8 months ago

Hey @miguelriemoliveira

I am not sure what you mean by ..

The problem was that in the atom_examples.yml previously :

https://github.com/lardemua/atom/blob/dbb2ed00173e0e29a0eb88a5454d0c440eb39f4e/atom_calibration/scripts/utilities/atom_examples.yml#L123-L127

We didn't have yet a dataset for the spjbot, only a bagfile, and the yml didn't have a empty entry for the dataset.

This meant that this line : https://github.com/lardemua/atom/blob/dbb2ed00173e0e29a0eb88a5454d0c440eb39f4e/atom_calibration/scripts/utilities/download_atom_examples_data#L94

Would check if the value of the key "datasets" was None, but would yield error if the key was not in the dictionary.

There may be more pythonic solutions such as the ones here, but they seem a little difficult to read. https://stackoverflow.com/questions/50156550/test-if-dictionary-key-exists-is-not-none-and-isnt-blank

miguelriemoliveira commented 8 months ago

Thanks, If you want improve it and send a PR my way.

miguelriemoliveira commented 8 months ago

Hi @brunofavs ,

is this finished? Can you close it if so?

brunofavs commented 8 months ago

Hi @miguelriemoliveira Yes I think we can close this one :)