How to program your robot
This section contains information about how to program your MARRtino robot.
For programming the robot, you usually need to: 1) connect to the robot, 2) start basic nodes (modules), 3) write and run programs. These steps are described below.
1. Connection to the robot
Use the virtual machine to connect and program your robot. If you are familiar with ROS, you will find a typical ROS environment and you can use standard ROS tools. If you are using the Raspberry PI on the robot, just connect to it through
Using web interface
If you are not familiar with ROS, you can start ROS nodes from MARRtino web interface (see Network Configuration for more details):
- connect to MARRtino<XXX> access point (default password:
- open a browser to access http://10.3.1.1/bringup
- connect to the robot using the
- manage nodes to run on the robot
When using MARRtino VM, you can connect to http://localhost/bringup to start some ROS nodes in simulation mode.
2. Bringup robot nodes
The following components can be activated (either with ROS commands or through the web interface)
- Robot base / Simulator
- Laser sensors
To run programs in your robot, you must first launch the orazio ROS node.
$ cd src/marrtino_apps/robot
$ roslaunch robot.launch
To test your programs in a simulator, you can use the standard ROS 2D simulator Stage. Many tutorials are available about how to use it.
MARRtino ROS node is fully compatible with ROS stage. So code developed and running on Stage would run on MARRtino as well (just make sure the topics are correctly linked).
Stage folder in marrtino_apps shows an example of use of the simulator.
$ cd src/marrtino_apps/stage
$ roslaunch simrobot.launch
For some commands, you need to start nodes managing devices on the robot or functionalities.
The slides RoboCup@Home Education MARRtino guide provide more details on how to start nodes needed for using and programming the robot.
3 Programming the robot
There are several options to program your robot
1. Use a web interface to program the robot with command tiles, Blockly and Python.
2. Write Python programs
3. Write MATLAB programs
3.1 Web interface
Connect to the programming web interface and choose a programming method.
Program the robot as sequences of predefined commands
Use web interface to write and run Python programs with high-level MARRtino commands.
MARRtino high-level programming commands
p = get_robot_pose()
# range distance
d = obstacle_distance(deg=0)
s = asr()
img = get_image()
img = get_web_image(objcat=None)
n = face_detection(img)
label,conf = mobilenet_objrec(img)
b = marrtino_ok()
d = distance(p1,p2)
3.2 Programming with Python
Write and run Python programs
Move to marrtino_apps/program and follow instructions in
Note: skip the "Install" section.
Write a Python program
from robot_cmd import *
Run on local PC connected to the robot or simulator
$ python robot_program_1.py
Run in client/server mode
Server on the robot
$ ./robot_program_server.py 5000
Send program as a string with TCP (e.g., ./robot_program_client.py)