I'd like to define a reference frame that isn't necessarily attached to a body in Drake but can still be updated during simulation with a LeafSystem. I tried using the AddFrame method described here (https://drake.mit.edu/pydrake/pydrake.multibody.parsing.html), but this returned an AddFrame(): incompatible function arguments
error. I could get this error to go away by instantiating a FixedOffsetFrame
first, but don't know if/how to update the frame's pose once it's been created. How can I create a reference frame that can be updated during simulation?
Also as a side note: I think it needs to be a frame and not just a RigidTransform since I'd like to use it with the CalcJacobianSpatialVelocity function
A frame in the MultibodyPlant
should be attached (rigidly) to some body frame. You can specify e.g. the frame of the hand relative to the wrist. As the joint angles change, then the location of your frame will change (during simulation). This would be accomplished, as you say, with a FixedOffsetFrame
.
It sounds like you want a frame that can move independently from any body/link during simulation? Then how will you specify its pose? If you want the MultibodyPlant
kinematics engine to do it for you, then you would accomplish that by adding a body, with joints or a floating base (which the kinematics/dynamics engine uses) and using that as your frame. Or you can simply keep track of a frame yourself by having a pose (relative to a body or world) in your controller/perception system/etc.