Skip to content
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

Merged
merged 2 commits into from
Jan 24, 2024

Conversation

arntanguy
Copy link
Collaborator

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's TransformTask::refVelB and TransformTask::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 since ImpedanceTask::targetSurface is not hidden it is possible to directly modify the target of the underlying TransformTask without modifying the impedance target.

To fix this I propose:

  • To make TransformTask::target virtual, which allows ImpedanceTask to override it to keep track of the desired target pose
  • To add a virtual TransformTask::targetVel function that allows setting the velocity in world frame. This is both for convenience and to mimic the existing ImpedanceTask::targetVel
  • For convenience I also added TransformTask::targetFrame and TransformTask::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 in ImpedanceTask.

@gergondet gergondet merged commit ffacf2f into jrl-umi3218:master Jan 24, 2024
20 checks passed
void target(const sva::PTransformd & pos) override { targetPose(pos); }

/* \brief Same as targetPose() */
sva::PTransformd target() const override { return targetPose(); }
Copy link
Member

@mmurooka mmurooka Jan 24, 2024

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?

Copy link
Member

@mmurooka mmurooka Jan 24, 2024

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.

Copy link
Collaborator Author

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.

@mmurooka
Copy link
Member

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_LOG_HELPER(name_ + "_targetPose", targetPoseW_);

logger.addLogEntry(name_ + "_target_pose", this, [this]() { return target(); });

mmurooka added a commit that referenced this pull request Apr 22, 2024
mmurooka added a commit to mmurooka/mc_rtc that referenced this pull request Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants