Skip to main content
The RobotState descriptor gives you access to sensor data—camera images, odometry, maps, and more. Declared state is automatically updated at 50Hz while your skill runs.

Declaration

Declare state dependencies as class attributes:
The system injects and updates these values automatically. Always check for None on first access.

Available State

Camera Image

The main camera image as a base64-encoded JPEG:

Odometry

Where the robot is and how it is moving, as an innate.Odometry object. MARS is a differential-drive base on flat ground, so you get a flat 2D pose — x, y, and a yaw angle — directly, no quaternion math needed:
Always check for None on first access — the first odometry message is one publish period away when a skill starts.

Closing a loop on odometry

Declared state refreshes at 50 Hz while your skill runs, so you can read the attributes in a loop to close a control loop. This drives forward a fixed distance by watching position:
For heading, theta_degrees is already wrapped to (-180, 180]. Accumulate wrapped deltas so a turn across the ±180° seam still counts correctly:

Checking freshness

Use stamp (seconds) to skip a reading that has gone stale — for example after a feed hiccup, when the 50 Hz refresh would otherwise hand you a frozen value:

Need more than the 2D pose?

odom.raw carries the complete odometry message with rosbridge-style keys — the real quaternion, z, covariances, and the full twist — for skills doing their own filtering or fusion:
Skills written for 0.3.0 through 0.6.x read odometry as a raw-message dict (self.odom["theta_degrees"], self.odom["pose"]["pose"]["position"]). Dict-style access is kept as a permanent compatibility layer — those skills keep working with no scheduled removal. New skills should use the attributes above.

Map

The occupancy grid map:

Head Position

Current head tilt angle:

Example: CaptureImages

A skill that captures images while rotating:

Example: MonitorPosition

A skill that tracks robot movement: