Skip to content

Part 1: Run the examples

1.1 Install

You need Python 3.10 or newer. The ready-built downloads (with the compiled core) are for Linux x86-64 and Windows 10 or 11 (64-bit); macOS on Apple Silicon is coming soon. Check what you have by typing, in a terminal:

python3 --version        (Ubuntu)
py --version             (Windows)

If it is the wrong version or missing, install a current Python from python.org. On Windows, tick "Add python.exe to PATH" in the installer.

The ReDySim Fixed-base and Floating-base download holds both simulators, fixed-base and floating-base, and installs both in one step. Unpack it and open a terminal in the unpacked folder (the one that contains install.sh).

Windows (PowerShell)

powershell -ExecutionPolicy Bypass -File install.ps1

The script makes a virtual environment (.venv) and installs both simulators. To activate the environment in a new terminal, run .venv\Scripts\Activate.ps1; if that says that running scripts is disabled, run this once and try again:

Set-ExecutionPolicy -Scope Process RemoteSigned

Ubuntu

sudo apt install python3-venv python3-tk
sh install.sh

The script makes a virtual environment (.venv) and installs both simulators. To activate it in a new terminal, run source .venv/bin/activate.

By hand, in an active virtual environment, the same is one line: pip install "./fixed_base[anim]" "./floating_base[anim]".

macOS (Apple Silicon, coming soon)

The macOS download is not available yet; these are the steps for when it is.

sh install.sh

The script makes a virtual environment (.venv) and installs both simulators. To activate it in a new terminal, run source .venv/bin/activate. Python 3.10 or newer is needed; if python3 --version is older or missing, install it from python.org.

Installing takes a few minutes. The word (.venv) appears at the start of your terminal line when the environment is active. Every time you open a new terminal, activate the environment again (the activation commands above) before using redysim-floating.

1.2 Check that it works

redysim-floating --version
redysim-floating --selftest
redysim-floating --list

--selftest runs a short simulation of each kind and prints All checks passed. It opens no window. --list shows the ready-made robots:

name robot
biped 7-link planar biped walking on the ground
quadruped 13-link quadruped, trotting
spot 13-link quadruped with the size and mass of the Boston Dynamics Spot, trotting
hexapod 13-link hexapod, tripod gait
space_robot 7-link planar robot floating in space: a heavy base with two 3-link arms (each hand can be given a position and an orientation)
wheel_legged 17-link quadruped with a driven wheel at each foot; slowly rolls forward, bends its knees slightly and straightens; both dynamics modes use the same motion
quadcopter one free rigid body with four ideal rotors; hovers, flies a square of waypoints and rejects a brief wind gust (forward dynamics only)
pioneer differential-drive robot of the size of a Pioneer 3-DX: two driven wheels and a caster; one Motion-tab wheel trajectory rolls it in a left curve in both dynamics modes
four_wheel_car four-wheel car with rear wheel speed control and front Ackermann steering; both dynamics modes use one Motion-tab path that drives straight, turns left, then stops
mobile_manipulator 20 kg Pioneer-size differential-drive base with a two-joint arm; both modes use one motion: drive forward, stop, then move the elbow-up arm to a second pose

1.3 Run a robot

The simplest way is the Runner (section 1.7). Its Help button opens the floating-base manual on the website. Pick a model, for example biped, and press Run:

redysim-floating --runner

The same run from the command line:

redysim-floating fordyn biped

This simulates the biped for 2 seconds. Plot windows and an animation window open; close them to finish. The results are also written to output/fordyn/biped/.

There are two kinds of simulation, chosen by the first word:

  • fordyn, forward dynamics. The leg joints are driven by motors that try to follow the walking motion. The program computes how the whole robot moves, including the body, which is free and pushed by the ground and by gravity.
  • invdyn, inverse dynamics. The joints are told to follow the walking motion exactly. The program computes the motor torques this needs, and how the body moves in response.
redysim-floating invdyn quadruped
redysim-floating fordyn hexapod
redysim-floating fordyn space_robot

Useful options:

option what it does
--runner open the Runner (see 1.7) instead of running from the command line
--time 1.0 simulate for 1 second instead of the default
--plots-only show only the plots, not the animation
--anim-only show only the animation
--save-anim walk.gif save the animation (.gif or .mp4)
--save-plots save the plots as PNG pictures in the output folder
--no-show open no windows
--out folder write the results to another folder

If there is no screen (a remote session, for example), no windows open: the plots are saved as plot1.png, plot2.png, ... in the output folder, and you can still use --save-anim.

1.4 What the plots show

Base motion. Four panels: the position of the body (X0, Y0, Z0; Y is up), its three angles, and their rates. A walking robot moves forward, and its height stays almost constant.

Joint motion. The angle of every leg joint and its rate. In the examples they repeat with every step.

Joint torques. The torque of every motor.

Energy balance. Top: Total and Potential energy. Bottom: the work of the motors (Actuators), the energy taken by the Ground and the Kinetic energy. The Total curve must be flat: it is the sum of all the energies, and it can only change if the simulation is inaccurate. This is the first check of any result.

Ground reaction forces. The horizontal and vertical force that the ground exerts on each leg link, and the total vertical force compared with the robot's weight. Over a walking cycle the average of the total vertical force equals the weight. The sharp peaks are the feet landing.

Animation. The robot walks over the ground (the grey frame); the red and blue legs are the two groups of legs that swing in turn. The robot is drawn from the data, so it shows exactly what was simulated. The space robot has no ground: its base turns and drifts when the arms move.

1.5 The result files

Results are written to output/fordyn/<name>/ or output/invdyn/<name>/, one row per output time:

file contents
timevar.dat time
statevar.dat body position and angles, joint values (angles; distances for sliding joints), then their rates, then the ground and motor energies
envar.dat potential, kinetic, motor, total and ground energy
tor.dat joint torques (inverse dynamics only)
base.dat time, body position and angles and their rates (inverse dynamics only)

They are plain text, so Excel, MATLAB, Python or any plotting program can read them.

1.6 When something goes wrong

  • Error: integration failed ... or became non-finite. The model is unstable or wrongly entered (for example a link with no mass). Try --time with a smaller value to see where it goes wrong, and check the numbers in your model file.
  • The Total energy is not flat. The numbers are too coarse. Open the model file and make rtol and atol under fordyn: smaller (for example 1.0e-7 and 1.0e-9).
  • No window appears. Your session has no screen; see the note under the options above.
  • The command is not found. The environment is not active; activate it again (section 1.1).

1.7 The Runner

If you would rather click than type, open the Runner:

redysim-floating --runner

The Runner showing the animation of a walking biped

The Runner uses the same colours as the ReDySim GUI. From top to bottom:

  • Header: the name, and the Dark mode / Light mode button (see below).
  • Model: pick one of the bundled models from the list, or press Open example… to open your own .yaml file. Choose Forward dynamics or Inverse dynamics, then press Run. The line under the buttons says how many bodies and steps the run has. A model file that has no section for the chosen kind shows an error message.
  • Example scripts: the Runner also lists the Python examples of Part 3 (in the Example script box at the bottom of the side bar). Pick one of the four example scripts, for instance multi_robot and press Run script: the script starts in its own process, an Example tab shows what it does and its printed output, and its figures and animation open in their own windows when it has computed. The scripts you run here are the ones installed with the package; to edit them, make your own copy with redysim-floating --copy-examples my_examples. Choosing a model removes the tab and brings back the choice of Forward dynamics, Inverse dynamics and Run: they are for models, and are greyed out while a script is chosen.
  • Show (left): tick which tabs you want. There is one tab for the animation and one for each plot: base motion, joint motion, joint torques, energy balance and, for a robot that stands on the ground, the ground reaction forces (the plots have the usual zoom and pan buttons).
  • Animation: it starts by itself. Pause holds it where it is and Play goes on; the slider jumps to any time. When it reaches the end the button reads Replay.
  • Save animation… writes a .gif or .mp4, and Save plots… writes the plots as PNG files into a folder you choose.

Dark mode / Light mode switches the colours of the window and of the plots, and keeps the tab, the frame and the plots you ticked. The Runner starts in light mode. The files you save are always on a white background, so they suit a report in either mode.

The same window in dark mode, showing the energy balance

Example scripts. The box at the bottom of the side bar lists the four scripts of the examples/ folder. Choosing one fills the window with an Example tab: what the script does, what opens, the files you can change and things to try, and under it the output of the script as it runs. Run script starts it in its own process: it computes first, and then its figures and an animation open in their own windows. Forward dynamics, Inverse dynamics and Run belong to the models and are greyed out while a script is chosen; choosing a model brings the tabs of the last run back.

The Example tab: the text of a script and its output

The Runner only runs and shows a model; to edit a robot, change the .yaml file (see Part 2). It is not the separately licensed ReDySim GUI, which has a model editor. The generalized Jacobian (gjm) is only available from the command line.