robotology / urdf2casadi-matlab

MIT License
29 stars 9 forks source link

Add small threshold for non perfect null axis vector components #21

Closed singhbal-baljinder closed 3 years ago

singhbal-baljinder commented 3 years ago

In some URDF files have the axis attribute of the joints, i.e. the joint axis specified in the joint frame, have non perfectly null components for simple revolute or prismatic joints. See for example https://github.com/robotology/urdf2casadi-matlab/blob/a1fa3a9398f582448cd7ae9b083d29ff7313c73e/URDFs/iCubGenova9.urdf#L439 To set appropriately the joint type it is better to use a numerical threshold. For a mathematical description of the URDF formalism see https://github.com/robotology/blender-robotics-utils/issues/3#issuecomment-906262419.

traversaro commented 3 years ago

The change seems fine, but just to understand in urdf2casadi-matlab we do not support axis that are not aligned with x, y or z?

singhbal-baljinder commented 3 years ago

The change seems fine, but just to understand in urdf2casadi-matlab we do not support axis that are not aligned with x, y or z?

For now yes, we support only revolute and prismatic axes aligned with the joint frame. Actually I did add at the time a generalization for non aligned axis by converting from rotation axis to rotation matrix in https://github.com/robotology/urdf2casadi-matlab/blob/a1fa3a9398f582448cd7ae9b083d29ff7313c73e/%2Burdf2casadi/%2BUtils/%2BSpatial/jcalc.m#L36 Since I did not have right in my hand a URDF file with which I could test this feature, I decided to not add it as an option. Actually I thought that this case would be caught as an error in https://github.com/robotology/urdf2casadi-matlab/blob/a1fa3a9398f582448cd7ae9b083d29ff7313c73e/%2Burdf2casadi/%2BUtils/%2BSpatial/jcalc.m#L68 I will add this info specifically in the README.

traversaro commented 3 years ago

Great, thanks!