-
Notifications
You must be signed in to change notification settings - Fork 1.3k
MapQDDotToAcceleration() and MapAccelerationToQDDot() for simple mobilizers #22698
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
MapQDDotToAcceleration() and MapAccelerationToQDDot() for simple mobilizers #22698
Conversation
eec887b
to
f300ad0
Compare
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.
Reviewable status: 2 unresolved discussions, LGTM missing from assignee sherm1(platform), needs at least two assigned reviewers, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @mitiguy)
a discussion (no related file):
Feature review +@sherm1
multibody/tree/mobilizer.h
line 618 at r1 (raw file):
EigenPtr<VectorX<T>> v) const = 0; // Uses the kinematic mapping `q̈ = N(q)⋅v̇` to calculate q̈ from v̇.
Self-blocking. Remove tic-marks around q̈ = N(q)⋅v̇
here and below.
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.
PR description should explain what's here and what's not (with what's planned to follow) and give some rationale.
Feature pending some comment cleanups
Reviewed 16 of 16 files at r1, all commit messages.
Reviewable status: 8 unresolved discussions, needs at least two assigned reviewers, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @mitiguy)
multibody/tree/mobilizer.h
line 618 at r1 (raw file):
EigenPtr<VectorX<T>> v) const = 0; // Uses the kinematic mapping `q̈ = N(q)⋅v̇` to calculate q̈ from v̇.
missing term in comment
Suggestion:
q̈=N(q)⋅v̇ + Ṅ(q,v)⋅v to calculate q̈ from v and v̇
multibody/tree/mobilizer.h
line 621 at r1 (raw file):
// @param[in] vdot 1ˢᵗ time derivatives of generalized velocities (v̇). // @param[out] qddot 2ⁿᵈ time derivatives of the generalized positions (q̈). // Note: Generalized positions and velocities are stored in `context`.
BTW consider naming the variables to match the equations
Suggestion:
positions q and velocities v
multibody/tree/mobilizer.h
line 628 at r1 (raw file):
EigenPtr<VectorX<T>> qddot) const; // Uses the kinematic mapping `v̇ = N(q)⋅q̈` to calculate v̇ from q̈.
Missing term and wrong matrix!
Per f2f we should write the equations in terms of what the user is supplying in the arguments to these routines: q,v from the context, qddot or vdot as a separate argument. (They never supply qdot)
Suggestion:
v̇ = N⁺(q)⋅q̈ + Ṅ⁺(q,v)⋅q̇ where q̇ = N(q)v
multibody/tree/mobilizer.h
line 629 at r1 (raw file):
// Uses the kinematic mapping `v̇ = N(q)⋅q̈` to calculate v̇ from q̈. // @param[in] qddot 2ⁿᵈ time derivatives of the generalized positions (q̈).
BTW consider disambiguating (I thought at first the symbol was supposed to be generalized positions since that's what it was next to)
(same elsewhere)
Suggestion:
qddot 2ⁿᵈ time derivatives q̈ of the generalized positions q.
multibody/tree/mobilizer.h
line 636 at r1 (raw file):
virtual void MapQDDotToAcceleration(const systems::Context<T>& context, const Eigen::Ref<const VectorX<T>>& qddot, EigenPtr<VectorX<T>> v) const;
nit: v -> vdot
multibody/tree/prismatic_mobilizer.h
line 184 at r1 (raw file):
// Computes the kinematic mapping from generalized velocities v to time // derivatives of the generalized positions `q̇`. For this mobilizer `q̇ = v`.
BTW you didn't clean up the old comments here to match the new ones as you did for planar & screw
multibody/tree/revolute_mobilizer.h
line 187 at r1 (raw file):
bool is_velocity_equal_to_qdot() const override { return true; } void MapVelocityToQDot(const systems::Context<T>& context,
BTW you didn't add old comments here to match the new ones like in planar & screw
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.
Should be release notes: none since this is all internal. It's not a real feature until users can get to it through the public API (Joint).
Reviewable status: 8 unresolved discussions, needs at least two assigned reviewers, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @mitiguy)
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.
@sherm1 Thanks for the review. PTAL after it (hopefully) passes CI.
Reviewable status: 2 unresolved discussions, needs at least two assigned reviewers, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @mitiguy)
multibody/tree/mobilizer.h
line 618 at r1 (raw file):
Previously, mitiguy (Mitiguy) wrote…
Self-blocking. Remove tic-marks around
q̈ = N(q)⋅v̇
here and below.
Done.
multibody/tree/mobilizer.h
line 618 at r1 (raw file):
Previously, sherm1 (Michael Sherman) wrote…
missing term in comment
Done with slightly different wording.
multibody/tree/mobilizer.h
line 621 at r1 (raw file):
Previously, sherm1 (Michael Sherman) wrote…
BTW consider naming the variables to match the equations
Done with slightly different wording.
multibody/tree/mobilizer.h
line 628 at r1 (raw file):
Previously, sherm1 (Michael Sherman) wrote…
Missing term and wrong matrix!
Per f2f we should write the equations in terms of what the user is supplying in the arguments to these routines: q,v from the context, qddot or vdot as a separate argument. (They never supply qdot)
Done with slightly different wording.
multibody/tree/mobilizer.h
line 629 at r1 (raw file):
Previously, sherm1 (Michael Sherman) wrote…
BTW consider disambiguating (I thought at first the symbol was supposed to be generalized positions since that's what it was next to)
(same elsewhere)
Done with slightly different wording.
multibody/tree/mobilizer.h
line 636 at r1 (raw file):
Previously, sherm1 (Michael Sherman) wrote…
nit: v -> vdot
Done.
multibody/tree/prismatic_mobilizer.h
line 184 at r1 (raw file):
Previously, sherm1 (Michael Sherman) wrote…
BTW you didn't clean up the old comments here to match the new ones as you did for planar & screw
Done.
multibody/tree/revolute_mobilizer.h
line 187 at r1 (raw file):
Previously, sherm1 (Michael Sherman) wrote…
BTW you didn't add old comments here to match the new ones like in planar & screw
Done.
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.
The PR description only talks about mobilizers, which are internal. The original issue #22630 needs a public API in MultibodyPlant. These first PRs are just internal, but there should be some mention of the end game.
+@xuchenhan-tri for platform review per rotation, please
Reviewed 3 of 3 files at r2, all commit messages.
Reviewable status: 4 unresolved discussions, LGTM missing from assignee xuchenhan-tri(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @mitiguy)
multibody/tree/mobilizer.h
line 618 at r2 (raw file):
EigenPtr<VectorX<T>> v) const = 0; // Calculates q̈ from v̇ and v using q̈ = N(q)⋅v̇ + Ṅ(q,v)⋅v.
BTW should list q as well (below also)
Suggestion:
Calculates q̈ from v̇, v, and q
multibody/tree/revolute_mobilizer.h
line 187 at r2 (raw file):
bool is_velocity_equal_to_qdot() const override { return true; } // Maps v to qdot, which for this mobilizer is q̇ = v̇.
minor: should be v rather than vdot
multibody/tree/prismatic_mobilizer.h
line 183 at r2 (raw file):
bool is_velocity_equal_to_qdot() const override { return true; } // Maps v to qdot, which for this mobilizer is q̇ = v̇.
minor: should be v rather than vdot
Suggestion:
q̇ = v
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.
Reviewed 13 of 16 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: 5 unresolved discussions, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @mitiguy)
multibody/tree/planar_mobilizer.cc
line 192 at r2 (raw file):
const systems::Context<T>&, const Eigen::Ref<const VectorX<T>>& vdot, EigenPtr<VectorX<T>> qddot) const { DRAKE_ASSERT(vdot.size() == kNv);
BTW, it looks like these validity checks are spread across all derived classes. Is it possible to do this in MobilizerImpl?
…virtual when all subclasses have implemented the virtual function in mobilizer.h.
50431cd
to
11b4449
Compare
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.
Reviewed 6 of 6 files at r3, all commit messages.
Reviewable status: 1 unresolved discussion, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @mitiguy)
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.
Reviewable status: 1 unresolved discussion, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits)
multibody/tree/mobilizer.h
line 618 at r2 (raw file):
Previously, sherm1 (Michael Sherman) wrote…
BTW should list q as well (below also)
Done.
multibody/tree/planar_mobilizer.cc
line 192 at r2 (raw file):
Previously, xuchenhan-tri wrote…
BTW, it looks like these validity checks are spread across all derived classes. Is it possible to do this in MobilizerImpl?
Sounds reasonable. I'll check with you and Sherm before the next PR. These validity checks will be repeated for the more complicated mobilizers. For this PR, I think it is OK to merge as-is as it mimics the current code for MapVelocityToQDot() and MapQDotToVelocity(). If we make the change, I want to change all 4 functions simultaneously in a super-simple PR.
multibody/tree/prismatic_mobilizer.h
line 183 at r2 (raw file):
Previously, sherm1 (Michael Sherman) wrote…
minor: should be v rather than vdot
Done here and three other places.
multibody/tree/revolute_mobilizer.h
line 187 at r2 (raw file):
Previously, sherm1 (Michael Sherman) wrote…
minor: should be v rather than vdot
Done here and 3 other places.
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.
Reviewed 6 of 6 files at r3, all commit messages.
Reviewable status: commits need curation (https://drake.mit.edu/reviewable.html#curated-commits)
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.
Reviewable status: commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @mitiguy)
multibody/tree/prismatic_mobilizer.h
line 183 at r2 (raw file):
Previously, mitiguy (Mitiguy) wrote…
Done here and three other places.
The reviewable coloring is failing so miserably here :(
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.
+label squashing now
Reviewable status: commits need curation (https://drake.mit.edu/reviewable.html#curated-commits)
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.
+label status: squashing now
Reviewable status: commits need curation (https://drake.mit.edu/reviewable.html#curated-commits)
This is the first PR of several to help address issue #22630. It creates MapQDDotToAcceleration() and MapAccelerationToQDDot() for simple mobilizers.
Subsequent PRs will create helper methods for more complex mobilizers (e.g., rpy_ball_mobilizer, curvilinear_mobilizer, quaternion_floating_mobilizer, etc.) to consolidate creation of the N(q) and N⁺(q) matrices that is shared between MapQDotToVelocity() and MapQDDotToAcceleration() as well as MapVelocityToQDDot() and MapAccelerationToQDDot().
In conjunction with each of the subsequent PRs, each more complex mobilizer will implement its functions MapQDDotToAcceleration() and MapAccelerationToQDDot().
FYI: Since mobilizers are Drake internal classes, after the internal mobilizer work is complete, there will be PRs (code and testing) for the public API in MultibodyPlant to address issue #22630.
This change is