Module contents
Lesson 5 of 33Core 115 min

Robot dynamics and control

Derive manipulator dynamics and recursive Newton-Euler inverse dynamics, then study gravity-compensated PD, computed torque, impedance and operational-space control.

After this lesson you can

  • Derive two-link manipulator equations using Euler-Lagrange.
  • Implement recursive Newton-Euler inverse dynamics and mass-matrix forward dynamics.
  • Prove stability of gravity-compensated PD control using a Lyapunov function.
  • Design computed-torque and impedance controllers and compare their contact responses.
  • Explain the low-level controller beneath position, velocity and torque actions predicted by a learned policy.

Before you start

What the arm executes

A policy can output positions, velocities or torques. Each interface delegates a different problem to the lower-level controller: a position requires converting error into an action that moves the arm; a torque requires considering its dynamics directly. Before comparing policies, specify which signal executes and at what frequency.

InteractiveEnergy and integrator choice
  • Arm
  • Kinetic
  • Potential
  • Total
Integrator
Gravity
0.0
3.00
Total energy change0.000
Compare RK4 and explicit Euler with the same step, enable or remove gravity and add friction. The curves come from the lesson's explicit model of two uniform rods.
InteractiveOne trajectory and four controllers
Control
20
1.0
Final tip error (m)0.03
Maximum wall force (N)1.43
Change controller, estimated mass and wall. Errors, torques and forces come from a two-rod simulation, not hardware measurements.
InteractiveA descending function
  • V surface
  • Trajectory
1.0
-3.0
Largest increase in V per step0.0000
The surface shows 0.18 times V to fit in the scene; the curve is a pendulum trajectory using RK4. Try removing gravity compensation.

From energy to torques

The manipulator equations separate inertia, velocity and gravity:

M(q)q¨+C(q,q˙)q˙+g(q)=τ+J⊤Fext.\mat{M}(\vb{q})\ddot{\vb{q}}+\mat{C}(\vb{q},\dot{\vb{q}})\dot{\vb{q}}+\vb{g}(\vb{q})=\boldsymbol{\tau}+\mat{J}\T\vb{F}_{\rm ext}.

M\mat{M} is symmetric positive definite for a nondegenerate physical system; C\mat{C} is not unique, although Cq˙\mat{C}\dot{\vb{q}} is fixed by the chosen dynamics. J⊤Fext\mat{J}\T\vb{F}_{\rm ext} converts force applied to the end effector into joint torque through virtual work. Units matter: revolute joint position in radians, velocity in radians per second and torque in newton metres.

For two uniform rods with masses mim_i, lengths lil_i, centres ci=li/2c_i=l_i/2 and central moments Ii=mili2/12I_i=m_i l_i^2/12, measure q1q_1 from the downward vertical and q2q_2 relative to the first link. Potential energy is U=−g[(m1c1+m2l1)cos⁡q1+m2c2cos⁡(q1+q2)]U=-g[(m_1c_1+m_2l_1)\cos q_1+m_2c_2\cos(q_1+q_2)]. Kinetic energy sums translation of each centre and rotation around it. The Euler-Lagrange equation, d(∂K/∂q˙i)/dt−∂K/∂qi+∂U/∂qi=τid(\partial K/\partial\dot q_i)/dt-\partial K/\partial q_i+\partial U/\partial q_i=\tau_i, gives

M=[I1+I2+m1c12+m2(l12+c22+2l1c2cos⁡q2)I2+m2(c22+l1c2cos⁡q2)I2+m2(c22+l1c2cos⁡q2)I2+m2c22].\mat{M}=\begin{bmatrix} I_1+I_2+m_1c_1^2+m_2(l_1^2+c_2^2+2l_1c_2\cos q_2)&I_2+m_2(c_2^2+l_1c_2\cos q_2)\\ I_2+m_2(c_2^2+l_1c_2\cos q_2)&I_2+m_2c_2^2 \end{bmatrix}.

With h=m2l1c2sin⁡q2h=m_2l_1c_2\sin q_2, one choice of C\mat{C} is [−hq˙2−h(q˙1+q˙2)hq˙10]\begin{bmatrix}-h\dot q_2&-h(\dot q_1+\dot q_2)\\h\dot q_1&0\end{bmatrix}. The gravity vector is the gradient of UU. For this choice, M˙−2C\dot{\mat{M}}-2\mat{C} is skew-symmetric: its diagonal is zero and opposite off-diagonal entries cancel. This property cancels velocity terms in the stability proof. The equations are also linear in suitable inertial parameters, although not in joint coordinates.

The first figure uses m1=m2=l1=l2=1m_1=m_2=l_1=l_2=1, rod moments and gravity 9.81. It starts at q=(1.2,−0.4)\vb{q}=(1.2,-0.4) radians with zero velocity. It computes q¨\ddot{\vb{q}} by solving the mass system and integrates for five seconds with a 0.02 s step. Viscous friction dissipates energy; with zero friction the exact mechanical energy is constant. Explicit Euler can create numerical drift even when the ideal system conserves energy. RK4 reduces error in this configuration but does not exactly conserve energy for every step or horizon.

Newton-Euler forward and backward

Recursive Newton-Euler inverse dynamics computes the torques required for a given position, velocity and acceleration. A forward pass propagates each link’s velocity and acceleration; a backward pass sums descendant forces and moments. The lab implements the planar version for a rod chain, with gravity incorporated as reference acceleration. It does not first form the mass matrix.

Forward dynamics solves Mq¨=τ−Cq˙−g\mat{M}\ddot{\vb{q}}=\boldsymbol{\tau}-\mat{C}\dot{\vb{q}}-\vb{g}. Each column of M\mat{M} can be obtained by applying inverse dynamics with unit acceleration and zero velocity and gravity. Agreement between the two procedures requires the same frames, masses, inertias, gravity and external-force sign. This consistency check is especially useful when a hand-derived formula has sign errors.

Stability and control

In gravity-compensated PD, for a constant reference and error e=q−qd\vb{e}=\vb{q}-\vb{q}_d, apply τ=g(q)−Kpe−Kdq˙\boldsymbol{\tau}=\vb{g}(\vb{q})-\mat{K}_p\vb{e}-\mat{K}_d\dot{\vb{q}} with symmetric positive-definite gains. Take

V=12q˙⊤M(q)q˙+12e⊤Kpe.V=\tfrac12\dot{\vb{q}}\T\mat{M}(\vb{q})\dot{\vb{q}}+\tfrac12\vb{e}\T\mat{K}_p\vb{e}.

Using skew symmetry, V˙=−q˙⊤Kdq˙≤0\dot V=-\dot{\vb{q}}\T\mat{K}_d\dot{\vb{q}}\le0. On the set q˙=0\dot{\vb{q}}=0, the dynamics remain there only if Kpe=0\mat{K}_p\vb{e}=0, hence e=0\vb{e}=0. Under smooth dynamics, uniformly positive masses, an exact gravity model and no saturation, LaSalle’s invariance principle gives convergence to equilibrium in the domain considered. For periodic angles, define the error and its domain; the proof does not cover representation jumps, latency or torque limits. Review the hypotheses for Lyapunov and stability before applying the conclusion to a physical controller.

The third figure shows a point-mass pendulum of mass 1 kg and length 0.5 m, I=0.25I=0.25 kg m², Kp=4K_p=4 and Kd=0.8K_d=0.8. Its horizontal axis is angular error, the other axis is velocity, and height is 0.18V0.18V. With gravity compensated, V˙=−Kdq˙2\dot V=-K_d\dot q^2. Without compensation, an additional −mglsin⁡(q)q˙-mgl\sin(q)\dot q term can be positive, so that candidate no longer certifies descent. RK4 integrates the curve and the indicator shows the largest increase in VV between samples, not a universal mathematical proof.

Computed torque uses a model to cancel nonlinear terms. If e=q−qd(t)\vb{e}=\vb{q}-\vb{q}_d(t), the law τ=M(q¨d−Kde˙−Kpe)+Cq˙+g\boldsymbol{\tau}=\mat{M}(\ddot{\vb{q}}_d-\mat{K}_d\dot{\vb{e}}-\mat{K}_p\vb{e})+\mat{C}\dot{\vb{q}}+\vb{g} gives e¨+Kde˙+Kpe=0\ddot{\vb{e}}+\mat{K}_d\dot{\vb{e}}+\mat{K}_p\vb{e}=0 with an exact model and no disturbances. Incorrect mass, contact and saturation break that cancellation. Linear dynamics design connects to second-order systems or LQR, but local linearization alone does not certify the entire system.

Impedance control seeks a relation between displacement and force, for example F=K(xd−x)+D(x˙d−x˙)\vb{F}=\mat{K}(\vb{x}_d-\vb{x})+\mat{D}(\dot{\vb{x}}_d-\dot{\vb{x}}), with τ=J⊤F+g\boldsymbol{\tau}=\mat{J}\T\vb{F}+\vb{g}. Lower stiffness permits more deformation under the same force in a static model; it does not automatically remove peaks or guarantee stable contact. In operational-space control, if J\mat{J} has full row rank, effective inertia is Λ=(JM−1J⊤)−1\boldsymbol{\Lambda}=(\mat{J}\mat{M}^{-1}\mat{J}\T)^{-1}. Bias terms and the choice of a dynamic projection for secondary tasks also matter. Near singularities this inverse ceases to exist or becomes ill-conditioned.

The second figure uses the same rods as the first, joint viscous friction 0.08 and RK4 with a 0.01 s step. Its reference is (0.6+0.25sin⁡(0.7t),−0.5+0.15sin⁡(0.7t))(0.6+0.25\sin(0.7t),-0.5+0.15\sin(0.7t)) radians, and derivative gain is 2Kp2\sqrt{K_p}. The wall exerts a unilateral elastic force with stiffness 100 N/m and damping 3 N s/m beyond x=1.2x=1.2; it is converted to torques with the Jacobian. Impedance control uses Cartesian stiffness and damping five times the corresponding gains and estimated gravity compensation. The true second-link mass is 1 kg; the slider changes the controller model’s mass. The optional push adds 2 N m to the first joint from 2 to 2.1 s. These are results from this explicit simulation, not a commercial-arm trial.

An operational-space controller can use redundancy for a secondary task, but the projector must match the chosen dynamics and priority. Discretization turns the continuous system into a time-step problem: a gain stable in a continuous model can oscillate if frequency or delay is unsuitable. Linearization around equilibrium helps analyze a neighbourhood; integrating an ODE with initial conditions checks one scenario rather than proving stability for all.

As a real interface example, Franka Control Interface documents joint position, velocity or torque commands and Cartesian commands, with exchange at 1 kHz. Its documentation says torque commands on that interface include gravity and friction compensation; adding compensation again without considering the API would produce a different signal than intended. A position policy can run at a lower rate and feed a generator and controller that execute intermediate references. That layer’s rate, filtering, latency and limits are part of the system to evaluate.

Lab: derivation and Newton-Euler

The cells symbolically derive M\mat{M}, C\mat{C} and g\vb{g}, verify the structural property and compare Newton-Euler with Lagrangian dynamics on 100 random states with a fixed seed. Angles are measured from the downward vertical and moments of inertia are taken about each rod’s centre.

[ ]Energies and symbolic equationsBrowser
import numpy as np
import sympy as sp
q1,q2,v1,v2=sp.symbols('q1 q2 v1 v2',real=True)
m1,m2,l1,l2,g=sp.symbols('m1 m2 l1 l2 g',positive=True)
Q=sp.Matrix([q1,q2]); V=sp.Matrix([v1,v2])
p1=sp.Matrix([l1*sp.sin(q1)/2,-l1*sp.cos(q1)/2])
p2=sp.Matrix([l1*sp.sin(q1)+l2*sp.sin(q1+q2)/2,-l1*sp.cos(q1)-l2*sp.cos(q1+q2)/2])
vone=p1.jacobian(Q)*V; vtwo=p2.jacobian(Q)*V
I1=m1*l1**2/12; I2=m2*l2**2/12
K=sp.expand((m1*vone.dot(vone)+I1*v1**2+m2*vtwo.dot(vtwo)+I2*(v1+v2)**2)/2)
U=g*(m1*p1[1]+m2*p2[1])
M=sp.trigsimp(sp.hessian(K,(v1,v2)))
C=sp.Matrix(2,2,lambda i,j:sum((sp.diff(M[i,j],Q[k])+sp.diff(M[i,k],Q[j])-sp.diff(M[j,k],Q[i]))*V[k]/2 for k in range(2)))
C=sp.simplify(C); G=sp.Matrix([sp.diff(U,q) for q in Q])
Mdot=sp.Matrix(2,2,lambda i,j:sum(sp.diff(M[i,j],Q[k])*V[k] for k in range(2)))
assert sp.simplify((Mdot-2*C)+(Mdot-2*C).T)==sp.zeros(2)
print('M =',M); print('C =',C); print('g =',G)
args=(q1,q2,v1,v2,m1,m2,l1,l2,g)
mf=sp.lambdify(args,M,'numpy'); cf=sp.lambdify(args,C,'numpy'); gf=sp.lambdify(args,G,'numpy')
[ ]Planar Newton-EulerBrowser
def perp(r): return np.array([-r[1],r[0]])
def cross(a,b): return a[0]*b[1]-a[1]*b[0]
def rnea(q,qd,qdd,model):
    masses,lengths,inertias,gravity=model
    angle=omega=alpha=0.; accel=np.zeros(2); data=[]
    for i in range(len(q)):
        angle+=q[i]; omega+=qd[i]; alpha+=qdd[i]
        u=np.array([np.sin(angle),-np.cos(angle)])
        rc=lengths[i]*u/2; re=lengths[i]*u
        ac=accel+alpha*perp(rc)-omega**2*rc
        F=masses[i]*(ac-np.array([0.,-gravity])); N=inertias[i]*alpha
        data.append((rc,re,F,N))
        accel=accel+alpha*perp(re)-omega**2*re
    result=np.zeros(len(q)); nextF=np.zeros(2); nextN=0.
    for i in range(len(q)-1,-1,-1):
        rc,re,F,N=data[i]
        result[i]=N+cross(rc,F)+nextN+cross(re,nextF)
        nextF=F+nextF; nextN=result[i]
    return result
rng=np.random.default_rng(2); model=([1.,1.],[1.,1.],[1/12,1/12],9.81); worst=0.
for _ in range(100):
    q=rng.uniform(-2,2,2); qd=rng.normal(size=2); qdd=rng.normal(size=2)
    vals=(*q,*qd,1.,1.,1.,1.,9.81)
    expected=mf(*vals)@qdd+cf(*vals)@qd+gf(*vals).ravel()
    worst=max(worst,np.max(np.abs(expected-rnea(q,qd,qdd,model))))
print('Error máximo Newton-Euler:',worst)
assert worst<1e-10

In the backward pass, the next link’s moment must be moved to the current pivot, giving the term cross(re,nextF). Omitting it fails to transmit the weight of later links to the first motor.

The next cell integrates forward dynamics with RK4 and compares three laws on a smooth reference. Curves and errors come from this run with exact masses and model; change parameters and initial conditions to explore when that comparison stops being valid.

[ ]Forward dynamics and three controllersBrowser
import matplotlib.pyplot as plt

def matrices(q,qd):
    vals=(*q,*qd,1.,1.,1.,1.,9.81)
    return np.asarray(mf(*vals),float),np.asarray(cf(*vals),float),np.asarray(gf(*vals),float).ravel()
def reference(t):
    w=.7
    return (np.array([.6+.25*np.sin(w*t),-.5+.15*np.sin(w*t)]),
            np.array([.25*w*np.cos(w*t),.15*w*np.cos(w*t)]),
            np.array([-.25*w*w*np.sin(w*t),-.15*w*w*np.sin(w*t)]))
def control(state,t,mode):
    q,qd=state[:2],state[2:]; desired,vd,ad=reference(t)
    mass,C,gravity=matrices(q,qd); feedback=20*(desired-q)+9*(vd-qd)
    if mode=='PD': return feedback
    if mode=='PD + gravedad': return feedback+gravity
    return mass@(ad+feedback)+C@qd+gravity
def deriv(state,t,mode):
    q,qd=state[:2],state[2:]; mass,C,gravity=matrices(q,qd)
    qdd=np.linalg.solve(mass,control(state,t,mode)-C@qd-gravity)
    return np.r_[qd,qdd]
def integrate(mode):
    dt=.01; state=np.array([.3,-.3,0.,0.]); errors=[]
    for i in range(301):
        t=i*dt; desired,_,_=reference(t); errors.append(np.linalg.norm(state[:2]-desired))
        if i<300:
            k1=deriv(state,t,mode); k2=deriv(state+dt*k1/2,t+dt/2,mode)
            k3=deriv(state+dt*k2/2,t+dt/2,mode); k4=deriv(state+dt*k3,t+dt,mode)
            state=state+dt*(k1+2*k2+2*k3+k4)/6
    return np.array(errors)
fig,ax=plt.subplots()
for mode in ['PD','PD + gravedad','par calculado']:
    errors=integrate(mode); print(mode,'RMS angular:',round(np.sqrt(np.mean(errors**2)),6))
    ax.plot(np.arange(len(errors))*.01,errors,label=mode)
ax.set(xlabel='tiempo (s)',ylabel='norma del error angular (rad)'); ax.legend(); plt.show()

Local lab: Panda and contact

We use the MuJoCo Menagerie Panda at a pinned revision. It reuses oryon-panda-model from the previous lesson if present; otherwise the first run downloads XML and meshes. You need mujoco, NumPy and network access for the download. We add a table and measurement site and disable the model’s actuators to apply simulated torques directly. This is not a physical robot’s torque interface.

[ ]Prepare the contact modelLocal GPU
import os, urllib.request, xml.etree.ElementTree as ET
from pathlib import Path
import numpy as np
import mujoco

root=Path(os.environ.get('ORYON_PANDA_DIR',str(Path.cwd()/'oryon-panda-model')))
root.mkdir(parents=True,exist_ok=True)
base='https://raw.githubusercontent.com/google-deepmind/mujoco_menagerie/822c2d8f877dd166c5b7d3c9f7e3c3b6589473b7/franka_emika_panda/'
xml=root/'panda.xml'
if not xml.exists(): urllib.request.urlretrieve(base+'panda.xml',xml)
tree=ET.parse(xml)
for mesh in tree.findall('.//asset/mesh'):
    filename=mesh.get('file')
    if filename:
        dest=root/'assets'/filename; dest.parent.mkdir(parents=True,exist_ok=True)
        if not dest.exists(): urllib.request.urlretrieve(base+'assets/'+filename,dest)
hand=tree.find(".//body[@name='hand']")
ET.SubElement(hand,'site',{'name':'tool','pos':'0 0 0.10','size':'0.005'})
path=root/'panda_temp.xml'; tree.write(path,encoding='utf-8',xml_declaration=True)
temp=mujoco.MjModel.from_xml_path(str(path)); initial_data=mujoco.MjData(temp)
mujoco.mj_resetDataKeyframe(temp,initial_data,0); mujoco.mj_forward(temp,initial_data)
site0=mujoco.mj_name2id(temp,mujoco.mjtObj.mjOBJ_SITE,'tool'); start=initial_data.site_xpos[site0].copy()
position=f'{start[0]:.4f} {start[1]:.4f} {start[2]-0.04:.4f}'
ET.SubElement(tree.find('worldbody'),'geom',{'name':'table','type':'box','pos':position,'size':'0.15 0.15 0.02','friction':'1 0.005 0.0001'})
path=root/'panda_contact.xml'; tree.write(path,encoding='utf-8',xml_declaration=True)
model=mujoco.MjModel.from_xml_path(str(path)); model.opt.disableflags |= mujoco.mjtDisableBit.mjDSBL_ACTUATION
site=mujoco.mj_name2id(model,mujoco.mjtObj.mjOBJ_SITE,'tool')
table=mujoco.mj_name2id(model,mujoco.mjtObj.mjOBJ_GEOM,'table')
joints=[mujoco.mj_name2id(model,mujoco.mjtObj.mjOBJ_JOINT,f'joint{i}') for i in range(1,8)]
dofs=model.jnt_dofadr[joints]; qaddrs=model.jnt_qposadr[joints]
def full_mass(d,M):
    try: mujoco.mj_fullM(model,d,M)
    except TypeError: mujoco.mj_fullM(model,M,d.qM)
print('Paso de simulación (s):',model.opt.timestep)
This cell needs the local lab (PyTorch with your GPU). Start it with npm run lab and open the connection link.
[ ]Computed torque and contact forceLocal GPU
import matplotlib.pyplot as plt

def reset():
    d=mujoco.MjData(model); mujoco.mj_resetDataKeyframe(model,d,0); mujoco.mj_forward(model,d); return d
def impedance(K):
    d=reset(); initial=d.site_xpos[site].copy(); target=initial+np.array([0,0,-.04])
    Jp=np.zeros((3,model.nv)); Jr=np.zeros((3,model.nv)); bias=np.zeros(model.nv); mass=np.zeros((model.nv,model.nv))
    forces=[]; bias_error=0.
    for _ in range(1500):
        mujoco.mj_forward(model,d); mujoco.mj_jacSite(model,d,Jp,Jr,site)
        mujoco.mj_rne(model,d,0,bias); full_mass(d,mass)
        bias_error=max(bias_error,np.max(np.abs(bias-d.qfrc_bias)))
        e=target-d.site_xpos[site]; velocity=Jp@d.qvel
        force=K*e-2*np.sqrt(K)*velocity
        torque=Jp[:,dofs].T@force+bias[dofs]-2*d.qvel[dofs]
        d.qfrc_applied[:]=0; d.qfrc_applied[dofs]=np.clip(torque,-80,80)
        mujoco.mj_step(model,d); normal=0.
        for i in range(d.ncon):
            c=d.contact[i]
            if c.geom1==table or c.geom2==table:
                f=np.zeros(6); mujoco.mj_contactForce(model,d,i,f); normal+=max(0.,f[0])
        forces.append(normal)
    return np.array(forces),bias_error
fig,ax=plt.subplots()
for stiffness in [100,300,600]:
    forces,bias_error=impedance(stiffness)
    print('K:',stiffness,'media final (N):',round(np.mean(forces[-100:]),6),'máximo (N):',round(np.max(forces),6),'error RNE:',bias_error)
    ax.plot(np.arange(len(forces))*model.opt.timestep,forces,label=f'K={stiffness}')
ax.set(xlabel='tiempo (s)',ylabel='suma de fuerzas normales (N)'); ax.legend(); plt.show()

d=reset(); q0=d.qpos[qaddrs].copy(); bias=np.zeros(model.nv); mass=np.zeros((model.nv,model.nv)); errors=[]
for n in range(1500):
    mujoco.mj_forward(model,d); t=n*model.opt.timestep; w=2*np.pi/3
    qref=q0.copy(); qdref=np.zeros(7); qddref=np.zeros(7)
    qref[0]+=.15*(1-np.cos(w*t)); qdref[0]=.15*w*np.sin(w*t); qddref[0]=.15*w*w*np.cos(w*t)
    mujoco.mj_rne(model,d,0,bias); full_mass(d,mass)
    accel=qddref+200*(qref-d.qpos[qaddrs])+28*(qdref-d.qvel[dofs])
    d.qfrc_applied[:]=0; d.qfrc_applied[dofs]=mass[np.ix_(dofs,dofs)]@accel+bias[dofs]
    errors.append(np.linalg.norm(qref-d.qpos[qaddrs])); mujoco.mj_step(model,d)
print('Par calculado RMS articular (rad):',np.sqrt(np.mean(np.square(errors))))
assert np.isfinite(errors).all()
This cell needs the local lab (PyTorch with your GPU). Start it with npm run lab and open the connection link.

Computed torque is evaluated in free space; impedance presses against the table. Force is the sum of normal components reported by MuJoCo for contacts with the table, not a real-world measurement. The final mean uses the last 100 samples. Control applies an idealized bias model and limits impedance torques to 80 N m per component. The comparison keeps the same target and contact model; it does not establish that high stiffness is safe or generalize to other objects or integrators.

Exercises

Proof
Prove: With the Christoffel definition, M dot minus 2C is skew-symmetric.
0
Cij = sum_k (∂k Mij + ∂j Mik - ∂i Mjk) q dot k / 2 and M is symmetric.

Step 1 of 2. What is M dot ij?

Proof
Prove: PD with exact gravity converges to equilibrium under the lesson's assumptions.
0
V is kinetic energy plus 1/2 eᵀ Kp e, with positive-definite Kp and Kd.

Step 1 of 2. What remains in the derivative of V?

Numeric
A 1 kg point mass is 0.5 m from its pivot and at rest 30° from the downward vertical. With g=9.81 m/s², what is the compensating torque magnitude in N m?
Quiz
To insert a peg with 0.1 mm clearance and possible contact, which is the more appropriate starting point?
Code
Implement rnea(q, qd, qdd, model) for a planar chain of uniform rods, with angles from the downward vertical and model=(masses, lengths, central inertias, gravity). Return the torques.
def rnea(q, qd, qdd, model):
  pass
Shift+Enter to run
Key idea
A policy’s signal becomes motion through dynamics and control: model, frequency, uncertainty and contact determine the real response.