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

Support missing joint types in MultibodyPlant #12404

Open
4 of 9 tasks
sherm1 opened this issue Nov 25, 2019 · 23 comments
Open
4 of 9 tasks

Support missing joint types in MultibodyPlant #12404

sherm1 opened this issue Nov 25, 2019 · 23 comments

Comments

@sherm1
Copy link
Member

sherm1 commented Nov 25, 2019

Missing joint types:

These should be added as joints and mapped to corresponding mobilizers internally. We should be able to parse them in from sdf input, possibly with a Drake extension or two.

Here is the list of joint types officially supported by .sdf 1.6. Here is the list for URDF.

Sdf also has revolute2 which I think is like a U-joint but with non-perpendicular axes. Not clear if anyone needs that.

@EricCousineau-TRI
Copy link
Contributor

EricCousineau-TRI commented Nov 25, 2019

I've spoken with @scpeters and @azeey about allowing SDFormat to pass through custom joint types. At present, I believe libsdformat will throw an error if we try do something like <joint type="drake:planar"/>. We should ensure custom joint types are supported through the spec for this. (I don't believe URDF will be an issue, but we should probably namespace it with drake: to start.)

@jwnimmer-tri
Copy link
Collaborator

What about <drake:joint type="planar"/>?

@EricCousineau-TRI
Copy link
Contributor

That'd work! (and be simpler for adding the specific attributes)

@scpeters
Copy link
Contributor

I'd like to hear what @azeey thinks as well, but I think <drake:joint /> will just be ignored, so it depends what you want the behavior to be when loaded by an unsupported parser

should we add a fallback_type attribute? this would let you say that a joint should be fixed if drake:planar is not available

I think we're too late into the release process to add this to our initial release of libsdformat9, but we could consider it along with the nesting / composition proposal

@azeey
Copy link
Contributor

azeey commented Nov 25, 2019

I think <drake:joint /> is fine if you are using libsdformat9. Of course, you'd have to access it's contents using the sdf::ElementPtr API instead of any of the DOM objects. In addition, sdf::Model won't contain a pointer to the joint so calls like sdf::Model::JointCount or sdf::Model::JointByIndex won't included that joint.

@sherm1
Copy link
Member Author

sherm1 commented Nov 25, 2019

That seems unfortunate. It would be nice if sdf could understand that this was a joint, but of an unfamiliar type. There are many useful joint types that sdf does not currently support.

@jwnimmer-tri
Copy link
Collaborator

jwnimmer-tri commented Nov 25, 2019

@sherm1 Why do you say it is unfortunate? We don't care if JointCount sugar works. We just want the raw element tree to that we can do useful things with it.

Sure, ideally the sdf xml specification should grow to denote additional joint types in a first-party way, so that ecosystem tools can inter-operate. But for our needs in Drake, we just need the element tree. We don't need anything else.

@sherm1
Copy link
Member Author

sherm1 commented Nov 25, 2019

@jwnimmer-tri Why would it be reasonable for sdf's JointCount not to return the number of joints? I understand that we can hack around it but if there is a more reasonable solution it would be preferable.

@EricCousineau-TRI
Copy link
Contributor

We don't need JointCount anywhere in Drake's libsdformat-using code, and our usage of libsdformat is heavily encapsulated, so I would say @azeey's suggestion is completely reasonable.

It would only really matter if we cared about traversing all defined joints in the order in which they were defined, which hopefully is never the case?
(Links may be another story with the whole canonical_link setup inherited from Gazebo, but I doubt we need a new link type that would affect that logic.)

@jwnimmer-tri
Copy link
Collaborator

... if there is a more reasonable solution it would be preferable.

I don't think it is reasonable to expect libsdformat to do anything special to support sdf dialects other than its own first-party, canonical definition -- other than provide a window into the raw XML, which it already does. If the file uses a first-party element name, the semantics had better be first-party semantics. If we want different semantics, we should use a different tag. Down any other path lies madness.

@sherm1
Copy link
Member Author

sherm1 commented Nov 25, 2019

.sdf is a format for physical description of robots. It understands links and joints. It is not a stretch for it to understand that there are other kinds of joints besides the small set it currently supports. I don't think that would be madness.

@jwnimmer-tri
Copy link
Collaborator

I am all for widening the spec to encompass additional, enumerated joint types. However, I don't want <joint type="dragons_breath"/> to pass libsdformat's validation phase. That is madness.

@sherm1
Copy link
Member Author

sherm1 commented Nov 26, 2019

Agreed. But something like
<joint type="user_defined"> standard joint stuff, drake::tag stuff </joint>
would still allow the sdf parser to understand that there are joints, which links they connect, etc. without having to understand all the details.

@scpeters
Copy link
Contributor

I would support some extensions to how we define joints like user_defined, but we don't have time to include it in the current release. I think we should just be clear when we're discussing how it currently works vs how it could work

@sherm1
Copy link
Member Author

sherm1 commented Nov 26, 2019

@scpeters no worries -- would be nice to consider a more disciplined way to deal with non-sdf-standard joints in a future version. If we have to add more joints in the meanwhile we can get by with a drake::joint tag.

@EricCousineau-TRI
Copy link
Contributor

A minor bit: With the pose frame semantics, we may get some more coupling to things like dragons_breath (e.g. a drake:joint tag may not have frame registered in the libsdformat pose graph). However, we can always address it later as there are multiple solutions (of varying complexity).

@RussTedrake
Copy link
Contributor

Planar was added by #13824 and it's precursors. I've checked that box. Looks like the screw joint should be checked off as well, @sherm1?

@sherm1
Copy link
Member Author

sherm1 commented Jul 23, 2021

Thanks, yes -- done.

@jwnimmer-tri
Copy link
Collaborator

jwnimmer-tri commented Apr 28, 2022

For the record, as of today the parsers don't support screw joint yet (even though MbP does). I added a TODO for that in #17054 on the SDFormat side. For the URDF side, it seems like we'll need to <drake:joint> since "screw" is not a URDF-standard joint type.

@RussTedrake
Copy link
Contributor

FYI -- I found my first application need for the ball joint using quaternions instead of RPY. My rubik's cube example can sometimes run into singularities. For example, if you rotate the 2x2 cube about 'y', you'll hit it:
Rubik’s cube notebook

@RussTedrake
Copy link
Contributor

We currently don't have parsing support for all of the joint types. In addition to the screw joint mentioned above, the sdf ball joint could be parsed into BallRpyJoint today, even if we want the quaternion version in the future? This came up in answering a stackoverflow question

@sherm1_ -- it seems reasonable to have that list coincide with this issue, and say that a joint isn't really supported if sdf defines it but our parsers don't support it. Or do you want a separate issue to track the parsing?

@sherm1
Copy link
Member Author

sherm1 commented Mar 26, 2023

I think it's sufficient to include parsing needs under "support missing joint types" as covered by this issue.

@jwnimmer-tri
Copy link
Collaborator

FYI I just updated the checkboxes at the top to add floating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants