Understanding difference between qfrc_applied and xfrc_applied #2350
-
IntroHi! I am a master student at UNED, I use MuJoCo for my research on generative human motion. My setupMujoco python My questionI'm very noob in the robotic and simulator field. I am not able to understand the difference between qfrc_applied and xfrc_applied. Reading in other places and watching some videos I understand that qfrc_applied injects torques/forces directly into the joint space, while xfrc_applied applies forces and torques in the 3D (Cartesian) space of each body. If you have a free joint both are not basically the same? and if you have a hinge join and you want to aplly torque with an actuator, I've seen that you should use qfrc_applied but don't you can get the same result with xfrc_applied? Thanks in advanced Minimal model and/or code that explain my questionNo response Confirmations
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
EDIT: Thanks for @preist-nvidia for pointing out a mistake in this answer, I edited to remove the error. You are correct as far as a freejoint goes, the first three components However, for all other degrees of freedom, E.g. if you have a motorbike model where the wheel axes initially are parallel to the global x axis, applying torque via the corresponding element in the An example case where 'xfrc_applied' ends up being transformed to mujoco/src/engine/engine_core_smooth.c Line 2032 in d4ca66a Depending on what you are trying to achieve, either |
Beta Was this translation helpful? Give feedback.
EDIT: Thanks for @preist-nvidia for pointing out a mistake in this answer, I edited to remove the error.
You are correct as far as a freejoint goes, the first three components
qfrcends up being applied as forces in the global space. The remaining three components for freejoints is interpreted in the body frame (i.e. a qfrc that makes a robot frontflip will usually still do that if the robot faces a different global direction.)However, for all other degrees of freedom,
qfrcwill be applied along the current direction of the joint axes, whereasxfrc_appliedwill always stay in the global frame.E.g. if you have a motorbike model where the wheel axes initially are parallel to the global x …