Skip to content

Getting Started

First install RoSys with pip or Docker. Then create a directory to host your code and put it under version control. Name your entry file and add the following content:

#!/usr/bin/env python3
from nicegui import ui

import rosys

# setup
shape = rosys.geometry.Prism.default_robot_shape()
rosys.hardware.SerialCommunication.search_paths = ['/dev/ttyUSB0']
is_real = rosys.hardware.SerialCommunication.is_possible()
if is_real:
    communication = rosys.hardware.SerialCommunication()
    robot_brain = rosys.hardware.RobotBrain(communication)
    can = rosys.hardware.CanHardware(robot_brain)
    wheels = rosys.hardware.WheelsHardware(robot_brain,
    robot = rosys.hardware.RobotHardware([can, wheels], robot_brain)
    wheels = rosys.hardware.WheelsSimulation()
    robot = rosys.hardware.RobotSimulation([wheels])
odometer = rosys.driving.Odometer(wheels)
steerer = rosys.driving.Steerer(wheels)

# ui
with ui.scene():
    rosys.driving.robot_object(shape, odometer)
ui.label('hold SHIFT to steer with the keyboard arrow keys')
if is_real:
    ui.button('configure microcontroller', on_click=robot.configure).props('outline')

# start'RoSys')

If you launch the program, your browser will open the url and present a 3d view:




The user interface is built with NiceGUI. The individual RoSys modules come in packages driving, geometry, hardware and others.


In this example we create a Steerer which needs an Odometer. Here we work without real hardware, so two wheels are simulated. Please see Hardware for an example which can actually be used on a mobile robot. For visualization purposes we also need the approximate robot shape.

User Interface

The user interface consists of keyboard control with access to the steerer as well as a 3D view of the scene. The latter only contains the RobotObject with the given shape. The robot pose is constantly updated from the odometer. See NiceGUI for more details about its API.


NiceGUI provides a command which launches the web server and opens the corresponding web application. If you modify the code, a reload is triggered automatically. This is very convenient, but can be deactivated by passing reload=False.