compas-dev / compas_fab

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

validate/check solution #339

Open matteo-pacher opened 2 years ago

matteo-pacher commented 2 years ago

Feature Request

As a compas_fab user, specifically for RFL planning tools, I noticed that sometimes the MoveIt solver returns invalid solutions, specifically for the external axis.

Details

For example, the solution's joint value for robot 11 external axis Y might be smaller than the one for robot 12 (reminder: external axis Y for RFL is negative). That is physically impossible on the real robot, since the two carts cannot switch. The same example applies to external axis X, meaning that the two gantries switch relative position. No such problem is relevant for external axis Z, since there is no physical constraint linking multiple planning groups in this case. So the issue is not relevant for all external axis. I wonder if the semantic model contains any relevant information that would allow to guide this validation method...? I also wonder if this is a MoveIt specific issue.

Describe the solution you'd like

I can imagine a simple script can be implemented to validate a configuration, both applicable to a single solution (1 configuration for IK queries, for example), or to a motion path solution (a list of configurations). The script might apply to other models other than RFL, such as the two ABB robots on the linear axis.

The function could be something like this (RFL specific implementation):

def validate_configuration(configuration):
    jd = configuration.joint_dict
    if abs(jd['robot11_joint_EA_Y']) > abs(jd['robot12_joint_EA_Y']):
        return("Invalid 11-12 EA_Y configuration!")
    if abs(jd['robot21_joint_EA_Y']) > abs(jd['robot22_joint_EA_Y']):
        return("Invalid 21-22 EA_Y configuration!")
    if abs(jd['bridge1_joint_EA_X']) > abs(jd['bridge2_joint_EA_X']):
        return("Invalid gantries configuration!")

This method could be implemented in check_full_configuration, I guess.