Guy on Simulink

Simulink & Model-Based Design

Models Inspired by Real Life

Often models are the predecessor to a real-life device; however, sometimes a device inspires the model. In the 1980s, there was a group known as the Leg Lab at CMU who researched running robots.  In 1986 the Leg Lab moved to MIT.  Some of their robots are now on display at the MIT Museum, and they still inspire wonder in visitors today.  One of those robots is a 3-D One-Legged Hopper which inspired my colleague, Guy Rouleau.

I saw this robot at the MIT Museum last winter and after discussing with few colleagues at The MathWorks we decided that it would be cool to have a Simulink model of this robot.

Read on to learn about how Guy constructed and controlled this one-legged hopper (download from the file exchange).

2-D hopping robot animation

Simulation and Control of a One-Legged Hopping Robot

By Guy Rouleau

Robot modeler, Guy Rouleau

Here is the description of a one-legged hopping robot Simulink model I completed recently. I will explain how I prepared and implemented this simulation.


Before modeling any system in Simulink, it is always good to have a plan. To begin I always like to draw a simple representation of the system I want to model. In this picture we see two bodies (let’s call them body and leg) connected together at the hip. The robot has two actuated degrees of freedom (DoF) in his configuration space, the angle between the body and the leg, and the length of the leg. These 2 DoF will be used to control the 3 DoF motion of the body in space (height, distance and angle). 

Hopping robot diagram

Now that the robot is described, it is time to think about how to control it. The robot control can be divided into three independent controllers:

  1. Attitude Control - The length of the leg is controlled by a pneumatic actuator. This actuator behaves like a spring. It gives a smooth
    landing and injects force to keep the robot bouncing.
  2. Velocity Control – As when a person walks, the leg is brought in front of the body while it is in the air. While the leg touches the ground, then the body is brought in front.
  3. Orientation Control - During the stance, the leg is in contact with the ground. A torque is applied at the hip to control the angle of the body.

The following picture shows the three controllers graphically:

The Three hopping robot controllers

Now I have a good idea of what to implement, it is time to have fun and play with Simulink. For this model, SimMechanics is the most appropriate Blockset to
model the robot.


When I begin a SimMechanics model for a moving robot, I like fixing the position of the body in space. By doing so, I can verify if the configuration of the
actuators behaves as expected. This SimMechanics model looks like this:

SimMechanics model of a hopping robot

Using this model I can test different inputs and see the resulting motion at the tip of the leg. Once I am satisfied with this motion, I can think about the interaction with the ground.

My new goal is now to see the robot falling from a certain initial eight, bouncing a few times and fall. To model the ground, I use the Bouncing Ball demo provided with SimMechanics. After grouping components within subsystems, the model now looks like the following picture.

Once the contact forces and robot motion are validated, it is time to implement the control architecture.

Typically, when I implement a controller I like to divide the model in the following subsystems:

Sensor modeling

This subsystem extracts and processes the information from the SimMechanics model to generate signals that could be provided by real sensors. For the hopping robot, I will measure the following:

  • Angle between leg and body
  • Angle of the body relative to the ground
  • An on/off contact sensor.

Motion Analysis

Based on the sensors, the information necessary for the controllers is computed. The contact switch is used to compute the duration of the flight and stance period. These durations, along with the hip and body angles can be used to estimate the robot velocity and displacement.


With all the necessary information available, it is time to generate the actuator signals for the 3 control modes.

  • Attitude
    – The same amount of force is injected by the pneumatic actuator at each jump. This generates jumps of constant eight and duration. The amount of force injected can be adjusted to obtain the desired jump eight, but for now, it will be kept constant.
  • Velocity – This is the most complex controller in this robot. First, we look at the displacement during the previous jump. While in
    flight, the tip of the leg is positioned in front of the robot body to prepare a motion similar to the previous jump. Also during flight, the leg
    tip position is modified depending if the robot must accelerate or decelerate. Landing with the leg farther in front of the body will
    accelerate the robot, while a leg tip closer to the body will decelerate it. A simple trajectory generation is also implemented to move the leg
    smoothly during the flight.
  • Orientation – In this phase, a hip torque is computed to keep the angle of the body with the ground close to zero. Combined with the
    Velocity controller, the Orientation controller pushes the robot in the right direction.

After implementing the 3 controllers, it is time to visualize what the resulting motion looks like.

Animation of a 3-D Hopping robot VR scene

The description above contains the main steps I followed to create the hopping robot simulation. For more details, I suggest visiting the MATLAB Central file Exchange to download the Simulink model of this one-legged hopping robot.

When looking at the model, you will see that I omitted many details to make a short story. But the main process I use to create most of Simulink models is described here.

Have you ever built a robot?  What do you think about this model?  Please leave a comment here.

  • print
  • send email


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.