ros-perception / calibration

Provides a toolchain to calibrate sensors and URDF robot models.
http://www.ros.org/wiki/calibration
33 stars 30 forks source link

Writing to URDF fails with current git on hydro, works on .deb on groovy. #21

Closed skohlbr closed 10 years ago

skohlbr commented 10 years ago

On hydro with calibration cloned from github, I get this at the end of optimization:

[INFO] [WallTime: 1386193299.722197] Writing original urdf to robot_uncalibrated_2013_12_04_16_41.xml
Traceback (most recent call last):
  File "/home/kohlbrecher/flor_repo/catkin_ws/src/calibration/calibration_estimation/src/calibration_estimation/multi_step_cov_estimator.py", line 367, in 
    outfile.write( robot_params.get_clean_urdf().to_xml() )
  File "/home/kohlbrecher/flor_repo/catkin_ws/src/calibration/calibration_estimation/src/calibration_estimation/urdf_params.py", line 248, in get_clean_urdf
    self.urdf.elements.remove(self.urdf.joint_map[joint])
AttributeError: 'Robot' object has no attribute 'elements'
Estimator exited prematurely with error code [1]

On groovy from .debs, the writing to URDF step works (but optimization performs very poorly for some reason, which I don´t care about right now).

vrabaud commented 10 years ago

Hi, I can easily fix the bug (it's due to the new urdfdom_python) but I need to be able to reproduce it. What instructions did you follow exactly ? Thx.

skohlbr commented 10 years ago

Essentially following the normal workflow (using maxwell_calibration as an example, my setup is currently not available but heavily based on the maxwell package, so I´d expect the same to happen) :

The error should appear after optimization successfully finished.

vrabaud commented 10 years ago

Hi. I'm sorry I cannot test the whole pipeline, can you please try to replace the faulty lines as follows: self.urdf.elements.remove(self.urdf.joint_map[joint]) by self.urdf.joints.remove(self.urdf.joint_map[joint])

self.urdf.elements.remove(self.urdf.link_map[link]) by self.urdf.links.remove(self.urdf.link_map[link])

thx.

skohlbr commented 10 years ago

Original error gone after suggested changes, but now the following happens:

[INFO] [WallTime: 1386488525.073267] Writing original urdf to robot_uncalibrated_2013_12_08_02_39.xml
Traceback (most recent call last):
  File "/home/kohlbrecher/flor_repo/catkin_ws/src/calibration/calibration_estimation/src/calibration_estimation/multi_step_cov_estimator.py", line 367, in 
    outfile.write( robot_params.get_clean_urdf().to_xml() )
TypeError: expected a character buffer object
vrabaud commented 10 years ago

Right, please replace .to_xml() by .to_xml_string() (you have to do it twice in the file) Thx (I'll push the patch whenever you give me the green light)

skohlbr commented 10 years ago

Confirmed working, green light given ;)

vrabaud commented 10 years ago

thx ! releasing now.

skohlbr commented 10 years ago

Didn´t want to open new ticket, but saving URDF with gearing also results in error (and maybe also estimation of some other properties):

[INFO] [WallTime: 1386936446.489833] Writing original urdf to robot_uncalibrated_2013_12_13_07_00.xml
Traceback (most recent call last):
  File "/home/kohlbrecher/flor_repo/catkin_ws/src/calibration/calibration_estimation/src/calibration_estimation/multi_step_cov_estimator.py", line 371, in 
    urdf = update_urdf(robot_params.get_clean_urdf(), robot_params)
  File "/home/kohlbrecher/flor_repo/catkin_ws/src/calibration/calibration_estimation/src/calibration_estimation/multi_step_cov_estimator.py", line 183, in update_urdf
    update_transmission(urdf, joint, gearing)
  File "/home/kohlbrecher/flor_repo/catkin_ws/src/calibration/calibration_estimation/src/calibration_estimation/multi_step_cov_estimator.py", line 167, in update_transmission
    for transmission in urdf.transmissions.values():
AttributeError: 'list' object has no attribute 'values

Other than that, things are working well, thanks for the fixes! atlas_calib_small

vrabaud commented 10 years ago

Hi, all those errors are the same: maps got replaced by list. Just replace transmissions.values() by transmissions. Let me know how much further you go. Thx.

vrabaud commented 10 years ago

did that work for you ? Thx

skohlbr commented 10 years ago

Sorry for the delay. After the proposed change I now get

[INFO] [WallTime: 1389016631.469204] Writing original urdf to robot_uncalibrated_2014_01_06_14_20.xml
Traceback (most recent call last):
  File "/home/kohlbrecher/flor_repo/catkin_ws/src/calibration/calibration_estimation/src/calibration_estimation/multi_step_cov_estimator.py", line 371, in 
    urdf = update_urdf(robot_params.get_clean_urdf(), robot_params)
  File "/home/kohlbrecher/flor_repo/catkin_ws/src/calibration/calibration_estimation/src/calibration_estimation/multi_step_cov_estimator.py", line 183, in update_urdf
    update_transmission(urdf, joint, gearing)
  File "/home/kohlbrecher/flor_repo/catkin_ws/src/calibration/calibration_estimation/src/calibration_estimation/multi_step_cov_estimator.py", line 169, in update_transmission
    transmission.reduction = transmission.reduction * gearing
AttributeError: 'Transmission' object has no attribute 'reduction'
Estimator exited prematurely with error code [1]

Ideas? You´ll probably be faster than me in tracing what´s going wrong. Looks to me like the URDF class has changed.

vrabaud commented 10 years ago

ok, I'm back. I think it's fixed in c524c6661be8f17dc15cd51afe97f11b51cf40b9 , please confirm.

skohlbr commented 10 years ago

Confirmed, now get a .xml/URDF that also has the mechanicalReduction tags set correctly.

vrabaud commented 10 years ago

no crash, nothing anymore ? I can close ? (sorry for that crappy way of debugging ...)

skohlbr commented 10 years ago

At least for my use cases, no crashes anymore. Will report back in a new issue if anything else comes up. Also we´re using an already closed ticket right now ;) Thanks for the efforts, much appreciated :)