Skip to content

API reference

The public MARLIN API is imported from the marlin package:

from marlin import (
    Button,
    Controller,
    Effector,
    IMU,
    ImuReading,
    Joystick,
    RadioBeacon,
    RadioBeaconReading,
    Reading,
    Robot,
    Sensor,
    Servo,
    Thruster,
)

These pages are written in Python terms: classes, methods, attributes, and arguments. If those words are unfamiliar, read Python basics first, then come back.

How to read a signature

Reference pages start each method with a signature: a summary of what the method takes and gives back. A signature is not code you type.

servo.angle(deg: float) -> None
Part Meaning
deg The name of the input
: float The input is a decimal number
-> None The method gives nothing back

You write the call, not the signature:

robot.servo("M2").angle(90)

The names you may meet after the : are int (whole number), float (decimal number), str (text), bool (True or False), and None (nothing). A | between two of them means either is allowed.

Reference pages

Area Public symbols
Robot Robot
Controller input Controller, Joystick, Button
Sensors and readings Sensor, Reading, IMU, ImuReading, RadioBeacon, RadioBeaconReading
Effectors Effector, Thruster, Servo

Anything not listed above is an implementation detail and may change between releases.

Some constructors show a state_mirror parameter. The library uses state_mirror internally to share live data. You never set this parameter.

Normal entry point

Most programs need only Robot and the sensor and effector type tokens passed to configure(). The base classes are an advanced part of the public surface.