add wishlist add wishlist show wishlist add compare add compare show compare preloader icon-theme-126 icon-theme-161 icon-theme-138 icon-theme-027 electro-thumb electro-return-icon electro-brands-icon electro-payment
  • +1 (857) 226-1305
  • +86 18825289328

How WonderDuck Learns to Walk

A duck learning to walk seems ordinary. But what if it is a robot duck?

It has no innate motor skills. Lifting a leg, taking a step, and staying balanced all require multiple joints working in coordination. As its state changes, it must continuously adjust its movements to keep walking.

Can a robot duck learn to walk the way humans and animals do—through trial and error?

This is exactly the problem that Reinforcement Learning (RL) aims to solve.

Hiwonder’s WonderDuck uses reinforcement learning. Through simulation modeling, goal setting, reward shaping, and repeated trial-and-error, it gradually develops motion strategies that are eventually transferred to the physical robot. How does it progress from stumbling to walking independently? We break the process into eight steps:

WonderDuck robot ducks

01  Digital Twin Modeling: Replicating the Robot Duck in a Virtual World

How does the AI know what kind of robot it is controlling? By building a digital twin.

Developers construct a 1:1 simulation model based on the real robot’s mechanical structure, joint parameters, and mass distribution, so the virtual duck closely matches the physical hardware.

For WonderDuck, the simulation model corresponds to its 15-degree-of-freedom structure and the motion parameters and mass distribution of each joint. Once the model is ready, the AI can control the virtual duck and try different movements without risking the real hardware.

WonderDuck digital twin model shown from multiple angles

02  Building the Environment: Creating a Virtual Training Ground

WonderDuck uses the MuJoCo physics engine to create the training environment. MuJoCo simulates gravity, friction, collisions, and other physical effects, allowing the virtual duck to act and receive realistic state feedback.

The observation space and action space must also be defined. The observation space determines what information the AI can receive (posture, joint states, etc.), while the action space determines which joints it can control and how.

One handles perception of the current state; the other outputs control actions. Together they form the foundation of interaction between the robot and the simulated environment.

Virtual WonderDuck robots in a parallel simulation training environment

03  Setting Goals: Clarifying What the Duck Should Learn

Training cannot be aimless. For WonderDuck, the core goals include stable forward walking, maintaining balance, and coordinated motion. Tasks cover walking, standing up from a fall, and more.

In a walking task, the system guides the robot toward a target direction while monitoring posture. In a stand-up task, the robot learns to recover from lying on the ground. Different tasks lead to different reward function designs.

WonderDuck practicing a walking task

04  Reward Shaping: Teaching the AI What Good Behavior Looks Like

The reward function in reinforcement learning acts as a scoring system: after each action, the system gives a reward or penalty based on the outcome, and the AI adjusts its strategy accordingly.

For WonderDuck’s walking training:

  • Positive rewards: forward displacement, maintaining good posture, and other behaviors that match the training goals.
  • Negative penalties: falling, exceeding joint limits, abnormal shaking, and other undesirable behaviors.

The AI does not start knowing how to walk. It learns through repeated actions and feedback. Different reward designs can lead to very different motion strategies.

05  Massive Trial and Error: Learning Gaits Through Repetition

WonderDuck trains using the PPO (Proximal Policy Optimization) algorithm. The AI executes actions according to its current policy, the simulator returns the results, and the algorithm updates the policy based on the rewards.

This cycle repeats continuously.

At first the duck may fall after a few steps or produce uncoordinated movements. Every attempt generates new feedback that helps refine the next policy. To improve efficiency, WonderDuck runs hundreds of parallel environments and uses Domain Randomization to randomly vary environmental parameters, exposing the AI to a wider range of conditions and improving robustness.

A single day of training can involve millions of falls. Through this volume of repetition, the AI gradually discovers motion patterns that better achieve the goals.

06  Policy Convergence: Turning Experience into a Deployable Model

Once training performance stabilizes, the learned policy can be exported and prepared for deployment.

WonderDuck supports exporting the trained policy as an ONNX model and applying lightweight optimization so it can run efficiently on the robot’s onboard computer. Note that finishing training does not mean the robot can already walk in the real world—it still needs to be validated on the physical duck.

07  Real-World Deployment: Running the Learned Policy on Hardware

On the physical robot, the main controller runs policy inference, and the low-level control system drives the servos to execute the corresponding motions.

WonderDuck uses a self-developed dual-brain architecture with RK3566 and AT32. The RK3566 handles higher-level tasks such as reinforcement learning inference, while the AT32 manages real-time low-level tasks including IMU data collection and servo bus control, supporting a 50 Hz control loop.

This completes the transfer from simulation to real hardware—commonly called Sim-to-Real. However, differences always exist between simulation and reality (ground friction, joint response, external disturbances). After deployment, further testing and tuning are still required.

WonderDuck dual-brain controller with RK3566 and AT32

08  Continuous Optimization: From Real-World Feedback to the Next Training Round

Deploying the model on the real robot does not mark the end of reinforcement learning.

Data collected during real-robot operation helps developers identify gaps between simulation and reality. By gathering motion data, recalibrating simulation parameters, and iterating on the model and control strategy, performance can be further improved.

This is not a separate eighth step, but a continuous cycle that runs through training and deployment:

Simulation Training → Policy Export → Real Deployment → Data Collection → Parameter Calibration → New Training Round

Problems encountered in the real world become references for the next round of training. Through repeated iteration, the motion policy continues to improve.

WonderDuck demonstrating its learned motion policy

From a Robot Duck to the World of Reinforcement Learning

WonderDuck integrates these stages into an open-source bipedal robot and provides the WonderRL reinforcement learning toolkit, which includes the simulation environment, PPO training, training visualization, customizable reward functions, model export, and real-robot deployment.

Developers can experience pre-trained actions such as walking, standing up, sitting down, and pecking, or build on the open training project to define their own tasks and explore custom motion strategies.

A robot duck progressing from stumbling to independent walking is not the result of simply recording a set of motions. It is the outcome of an AI gradually discovering its own way of moving through repeated attempts and feedback.

Light
Dark