-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ImpedanceTask] Fix use of targetSurface and implement targetFrame/targetFrameVelocity #428
[ImpedanceTask] Fix use of targetSurface and implement targetFrame/targetFrameVelocity #428
Conversation
void target(const sva::PTransformd & pos) override { targetPose(pos); } | ||
|
||
/* \brief Same as targetPose() */ | ||
sva::PTransformd target() const override { return targetPose(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arntanguy @gergondet
Thanks for the update. Just one comment.
The target method above is private, so it is meaningless if it is not used in this class (and in fact this overridden target method is not used in the class). Isn't the intention to make it a public method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry. I understand that this is virtual, so it has a meaning when called from inside TransformTask. I understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I in fact considered making it public anyways for consistency between TransformTask
and ImpedanceTask
, but since we already had ImpedanceTask::targetPose
being widely used I left it private. Plus having to explicitly use targetPose
highlights that the impedance task target is different from the underlying TransformTask
.
I found one side effect of this PR. Before this PR was merged, the following two log entries represented different poses; the former is the target pose given by the user, the latter is the command pose modified by the impedance control. After this PR, they represent the same pose, i.e., the target pose given by the user, and we no longer see the modified command pose in the log. mc_rtc/src/mc_tasks/ImpedanceTask.cpp Line 211 in afc9934
mc_rtc/src/mc_tasks/TransformTask.cpp Line 200 in afc9934
|
We noticed with @Hugo-L3174 that it is possible to call
ImpedanceTask::targetSurface
but that the implementation is wrong. In the current implementation calling the parent'sTransformTask::refVelB
andTransformTask::target
are explicitly disallowed as the impedance task needs to keep track of the desired target (that is modified through the impedance equation to provide a compliance pose/velocity/acceleration that is then given as the TransformTask's target). However sinceImpedanceTask::targetSurface
is not hidden it is possible to directly modify the target of the underlyingTransformTask
without modifying the impedance target.To fix this I propose:
TransformTask::target
virtual, which allowsImpedanceTask
to override it to keep track of the desired target posevirtual TransformTask::targetVel
function that allows setting the velocity in world frame. This is both for convenience and to mimic the existingImpedanceTask::targetVel
TransformTask::targetFrame
andTransformTask::targetFrameVelocity
functions. They work as expected for the ImpedanceTask as they simply call the newly introduced virtual functions.If we wish to be a bit more comprehensive, we could also do the same for
refVelB
which is currently still hidden inImpedanceTask
.