Accuracy vs. Precision

Please don't post Bullet support questions here, use the above forums instead.
etom
Posts: 3
Joined: Sun Oct 07, 2007 3:11 am

Accuracy vs. Precision

Post by etom »

Hello,
My name is Tom, and I'm new here. My research is on motor control via Reinforcement learning, and so far I've been building my own toy physics domains for my 2D robots to learn in.

Now I want to test the scalability of my algorithm, and run it on a bigger model (with 20-50 DOFs). I started working in ODE, and even built a port between ODE and MATLAB, but then I came across the following problem: I have been using finite-differencing to estimate gradients of the dynamical function, but ODE is not precise enough at the level of tiny changes in the state.

I guess there is a trade-off between accuracy and precision: if you want to approximate the real-world physics as accurately as possible, you have to tolerate some imprecision, as the effect of tiny changes to the state might not be consistent (the tiny change might be approximated away, or pitch the approximation way off, and so forth). I am guessing it is an artifact of iterative solvers (?).

My questions to this forum are:
1) If precision (the ability to approximate gradients) is more important for me than accuracy (being authentic to real-world physics), what physics engine should I use? Which algorithms should I look for?
2) Could you point me to standard 3D humanoid simulations? I don't care for meshes or textures, I just need a skeleton, gravity and ground collision.
3) Is there anyone else out there who's using these physics simulations in conjunction with MATLAB? I want to specify the state (positions, angles, velocities) and action (torques) and get the accelerations. I can create MEX wrappers (the interface between MATLAB and C/C++), but some simulations rely on temporal continuity, and hide some important state variables, while I want the dynamics to be a proper function.

Thank you for your time and Attention,
Tom
http://www.cse.wustl.edu/~etom/
Erin Catto
Posts: 316
Joined: Fri Jul 01, 2005 5:29 am
Location: Irvine

Re: Accuracy vs. Precision

Post by Erin Catto »

Doesn't Matlab have a toolbox for robotics simulation?
etom
Posts: 3
Joined: Sun Oct 07, 2007 3:11 am

Re: Accuracy vs. Precision

Post by etom »

Erin Catto wrote:Doesn't Matlab have a toolbox for robotics simulation?
To the best of my (limited) understanding, such toolboxes deal with stationary robotic arms, and not with autonomous legged robots. (In general, when people talk about "robots", they often mean either wheeled robots, or stationary robotic arms; I am not concerned with ever building these humanoids, so my concerns are somewhat different).

Mathworks also has a product called SimMechanics, but I've never worked with it (it's quite expensive). Would you recommend it?
Erin Catto
Posts: 316
Joined: Fri Jul 01, 2005 5:29 am
Location: Irvine

Re: Accuracy vs. Precision

Post by Erin Catto »

Yeah, I was thinking of SimMechanics. I think that is mainly for robot arms and things that don't need contact and friction.

I think with most game physics engines you can compute reasonable gradients as long as there is no randomization. You also need to be careful if you are trying to move time around, because most physics engines have a lot of internal state that you cannot manipulate directly. So you should only move time forwards. For example, start a t=0 and run to t=t1 and record y(t1), then run to t=t2 and record y(t2). Now you can compute: y' = (y(t2) - y(t1))/(t2 - t1).
etom
Posts: 3
Joined: Sun Oct 07, 2007 3:11 am

Re: Accuracy vs. Precision

Post by etom »

Erin Catto wrote:most physics engines have a lot of internal state that you cannot manipulate directly.
That is exactly what I need to overcome. Suppose we write y'=f(y,u) (where y is the humanoid's state and u are the torques applied); I want to calculate the partial derivatives of f with respect to y and u. If f is a proper function, and there are no hidden states, then I could evaluate f for different values of y, and use finite-differencing like you suggested.

Do you know of a physics engine that would let me do that?