Skip to content

2. The Python API

The Python API, package parol6, is two things: a controller process that owns the robot, talks to the control board over serial at 100 Hz, plans the motion and checks collisions; and a client library that sends it commands over UDP, from the same PC or any other on the network, with a blocking interface for scripts and an asynchronous one for applications. A dry-run client runs the same planning without a robot, for tests.

This chapter walks through it in the order you use it. The reference lists every method: Python API reference, read from the API's source at the version this site describes.

In this chapter

In three lines

from parol6 import RobotClient
with RobotClient() as rbt:            # the controller runs already: parol6-server --serial COM5
    rbt.home(wait=True); rbt.move_j([90, -90, 180, 0, 0, 180], speed=0.5)

Architecture

flowchart LR
    subgraph Client["Your program"]
        RC["RobotClient / AsyncRobotClient"]
        DR["DryRunRobotClient (no robot)"]
    end
    subgraph Controller["parol6-server"]
        UDP["UDP 5001: commands and queries"]
        Q["Command queue"]
        MP["Motion planner (subprocess)"]
        SP["Segment player, 100 Hz loop"]
        ST["Status broadcast (multicast, 50 Hz)"]
    end
    CB["Control board (serial, 3 Mbaud, 100 Hz)"]
    RC -- commands --> UDP --> Q --> MP --> SP --> CB
    CB -- telemetry --> SP --> ST -- status --> RC

The controller is the only process that touches the serial port. The planner runs in a subprocess so that a long plan never delays the 100 Hz loop; the loop plays the planned segments and streams the jog and servo targets. Status goes out as multicast, so any number of listeners see the robot's state without asking.

Comments


Found a mistake on this page? Edit it on GitHub · Report it · Get help · This page as Markdown · llms.txt · The whole manual as PDF