How a Robot Arm Sees and Acts: Kinematics + Sim Loop (MuJoCo)
Mehul Kumawat
0:00 / 0:00
How a Robot Arm Sees and Acts: Kinematics + Sim Loop (MuJoCo)
45 просмотров · 2 нед. назад
Mehul Kumawat
36 подписчиков
45 просмотров · 2 нед. назад
A three-joint robot arm in MuJoCo picks up a cube: 55 decisions, 2,750 physics steps, 52 ms of compute, and no learning at all. Just forward kinematics, inverse kinematics, a controller, and a loop that asks a policy for an action 20 times per second. That loop is the point of this episode: vision-language-action models, JEPA and world models all plug into one line of it, action = policy(observation). Today the policy is four if statements that read the true cube position; the rest of the playlist replaces it with models that learn.
About the setup: this is a simulated tabletop with one cube, not a real robot or a factory. The arm is planar (it moves in one vertical plane), the expert is a hand-written rule set, and every number on screen comes from the code in this episode.
What you'll learn
Forward kinematics as three steps along a chain: angles in, finger position out
Inverse kinematics in four steps: wrist target, law of cosines for the elbow, two atan2 for the shoulder, the rest points the hand down (elbow-up branch)
Testing your kinematics against MuJoCo itself: 1000 targets, error at rounding level (1e-16 m)
The robot loop: observe, decide, act; 20 decisions per second, 50 physics steps of 1 ms per decision
What a policy is: observation in, [dx, dz, gripper] out; why real demonstrations flicker at rule boundaries (a 9.6 mm overshoot)
The MuJoCo API you need: MjModel, MjData (qpos, ctrl), mj_step, mj_kinematics, named body and site positions, Renderer
Rendering without a screen: MUJOCO_GL=glfw inside xvfb-run (EGL and OSMesa did not start in this setup)
Gotcha: MJCF angles default to degrees: drop compiler angle="radian" and the hand ends 24.5 cm off target
Gotcha: IK outside the reach fails silently behind np.clip: 0.7 cm and 6.7 cm errors with no exception
Chapters
0:00 Intro
0:37 Mental model
2:57 The code
5:53 How it runs
6:27 Gotchas
7:19 Recap
Next episode: a vision-language-action model from scratch: a 64×64 camera image and an instruction like "pick up the red cube" go into a tiny transformer that outputs action tokens, trained on demonstrations from today's expert.
#robotics #mujoco #robotlearning #kinematics #inversekinematics #python #reinforcementlearning #vla