How to get velocity of a skeleton and add force at certain position to it?

How to get velocity of a skeleton and add force at certain position to it?

I mean is there any function support to do things like following?:smiley:

Vector3d Skeleton::getVelocityAtWorldPosition( Vector3d pos)
Vector3d Skeleton::applyForceAtWorldPosition(Vector3d pos,Vector3d force)

The docs contains a lot stuff, i am not sure which functions could give functionality as this.

There are some unclear info about functions parameters,so i stucked on how to test them.
For example,what does the indices point to ???
Eigen::VectorXd dart::dynamics::MetaSkeleton::getVelocities ( const std::vector< std::size_t > & *_indices* ) const/// Get the velocities for a subset of the generalized coordinates.

I wonder whether there’s such functions directly for skeletons or do something from joints/bodynode
I also noticed a function getCOMSpatialVelocity() of BodyNode,However i do not just want the COM Velocity.

Thanks for your reply

Skeleton is a set of BodyNodes and Joints. I guess you want to get/set the velocity/force of a specific BodyNode in a Skeleton. Use BodyNode::get[Linear/Angluar]Velocity to get the velocity, and use `BodyNode::addExt[Force/Torque] to set the wrench.

Related APIs:

Thank you, i got it !

Sorry to brother you ,
i have a new question.

I just wanna to addExternal Force at certain to the whole skeleton,(which treats the whole skeleton as a rigidbody), does dart support any functionality like this?

Or is there any alternative way to get the same effect?

Adding an external force to an entire skeleton is ill-formed. Do you want to apply a force F to each body in the skeleton? Or do you want the net force across the whole skeleton to add up to some force value F? If you want the forces across all the bodies to add up to F then how do you want to distribute those forces between the bodies? Should the same force be applied to each body, or should the forces be distributed proportional to the mass of each body (this would create an effect that’s similar to gravity)?

The DART API will happily let you apply whatever forces to whatever bodies with whatever distribution you want, but I think you should try to more clearly define what it is you’re trying to do and why you’re trying to do it.