Control Inputs Not Affecting Robot Movement in MuJoCo MJX Simulation #2244
Replies: 1 comment
-
I just realized that the code is actually functioning correctly by extending the iterations, so I closed this discussion. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Intro
Hi!
I am a researcher using MuJoCo for my research on robotics.
My setup
MuJoCo: 3.2.5
Python: 3.10
OS and arch: Apple M3 & Ubuntu 20.04 (x86 + Nvidia GPU)
Jax: 0.4.35
My question
I am currently using MJX for simulating a mobile differential drive robot. However, I have encountered an issue where setting control inputs via
mjx_d.ctrl
(specifically the wheel rotation) does not appear to propagate to the robot’s state, particularly its position (mjx_d.qpos[:3]
).I attempted to assign control inputs in two different ways, as shown in the attached code snippet. In both cases, I assigned a scalar control input of 1 (with control limits set to ±10). The results from the first attempt are shown below:
[0. 0. 0.1 1. 0. 0. 0. 0. 0. 0. 0. ] <class 'numpy.ndarray'> [0. 0. 0.1 1. 0. 0. 0. 0. 0. 0. 0. ] <class 'jaxlib.xla_extension.ArrayImpl'> {CpuDevice(id=0)} mjx_d.qpos: [-5.6603234e-08 8.0123148e-13 9.9960759e-02] mjx_d.ctrl: [0. 0. 1. 0.] mjx_d.qpos: [-1.6980951e-07 1.6024636e-12 9.9882282e-02] mjx_d.ctrl: [0. 0. 1. 0.] mjx_d.qpos: [-3.3961811e-07 3.1448915e-12 9.9764563e-02] mjx_d.ctrl: [0. 0. 1. 0.] mjx_d.qpos: [-5.6603244e-07 4.8413469e-12 9.9607602e-02] mjx_d.ctrl: [0. 0. 1. 0.] mjx_d.qpos: [-8.4904326e-07 6.4331097e-12 9.9411398e-02] mjx_d.ctrl: [0. 0. 1. 0.] mjx_d.qpos: [-1.1886342e-06 7.8106089e-12 9.9175960e-02] mjx_d.ctrl: [0. 0. 1. 0.] mjx_d.qpos: [-1.5848274e-06 1.0071862e-11 9.8901279e-02] mjx_d.ctrl: [0. 0. 1. 0.] mjx_d.qpos: [-2.0376197e-06 1.3492342e-11 9.8587357e-02] mjx_d.ctrl: [0. 0. 1. 0.] mjx_d.qpos: [-2.5470022e-06 1.6222758e-11 9.8234199e-02] mjx_d.ctrl: [0. 0. 1. 0.] mjx_d.qpos: [-3.1130867e-06 1.8820948e-11 9.7841799e-02] mjx_d.ctrl: [0. 0. 1. 0.]
As shown above, the control input is successfully assigned to
mjx_d.ctrl
. However, the robot’s position remains nearly constant, with only minimal movements near the origin observed. I repeated the process using the second method of assigning control inputs and observed similar behavior.Additionally, I increased the control input from 1 to higher values (e.g., 10) and from below, it can be seen that the robot's position (mjx_d.qpos[:3]) changed very slightly, which suggests that the system is still not acting as expected. Moreover, further increasing the control input would lead to NaN values in the simulation.
[0. 0. 0.1 1. 0. 0. 0. 0. 0. 0. 0. ] <class 'numpy.ndarray'> [0. 0. 0.1 1. 0. 0. 0. 0. 0. 0. 0. ] <class 'jaxlib.xla_extension.ArrayImpl'> {CpuDevice(id=0)} mjx_d.qpos: [-5.660324e-07 8.012315e-12 9.996076e-02] mjx_d.ctrl: [ 0. 0. 10. 0.] mjx_d.qpos: [-1.6979701e-06 1.6958584e-11 9.9882282e-02] mjx_d.ctrl: [ 0. 0. 10. 0.] mjx_d.qpos: [-3.3957811e-06 2.6614141e-11 9.9764563e-02] mjx_d.ctrl: [ 0. 0. 10. 0.] mjx_d.qpos: [-5.6602307e-06 4.2671311e-11 9.9607602e-02] mjx_d.ctrl: [ 0. 0. 10. 0.] mjx_d.qpos: [-8.490393e-06 4.315451e-11 9.941140e-02] mjx_d.ctrl: [ 0. 0. 10. 0.] mjx_d.qpos: [-1.1885814e-05 1.1306803e-10 9.9175945e-02] mjx_d.ctrl: [ 0. 0. 10. 0.] mjx_d.qpos: [-1.5844797e-05 1.6720930e-10 9.8901242e-02] mjx_d.ctrl: [ 0. 0. 10. 0.] mjx_d.qpos: [-2.0369707e-05 1.6501520e-10 9.8587289e-02] mjx_d.ctrl: [ 0. 0. 10. 0.] mjx_d.qpos: [-2.5454458e-05 2.4332972e-10 9.8234080e-02] mjx_d.ctrl: [ 0. 0. 10. 0.] mjx_d.qpos: [-3.1100888e-05 3.5169670e-10 9.7841613e-02] mjx_d.ctrl: [ 0. 0. 10. 0.]
Could anyone please kindly provide insight into why the control inputs are not resulting in state propagation for the robot? Are there any settings, configurations, or additional parameters that I may have overlooked in the simulation code? I would greatly appreciate your comments on this issue. Thank you for your time and assistance!
Minimal model and/or code that explain my question
The MuJoCo model of a differential drive wheeled robot:
The Python code that reproduces the results in the description (please save the above xml file and replace the placeholder
xml_path
with the actual directory containing the model below):Confirmations
Beta Was this translation helpful? Give feedback.
All reactions