Ringfour SDK · Open source

from ringfour import Robot

Different robots.
A familiar interface.

A robot profile maps ROS 2 interfaces to the capabilities your application uses. Topic names and hardware configuration live in YAML. Your Python code can be reused wherever a profile provides the capabilities and behavior it needs.

Explore robot profiles →

Camera frames

Read a color frame from the camera named base. Its pixels arrive as a NumPy array.

Robot profile · YAML
cameras:
  base:
    rgb: /camera/color/image_raw
    info: /camera/color/camera_info
Your application · Python
camera = robot.cameras["base"]
frame = camera.get_frame()
image = frame.image

Map and pose

Read the occupancy grid from SLAM Toolbox and locate the robot in the map frame.

Robot profile · YAML
slam:
  backend: slam_toolbox
  map_dir: /var/lib/robocore/maps
Your application · Python
grid = robot.get_map()
pose = robot.get_pose()

Base velocity

Odometry tells you how fast the base is moving forward (m/s) and turning (rad/s).

Robot profile · YAML
mobility:
  locomotion: differential
  cmd_vel: /cmd_vel_agent
  cmd_vel_stamped: true
  odom_topic: /odom
Your application · Python
velocity = robot.get_velocity()
forward = velocity.linear.x
turn = velocity.angular.z

Arm kinematics

Read the joint positions, then solve for a target wrist pose in the model’s root frame. The profile leaves rotation about z unconstrained.

Robot profile · YAML
joint_states: /joint_states
groups:
  arm:
    kind: arm
    tip: wrist_flange
    dof_mask: [1, 1, 1, 1, 1, 0]
Your application · Python
from ringfour import kinematics as kin

arm = robot.arms["arm"]
positions = arm.get_joint_positions()
solution = kin.ik(arm, target_pose)

Keep the stack you already have.

Connect to your ROS 2 stack.

Your drivers and controllers keep doing their jobs. The Ringfour Agent connects their ROS 2 interfaces to your Python application through the robot profile.

Run Python on your workstation or on the robot. The SDK and Agent work locally without a Studio account.

How Ringfour works with ROS 2 →
How the Python app reaches the robot stack
  1. Python applicationRingfour SDK
  2. WebSocket or local Unix socket
  3. Ringfour AgentLoads the robot profile
  4. ROS 2 topics, services and actions
  5. Existing robot stackDrivers and controllers

Intelligence, meet machinery.

Connect model predictions to robot coordinates and controlled motion. Setup and application adapters are included in the complete examples.

Detect, locate, and move

  • Detect a pixel and deproject it into the arm’s root frame.
  • Solve IK, check sampled configurations for self-collision, and execute the approach.
  • Application helpers provide detection, tool approach, and path sampling.
Complete Python example →
Python · excerpt
frame, _ = camera.get_synced()
pixel = detect_pixel(frame.image, "cup")
point = camera.deproject(pixel, frame, in_frame=kin.fk(arm).frame)
waypoints = [
    arm.configuration(arm.get_joint_positions()),
    kin.ik(arm, wrist_approach(point)),
]
for q in sample_joint_path(waypoints):
    if kin.collisions(arm, q=q):
        raise RuntimeError("Approach intersects the robot")
path = JointTrajectory.from_waypoints(waypoints, step_duration=2.0)
with arm.control() as control:
    control.run(path)

From “there” to a position on the map.

  • Ask Gemma for the door’s pixel coordinates.
  • Deproject with the original capture’s depth and camera transform, even after the robot moves.
  • The complete example includes image encoding and response, bounds, and depth validation.
Complete Python example →
Python · excerpt
frame, _ = camera.get_synced()
reply = chat(model="gemma3:4b", format="json", messages=[{
    "role": "user",
    "content": 'Find the door centre. Return {"x": int, "y": int} in pixels.',
    "images": [image_to_jpeg(frame.image)],
}])
pixel = json.loads(reply.message.content)
door = camera.deproject(
    (pixel["x"], pixel["y"]), frame, in_frame="@map",
)

Run a learned policy

  • Turn ACT predictions into named joint targets.
  • Check sampled configurations before executing each trajectory inside an Agent guard.
  • Application adapters handle checkpoint preprocessing, joint units, path sampling, and task completion.
Complete Python example →
Python · excerpt
battery = robot.signals.battery.level
with robot.guard(battery.below(10., max_age=1.)):
    with arm.control() as control:
        while task_running():
            observation = observe(camera, arm)
            with torch.inference_mode():
                chunk = policy.predict_action_chunk(observation)
            waypoints = [arm.configuration(arm.get_joint_positions())]
            waypoints += [
                arm.configuration(q) for q in decode_actions(chunk)
            ]
            for q in sample_joint_path(waypoints):
                if kin.collisions(arm, q=q):
                    raise RuntimeError("Chunk intersects the robot")
            path = JointTrajectory.from_waypoints(
                waypoints, step_duration=0.1,
            )
            control.run(path)

The parts you usually write yourself.

A model picks a pixel. By the time it answers, the camera has moved. Ringfour can still place that pixel in the map using the original capture. The same SDK lets you test an arm pose or follow a moving robot one update at a time.

Put a pixel on the map

Pick a pixel with a valid depth return. Ringfour uses that capture’s depth, intrinsics, and saved camera-to-map transform, even if the robot has since moved. Use the frame before its handle expires.

frame, depth = camera.get_synced()
point = camera.deproject(
    (u, v), frame, in_frame="@map"
)

Require fresh feedback

Give a pose read a freshness budget. Get the pose and its timing evidence, or a typed error when usable feedback never arrives.

sample = robot.get_pose_measurement(
    max_age=0.5, timeout=1.0
)

Check self-collision

Find overlapping link pairs at a proposed configuration. The query covers the robot geometry represented in its collision model.

pairs = kin.collisions(arm, q=joints)

Iterate through navigation

Start a goal once. The iterator yields progress as the robot drives, and the result includes its measured final pose. Breaking out of the loop ends observation. Leaving the operation scope cleans up unfinished motion.

with robot.start_navigation(goal) as op:
    for update in op.updates():
        print(update.state, update.progress)
    arrival = op.result()
Explore more SDK capabilities

Perception and state

Stream camera frames

A Python generator yields RGB frames at up to the requested rate. The Agent handles the subscription. Closing the generator releases the stream.

for frame in camera.stream(fps=5):
    print(frame.stamp, frame.image.shape)

Look up a past pose

Ask where the camera was when it took a picture. The lookup uses the timestamp against the robot’s available transform history.

pose = robot.tf.pose_of(
    camera_frame, "@map", stamp=frame.stamp
)

Downsample a point cloud

Turn a depth frame into XYZ points with two-centimetre voxels. Set the spatial resolution before sending the array to your application.

cloud = camera.get_cloud(voxel=0.02)
points = cloud.points

Arm geometry

Predict a wrist pose

Forward kinematics gives the wrist pose in the model’s root frame for a proposed vector of joint positions.

pose = kin.fk(arm, q=joints)

Solve inverse kinematics

Give the solver a wrist pose in the root frame. It returns a named joint configuration under the profile’s axis constraints, or raises Unreachable.

solution = kin.ik(arm, target_pose)

Look up sampled reach

A recorded reach map lets you screen candidate tip positions with a voxel lookup. An empty cell means that position was never sampled. Use IK to check a specific orientation.

reach = kin.reach_map(arm)
if reach is not None:
    seen = reach.can_reach((x, y, z))

Navigation and motion

Follow a whole route

Pass a sequence of framed poses. The Agent keeps ownership of the mobile base and checks arrival and rest at each waypoint before advancing.

result = robot.run_route(waypoints)

Execute timed joint targets

Execute named targets in an open control session. Ringfour checks model identity and joint bounds and reports the measured endpoint for each joint.

path = JointTrajectory.from_waypoints(
    configurations, step_duration=0.5
)
result = control.run(path)
Explore the SDK reference →

Give the operator a view.

Operate Apps in Studio.

Configure an installed App, start or stop a run, and inspect its logs, files and Logbook. Apps can request human decisions through the Platform runtime.

Explore the operator workflow →

When motion stops.

A cancellation receipt tells you the Agent received the request. To verify that a robot has come to rest, the Agent needs fresh measurements that stay within the configured limits.

See a safety guard in Python →

Who can move the robot?

The Agent checks motion permission, the operator e-stop, and resource ownership. A second client cannot take over an arm while another client owns its motion.

What trips a guard?

A battery guard can require at least 10% charge and a reading no more than one second old. Crossing the threshold or losing fresh feedback latches the guard, blocks new motion, and starts stopping active work.

What if commands go quiet?

A teleop watchdog halts the base when velocity commands stop arriving within the granted interval. If the application disconnects, the Agent stops and cleans up the motion that client owned.

How is rest verified?

For an arm, each joint must stay within its configured velocity limit for the required dwell time. The Agent checks both reported speed and changes in measured position. Repeated copies of one sample cannot satisfy the check.

What if verification fails?

Further motion is blocked when cleanup cannot be verified. The Agent keeps that inhibit in place for recovery. Restarting the application does not clear it.

When can the task resume?

Resetting a tripped application guard requires fresh feedback inside its limits. The e-stop and any other inhibits still apply. Once motion is permitted, the application must submit a new operation.