DistanceConstr - #131
Conversation
|
Tick the box to add this pull request to the merge queue (same as
|
arntanguy
left a comment
There was a problem hiding this comment.
Just minor comments, on principle I am fine with it, thanks !
| * \f[ \xi = -\frac{d_i - d_s}{d - d_s}\alpha + \xi_{\text{off}} \f] | ||
| */ | ||
| class TASKS_DLLAPI CollisionConstr : public ConstraintFunction<Inequality> | ||
| class TASKS_DLLAPI DistanceConstr : public ConstraintFunction<Inequality> |
There was a problem hiding this comment.
You can add
using CollisionConstr [[deprecated("Use DistanceConstr instead.")]] = DistanceConstr;after the class to keep the old name around for backwards compatibility.
Note: with this, this PR can be merged independently of mc_rtc
| } | ||
|
|
||
| if(d.distance < d.di) | ||
| if((d.distance < d.di && d.di > d.ds) || (d.distance > d.di && d.di < d.ds)) |
There was a problem hiding this comment.
Could you document this behavior?
If I understand correctly:
- if di > ds this is a collision avoidance constraint
- di < ds this is a max distance constraint that gets activated when we are di distance away from the surface and we cannot go more than ds distance away from it
This is correct here, but if di == ds the constraint makes no sense and we risk dividing by 0.
double dampers = d.damping * ((d.distance - d.ds) / (d.di - d.ds));
I haven't checked if we have unit tests for that, if we don't it'd be a good idea to add one.
| // sign will be -1 | ||
| sign = -1.; | ||
| // sign will be -sign | ||
| sign = -sign; |
There was a problem hiding this comment.
So it's a loop on d.bodies.size() which is always 2 I guess? Confusing, but if it ain't broke...
| const CollData & cd, | ||
| const Eigen::Vector3d & normVecDist, | ||
| double dist) const | ||
| double DistanceConstr::computeDamping(const std::vector<rbd::MultiBody> & mbs, |
There was a problem hiding this comment.
We should maybe ensure that the damping heuristics here behave well for unusual cases, e.g large distances. This has AFAIK only been used in contexts where we wish to avoid collisions on rather small distances, with an interaction distance rather close to the safety distance.
Changing
CollisionConstrtoDistanceConstr.