compas-dev / compas_fab

Robotic fabrication package for the COMPAS Framework.
https://compas.dev/compas_fab/
MIT License
108 stars 32 forks source link

Analytical Kinematics #321

Closed romanarust closed 2 years ago

romanarust commented 2 years ago

I am making this a draft PR to motivate discussion on the integration. I started this branch some time ago and found finally some time to continue....

This adds analytical kinematics to compas_fab for spherical-wrist and offset-wrist robots. At the moment (UR3, UR5, UR10, ABB_IRB_4600_40_255, Staubli_TX2_60L) It could help to quickly test if there are IK solutions for a frame if no backend client is available and supports the subsequent implementation of cartesian path planning or the calculation of reachability spaces.

Please see here an example of how it can be used. In this example, PyBullet is used to test if certain configurations are in collision.

I am a bit stuck because although it would be good if Analytical_InverseKinematics would inherit from InverseKinematics, InverseKinematics returns joint_positions, joint_names, defining one Configuration and not 8 ones. There are many ways how to tackle this, for example:

PS: The implementation of the IK functions is at the moment rather slow and could in the future be replaced by some fancy IK fast plugins.

What type of change is this?

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

romanarust commented 2 years ago

@gonzalocasas, I've implemented Beverly's suggestions. from my side, this is done - do you want to have a look?

gonzalocasas commented 2 years ago

Ah! the ironpython unit testing is failing because of Pybullet, you'd need to wrap those tests around a check for if not compas.IPY

romanarust commented 2 years ago

I have only one suggestion that ideally we apply before merging: instead of exposing the IK_SOLVERS dictionary that contains instances of solver functions, wouldn't it be cleaner to say that the argument takes a string, e.g. ur5 and the lookup in the dictionary is internal to the analytical solver class? This would be identical to what we do with the planner_backend argument of RosClient: https://github.com/compas-dev/compas_fab/blob/main/src/compas_fab/backends/ros/client.py#L36

good point!

gonzalocasas commented 2 years ago

yay!! 💃 I think this is good to go as soon as Github Actions finishes building!

gonzalocasas commented 2 years ago

looks like the last workflow of Github Actions is stuck... I think you can go ahead and merge directly