# Making the Unitree H1 Stand in MuJoCo
> Learn how to load the Unitree H1 humanoid in MuJoCo, configure a 19-joint PD standing controller, and export IMU and torque telemetry to CSV.
**Author:** Drift Team
**Published:** 2026-10-31
**Tag:** Product
**Reading time:** 4 min
**Canonical URL:** https://godrift.ai/blogs/making-the-unitree-h1-stand-in-mujoco
---A humanoid robot standing still looks deceptively passive, but maintaining upright posture on two narrow foot pads is an active control challenge. Without continuous joint stabilization, a multi-link biped quickly collapses under its own weight. In this setup, Drift loads the Unitree H1 humanoid from the built-in robot library and configures a joint-level PD controller in MuJoCo to achieve stable standing while logging complete physical telemetry.

&nbsp;

<figure data-type="youtube-embed" data-yt-id="9SdbdbeKZqw" data-autoplay="1" data-loop="1">
  <iframe src="https://www.youtube.com/embed/9SdbdbeKZqw?autoplay=1&mute=1&loop=1&playlist=9SdbdbeKZqw&rel=0&playsinline=1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen loading="lazy"></iframe>
</figure>

&nbsp;

## Humanoid Kinematics and Task Definition

The standard Unitree H1 features 19 degrees of freedom across its legs, waist, and arms. The lower body accounts for 10 actuated joints comprising three hip degrees of freedom, one knee joint, and one ankle joint per leg. The remaining joints distribute across the waist and upper extremities.

&nbsp;

Drift loaded the model directly into the simulation environment on a flat ground plane. To initiate the stance, the simulation initializes the robot using its default standing keyframe posture, positioning the feet flat against the ground plane with nominal knee flexion. Maintaining this posture requires applying motor torques that continuously counteract gravity, ground contact reaction forces, and joint velocity drift.

## **Joint PD Control and Stiffness Tuning**

To hold the target pose without full trajectory optimization, Drift configured an independent proportional-derivative (PD) controller for all 19 actuators. The controller calculates instantaneous motor torques by comparing actual joint angles and velocities against target reference values.

&nbsp;

Because humanoid stability depends heavily on the base of support, uniform controller gains across all joints lead to poor balance. Drift applied stiff, highly damped gains at the hips and ankles to counter tall inverted-pendulum moments, while assigning moderate gains to the upper body. The higher proportional stiffness provides the restoring torque needed to keep the pelvis aligned, while the derivative damping suppresses oscillations that can destabilize foot-ground contacts.

## **Headless Execution and Telemetry Logging**

With the control loop defined, Drift executed a five-second simulation headless before loading the final state into the interactive MuJoCo viewer. Running the physics loop headlessly removes rendering overhead, allowing the physics solver to step through hundreds of contact evaluations per second at high numerical precision.

&nbsp;

Throughout the five-second run, the environment streamed comprehensive physical telemetry into an output log:

**Inertial Measurement:** Linear acceleration and angular velocity recorded from the torso IMU.

**Floating Base Pose:** World-coordinate position $(x, y, z)$ and orientation quaternions tracking center-of-mass drift.

**Actuation Dynamics:** Measured joint positions, velocities, and commanded motor torques across all 19 joints.

&nbsp;

Exporting these telemetry streams directly to `sensor_log.csv` enables engineers to verify that joint torques remain within safe mechanical thresholds, inspect torque ripple at contact boundaries, and confirm that the robot maintains static equilibrium without drifting off balance.

## **The Foundation for Dynamic Locomotion**

Static standing represents the baseline validation step for bipedal simulation. By verifying joint limits, contact friction parameters, and stiffness margins in MuJoCo, developers establish a stable baseline posture. Once an inverted-pendulum system achieves a dependable resting equilibrium, the same kinematic asset can be expanded into dynamic balance recovery, push-recovery experiments, and reinforcement learning locomotion policies.

## **FAQ**

### **Why does a standing humanoid require active PD control?**

A humanoid robot is an underactuated, inherently unstable inverted pendulum system. Unlike a four-wheeled base or a quadruped with a broad support polygon, two narrow feet cannot maintain balance passively against gravity without active restoring torques at the joints.

### **Why are hip and ankle joints tuned with higher stiffness than the arms?**

The hips and ankles directly support the entire robot mass and establish ground contact torque. Higher proportional stiffness at the lower joints prevents the torso from tipping over, whereas excessive stiffness in the arms adds unnecessary mechanical stress without improving stance stability.

### **What are the advantages of running MuJoCo simulations headlessly?**

Headless execution bypasses GPU rendering and window management, directing available compute entirely to numerical physics integration. This allows simulations to run many times faster than real time, accelerating data logging and reinforcement learning loops.

### **What metrics in the sensor log indicate stable standing?**

Stable standing is confirmed when the torso linear accelerations remain close to gravitational constants, base velocity approaches zero, and joint error signals decay smoothly without high-frequency oscillation or torque saturation.

## **Related Reading**

- [MuJoCo: The Physics Engine Robotics Research Quietly Runs On](https://www.godrift.ai/blogs/what-is-mujoco)
- [PID vs. MPC vs. Reinforcement Learning: How Robots Control Movement](https://www.google.com/search?q=https://www.godrift.ai/blogs/pid-vs-mpc-vs-reinforcement-learning-robot-control&authuser=3)
- [Why Robots Practice in Simulation Before the Real World](https://www.godrift.ai/blogs/why-robots-train-in-simulation)
- [5 Humanoid Robots Pushing Robotics in New Directions](https://www.godrift.ai/blogs/5-humanoid-robots-pushing-robotics)
