RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.35k stars 1.27k forks source link

parsing, urdf: `//joint[@type="floating"]` - confusing? #13691

Open EricCousineau-TRI opened 4 years ago

EricCousineau-TRI commented 4 years ago

Triggered by discussion here: https://github.com/RobotLocomotion/drake/pull/13128#pullrequestreview-438592326

For spec: http://wiki.ros.org/urdf/XML/joint#Attributes

Currently, this is our code for handling //joint[@type="floating"]: https://github.com/RobotLocomotion/drake/blob/86c27959bd75b1f29d98b09dc96ed2d3fde10997/multibody/parsing/detail_urdf_parser.cc#L439-L444

It says it's not supported, but then, it uh, does almost the right thing?

My suggestions:

@sammy-tri Thoughts?

sammy-tri commented 4 years ago

I think we should just go ahead and support "floating" as a joint type. I've thought of the following cases, in increasing order of difficulty to support:

sherm1 commented 4 years ago

FYI other internal-coordinate multibody codes do support a 6dof floating joint type. They are useful for establishing a convenient coordinate frame between two bodies (that is, they define the meaning of the corresponding generalized coordinates q and v). Simbody has actually has two flavors -- a "Free" joint that uses quaternions for the rotational dofs and a "Bushing" joint that uses gimbal angles (more convenient for applying forces but singular at odd configurations). Both have been useful.

EricCousineau-TRI commented 4 years ago

@sherm1 Just curious - do those usages permit changing the frame of for the floating joint DoFs? e.g. the pose of the free body w.r.t. the inertial frame vs. some other (possibly non-inertial) frame?

For the case of URDF, my assumption is the floating joint DoFs will represent the pose of the free body relative to the world frame. However, I may need to see if it's possibly to confirm :P

sherm1 commented 4 years ago

I believe your hands may be tied for urdf due to lack of any way to properly model a joint as a relationship between two frames. Should be better in sdf. The general model of a joint should relate a frame F fixed on the parent to a frame M fixed on the child, like in the Simbody picture here. That formulation includes all possible joints, including floating joints. image

EricCousineau-TRI commented 4 years ago

@sammy-tri W.r.t. your points, I think it'd be easy enough to do some bookkeeping to record X_PJ and X_PL? (ignore joint mobilization, and only consider X_FM = eye(4)?)

EricCousineau-TRI commented 4 years ago

@sherm1 Gotcha. And sorry, I don't think our hands are necessarily tied - my goal is to simply interpret the URDF as other tools do for minimal coordinates (since URDFs are simple).

If the other tools interpret it as inboard=world, outboard=child, then great! Drake's public API supports that! And if it's actually inboard=parent, outboard=child, then oops! I don't think Drake's public API supports that yet (e.g. I don't think we can tune the inboard/outboard bodies for QuaternionFloatingMobilizer), and I'd rather fail fast or perhaps make a more explicit warning - before trying to figure out how to delineate between "free bodies" and "bodies with a floating joint".

sammy-tri commented 4 years ago

@sammy-tri W.r.t. your points, I think it'd be easy enough to do some bookkeeping to record X_PJ and X_PL? (ignore joint mobilization, and only consider X_FM = eye(4)?)

Sorry, I'm struggling today... Which transforms are X_PL and X_FM?

EricCousineau-TRI commented 4 years ago

Ah, sorry - P is a link's parent (identified through joints), J is the joint, L is the link (or child, rather). X_FM is really the inboard/outboard transform (F - inboard frame, M - outboard / "mobilized" frame), it should've beenX_PL - my bad!

sammy-tri commented 4 years ago

after reading the other comments again, my original concerns only involved calculating where the initial world pose of the floating body would be, and I ignored the question of the generalized coordinates used to represent the position of that body in the state vector. I think the only case we could suppose easily right now is parent==world and X_PJ==X_PL so that we could set the free body pose to the origin specified in the URDF (and the generalized coordinates are world relative, like drake uses for free bodies already).

RussTedrake commented 1 year ago

I just stumbled on this myself. It seems worth fixing (and might be even easier now that @joemasterjohn added QuaternionFloatingJoint. @rpoyner-tri -- perhaps we should move this to your queue, as owner of the parsing component, since I don't think @EricCousineau-TRI is likely to move on it?

rpoyner-tri commented 1 year ago

I've added myself.

RussTedrake commented 11 months ago

I just ran into this again. I made a simple example of using joint locking/unlocking to simulate suction here. But to do that I (unfortunately) need to make a free joint between the suction tip and the objects it could suck. I can't do that through the parser yet, until we implement the free joint with a QuaternionFloatingJoint.

(ftr -- i had hoped to use constraints, but the constraint API wouldn't allow me to change the kinematics of the constraint after construction; so I would probably need a relative spatial velocity constraint to do it).

nepfaff commented 1 week ago

I'm also interested in the implementation a URDF floating joint as a QuaternionFloatingJoint for the joint locking/ unlocking for suction simulation.