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

pydrake multibody: Add bindings for PlanarJoint #13813

Merged

Conversation

mpetersen94
Copy link
Contributor

@mpetersen94 mpetersen94 commented Aug 4, 2020

Follow up to #13747. Adds the bindings for Planar Joint.

Relates #12404


This change is Reviewable

@EricCousineau-TRI EricCousineau-TRI added the status: single reviewer ok https://drake.mit.edu/reviewable.html label Aug 4, 2020
@EricCousineau-TRI EricCousineau-TRI self-assigned this Aug 4, 2020
Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+@EricCousineau-TRI for review
+(status: single reviewer ok)

Reviewable status: LGTM missing from assignee EricCousineau-TRI(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @EricCousineau-TRI)

Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: LGTM missing from assignee EricCousineau-TRI(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @EricCousineau-TRI)


bindings/pydrake/multibody/test/plant_test.py, line 1319 at r1 (raw file):

                set_angle = 3.
                joint.set_translation(context=context,
                                      p_FoMo_F=set_translation)

BTW I love reading this as FOMO :P

Copy link
Contributor Author

@mpetersen94 mpetersen94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Eric! Don't merge before #13747 does.

Reviewable status: LGTM missing from assignee EricCousineau-TRI(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @EricCousineau-TRI)


bindings/pydrake/multibody/test/plant_test.py, line 1319 at r1 (raw file):

Previously, EricCousineau-TRI (Eric Cousineau) wrote…

BTW I love reading this as FOMO :P

🤣

Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 6 files at r1.
Reviewable status: 2 unresolved discussions, LGTM missing from assignee EricCousineau-TRI(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @EricCousineau-TRI and @mpetersen94)


bindings/pydrake/multibody/tree_py.cc, line 343 at r1 (raw file):

            py::arg("context"), py::arg("theta_dot"),
            cls_doc.set_angular_velocity.doc)
        .def("set_random_pose_distribution",

I believe this is not tested.

Would it be possible to add a brief test?

FWIW It looks like none of the set_random* methods are tested :(
I won't ask ya to do those here, but could you do this one?


multibody/tree/planar_joint.h, line 2 at r1 (raw file):

#pragma once

Hm... This looks like it needs a rebase?

Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, soz, I thought it had already merged. Will add a blocking comment to that effect.

Reviewed 1 of 6 files at r1.
Reviewable status: 4 unresolved discussions, LGTM missing from assignee EricCousineau-TRI(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @EricCousineau-TRI and @mpetersen94)

a discussion (no related file):
Requires merge of #13747.



bindings/pydrake/multibody/test/plant_test.py, line 1321 at r1 (raw file):

                                      p_FoMo_F=set_translation)
                self.assertEqual(
                    len(joint.get_translation(context=context)), 2)

This comparison seems like "asymmetric information loss" given that you set it above.

Can you use numpy_compare.assert_float_equal for testing all accessors / mutators?

Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 3 unresolved discussions, LGTM missing from assignee EricCousineau-TRI(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @EricCousineau-TRI and @mpetersen94)


multibody/tree/planar_joint.h, line 2 at r1 (raw file):

Previously, EricCousineau-TRI (Eric Cousineau) wrote…

Hm... This looks like it needs a rebase?

OK Resolve this since the "Requires merge" discussion is above.

Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a 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 EricCousineau-TRI(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @EricCousineau-TRI and @mpetersen94)


bindings/pydrake/multibody/test/plant_test.py, line 1321 at r1 (raw file):

Previously, EricCousineau-TRI (Eric Cousineau) wrote…

This comparison seems like "asymmetric information loss" given that you set it above.

Can you use numpy_compare.assert_float_equal for testing all accessors / mutators?

OK Er, just realized that the other surrounding tests don't do that either... NVM! Feel free to do it if you feel so inclined, but I'm dismissing this comment.

Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a 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 EricCousineau-TRI(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @EricCousineau-TRI and @mpetersen94)


bindings/pydrake/multibody/test/plant_test.py, line 1321 at r1 (raw file):

Previously, EricCousineau-TRI (Eric Cousineau) wrote…

OK Er, just realized that the other surrounding tests don't do that either... NVM! Feel free to do it if you feel so inclined, but I'm dismissing this comment.

FWIW I think it should also be assert_equal(...), where the type compared is converted to T.

@EricCousineau-TRI
Copy link
Contributor

I've filed #13817 as an example for both the numpy_compare stuff and acceptance-testing set_random*.

Would you be able to review that, then once it merges, you rebase on top of that?

Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a 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, LGTM missing from assignee EricCousineau-TRI(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @EricCousineau-TRI and @mpetersen94)

a discussion (no related file):

Previously, EricCousineau-TRI (Eric Cousineau) wrote…

Requires merge of #13747.

Done.


Copy link
Member

@sherm1 sherm1 left a 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, LGTM missing from assignee EricCousineau-TRI(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @EricCousineau-TRI and @mpetersen94)


bindings/pydrake/multibody/test/plant_test.py, line 1319 at r1 (raw file):

Previously, mpetersen94 (Mark Petersen) wrote…

🤣

BTW I'd be afraid to take the default!

@mpetersen94
Copy link
Contributor Author

Can do!

Copy link
Contributor Author

@mpetersen94 mpetersen94 left a 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 EricCousineau-TRI(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @EricCousineau-TRI)

a discussion (no related file):
Requires #13817 to merge first.



bindings/pydrake/multibody/tree_py.cc, line 343 at r1 (raw file):

Previously, EricCousineau-TRI (Eric Cousineau) wrote…

I believe this is not tested.

Would it be possible to add a brief test?

FWIW It looks like none of the set_random* methods are tested :(
I won't ask ya to do those here, but could you do this one?

Done.


bindings/pydrake/multibody/test/plant_test.py, line 1321 at r1 (raw file):

Previously, EricCousineau-TRI (Eric Cousineau) wrote…

FWIW I think it should also be assert_equal(...), where the type compared is converted to T.

Done.

Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: pending merge

Reviewed 2 of 2 files at r3.
Reviewable status: 1 unresolved discussion, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits)

Copy link
Contributor

@avalenzu avalenzu left a 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)


bindings/pydrake/multibody/tree_py.cc, line 321 at r3 (raw file):

                 Vector3<double>>(),
            py::arg("name"), py::arg("frame_on_parent"),
            py::arg("frame_on_child"), py::arg("damping"), cls_doc.ctor.doc)

BTW, most (all?) of the other joints have a default value of 0 for damping. Would probably be good to include that here too.

Copy link
Contributor Author

@mpetersen94 mpetersen94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignee EricCousineau-TRI(platform) (waiting on @EricCousineau-TRI)

a discussion (no related file):

Previously, mpetersen94 (Mark Petersen) wrote…

Requires #13817 to merge first.

Done.



bindings/pydrake/multibody/tree_py.cc, line 321 at r3 (raw file):

Previously, avalenzu (Andres Valenzuela) wrote…

BTW, most (all?) of the other joints have a default value of 0 for damping. Would probably be good to include that here too.

Done.

Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r4.
Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignee EricCousineau-TRI(platform)


bindings/pydrake/multibody/test/plant_test.py, line 1327 at r4 (raw file):

                self.assertEqual(len(joint.damping()), 3)
                set_translation = array_T([1., 2.])
                set_angle = T(3.)

BTW This variable may be better defined as "set_point" given that's what the others are.

Copy link
Contributor Author

@mpetersen94 mpetersen94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignee EricCousineau-TRI(platform)


bindings/pydrake/multibody/test/plant_test.py, line 1327 at r4 (raw file):

Previously, EricCousineau-TRI (Eric Cousineau) wrote…

BTW This variable may be better defined as "set_point" given that's what the others are.

All the other joints have only one "set_point" value but since this one requires two, I decided to be clearer on what each one was for.

Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignee EricCousineau-TRI(platform)


bindings/pydrake/multibody/test/plant_test.py, line 1327 at r4 (raw file):

Previously, mpetersen94 (Mark Petersen) wrote…

All the other joints have only one "set_point" value but since this one requires two, I decided to be clearer on what each one was for.

OK Ah, gotcha. It's just that set_angle sounds like an action, whereas set_point sounds like a noun. I think set_point_{rotation,translation} would've been a bit better (or even just setpoint).

But yeah, this works!

@EricCousineau-TRI
Copy link
Contributor

Skipping slow builds

@EricCousineau-TRI EricCousineau-TRI merged commit ade13ca into RobotLocomotion:master Aug 4, 2020
@mpetersen94 mpetersen94 deleted the bind/planar_joint branch August 4, 2020 21:42
thduynguyen pushed a commit to thduynguyen/drake that referenced this pull request Aug 7, 2020
thduynguyen pushed a commit to thduynguyen/drake that referenced this pull request Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: single reviewer ok https://drake.mit.edu/reviewable.html
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants