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
-
You are correct as far as a freejoint goes, 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.
You are correct as far as a freejoint goes,
qfrc
ends up being applied as forces and torques in the global space. However, for all other types of degrees of freedom,qfrc
will be applied along the current direction of the joint axes, whereasxfrc_applied
will 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 axis, applying torque via the corresponding element in the
xfrc
orqfrc
vectors on the wheels will both result in the bike accelerating forward. But after the bike makes a 90 degree turn,qfrc
would still drive it normally towards the bike's new forward direction, whilexfrc
would tip the bike over and tumbl…