Having trouble with mjd_transitionFD and contacts #3113
Unanswered
andyabateagility
asked this question in
Asking for Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Intro
Hi, I am trying to make a simple optimal controller using mjd_transitionFD to find a control vector to best minimize IK tracking over a single timestep (to start, and working towards a full rollout).
My method is straightforward: get task Jacobians de/dq and multiply by the dq/du gotten from transitionFD, then solve as a least-squares problem (
mju_boxQP(H=J.T@J + damping, g=J.T@e)).This method works great in free space, and is only a couple lines of code (horray!). However, I am finding that the jacobian from transitionFD is a very poor approximation of dynamics when in contact with an object (i.e. in free space,
mj_integratePos(data.qpos, DqDu @ data.ctrl, dt=1)matchesdata.qposresulting from anmj_stepto 1e-15, but in contact that error is on the order of 1e-2). I find that if I set solref and solimp to give linear soft contacts (see minimal model) and update state with the linearization, my method works through contact.My setup
MuJoCo 3.4.0, Python, Ubuntu 24.04.4
My question
So, two questions:
Minimal model and/or code that explain my question
Code (sketch, not runnable):
Confirmations
Beta Was this translation helpful? Give feedback.
All reactions