RobotExMachina / Machina.NET

A library for real-time robot control.
MIT License
86 stars 33 forks source link

Switching between absolute/relative Actions and cartesian/configuration spaces #11

Open garciadelcastillo opened 5 years ago

garciadelcastillo commented 5 years ago

I am writing this issue as documentation of a current limitation of the Machina library and all its derived projects. Such limitation can be described as the user's restricted capacity to switch between absolute/relative Actions when switching between cartesian/configuration space Actions at the same time.

That was a mouthful, let's see an example. The most common scenario for hitting this limitation could be as follows:

// lots of Machina actions of whatever kind
AxesTo(0, 0, 0, 0, 90, 0);  // user issues an Action in configuration space (the robot's axes)
MoveTo(300, 400, 500);  // user issues an Action in cartesian space (the robot's XYZ coordinates)

The MoveTo Action above will yield the following warning/error message:

Cannot apply "Move to [300, 400, 500] mm", currently missing TCP orientation to work with...

This problem is caused because, after issuing AxesTo, Machina lost track of the TCP position and orientation, and when issuing MoveTo, the TCP location can be set in absolute values (doesn't matter what it was before), but the orientation should remain the same, and as there is no information about it, it is impossible to execute the Action.

This limitation is related to Machina's current lack of comprehensive FK/IK solvers and libraries of robot makes/models/dimensions/etc. The problem is, the TCP position/orientation after setting the value of the axes depends on the dimensions and mechanical configuration of the robot. Machina currently doesn't come with a library of robot models, nor has a way of inputting these. Therefore, it works with pure geometrical coordinate spaces, and cannot translate between them without knowing detailed information about the robot.

This same problem arises in several instances of switching between absolute/relative Actions and cartesian/configuration spaces. For example, situations that work:

TransformTo(...);  // Machina is given all necessary parameters to describe cartesian pose
MoveTo(...);  // absolute position can be set, maintaining same orientation as in previous pose
AxesTo(...);  // same for configuration space
Axes(...);  // relative parameters can be added to prev configuration
TransformTo(...);  // all cartesian parameters
Move(...);  // add relative movement with same orientation as before
AxesTo(...);  // still works, because all axes values are overridden, regardless of what they were before
TransformTo(...);
AttachTool(...);  // Machina can add the tool's position/orientation offset to the previous Action

On the contrary, the following will not work:

TransformTo(...); 
Axes(...);  // since the absolute values of the axes are not known at this point, a relative increment cannot be computed
AxesTo(...);
Move(...);  // since the position/orientation of the robot is unknown at this point, no values can be added to it
AxesTo(...);
AttachTool(...);  // this will actually go through, but may yield inconsistent results...

A workaround to this issue is, whenever in doubt, using the absolute Action that provides the most information to Machina, namely TransformTo() (can be followed by any cartesian Action) or AxesTo() (can be followed by any axes-related action).

Solving this problem involves adding a library of robot makes/models/dimensions, along FK/IK solvers for each. While this is extremely desirable, and would make Machina amazing, it is currently outside the scope of what I can commit to, and will likely not be implemented any time soon... :( If you would like to collaborate, drop me a message/tweet :)