Genesis icon indicating copy to clipboard operation
Genesis copied to clipboard

Setting base velocity

Open dmarew opened this issue 11 months ago • 1 comments

Is there a way to set the base link linear and angular velocities in the same way we can set position and orientation?

dmarew avatar Dec 19 '24 19:12 dmarew

The linear and angular velocities of the base link can be assigned using set_dofs_velocity() with dofs_idx_local set to [0, 1, 2, 3, 4, 5].

ziyanx02 avatar Dec 20 '24 03:12 ziyanx02

Quick follow up on @ziyanx02 answer (also, remember to set fixed=False when instantiating the robot).

If you are looking for something like rigid_entity.set_pos, which works for both fixed- or floating-based body, it can be somewhat tricky to do for set_vel. If fixed=True, attributes related to dynamics (e.g., velocity, acceleration, etc) of the base link are not included in the coordinates qpos or dofs dofs_state inside the solver. Thus, the velocity of the base link won't take effect on the position, as in rigid_solver._func_integrate where nothing done in the integration can affect the later on kinematics (links_state.vel basically cannot affect links_state.pos).

For sure we can hack this but this may make the code super ugly (at least so far I didn't think of a good way). One workaround is to do the integration outside and use set_pos if you really want to set velocity on a fixed-based robot. But again this won't properly handle the dynamics -- you should set fixed=False to incorporate dynamics in the base link and do set_dofs_velocity.

zswang666 avatar Dec 21 '24 14:12 zswang666

suggesting add method "set_vel" and "set_ang",just like "set_pos", this should not be hard and it's easier to use. I've been looking for the answer on the document so long until I see this issue.

shenyxcode avatar Sep 19 '25 07:09 shenyxcode