Skip to main content
Version: 3.0.0

orca-client

orca-client is a small program you run on the computer your instruments are wired to. It opens one outbound WebSocket to the Orca daemon. The daemon tells it which devices to run. It builds a driver for each one, runs the commands the daemon sends, and sends each answer back on the same connection.

A SIM run and a LIVE run send every device command through an orca-client. Only a check run works without one. If you are running the quickstart as a check run, skip this page.

  Lab PC
+----------------------------------------------------------+
| shaker (serial) |
| arm (TCP) Orca daemon |
| liquid handler (USB) 127.0.0.1:<port> |
| | ^ |
| v | |
| orca-client ------ ws://127.0.0.1/ws/devices -------+
+----------------------------------------------------------+

The daemon listens on 127.0.0.1 only and has no authentication. Run orca-client on the same computer as the daemon.

Install​

orca-client is not on PyPI, so install it from a clone. Python 3.10 or newer. Use a new virtual environment, separate from the one Orca is in.

git clone --branch v2.0.0 https://github.com/Cheshire-Labs/orca-client.git
cd orca-client
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # Linux, macOS
pip install -e .

This is orca-client 2.0.0, the release that goes with Orca 3.0.0. pip also installs cheshire-drivers v2.0.0 from GitHub. It holds the driver classes and the protocol orca-client and the daemon use to talk. The three are released together and must be installed together: an orca-client from another release is refused when it connects.

Configure orca-client​

orca-client reads one JSON file. It defaults to config.json in the working directory, and --config points it somewhere else.

{
"client_id": "local",
"site": "boston",
"lab": "molbio",
"platform": {
"url": "ws://127.0.0.1:8765/ws/devices",
"api_key": "local"
}
}
FieldMeaning
client_idThe name of this orca-client. It decides which devices this computer runs: a device goes to the client whose client_id equals client in the device's setup file. The daemon's default client is local.
site, labLabels for where this computer is. Required.
workcellOptional label.
platform.urlThe daemon's device WebSocket: ws://127.0.0.1:<port>/ws/devices. Start the daemon on a fixed port with orca start --port 8765.
platform.api_keyRequired by the file format. The daemon accepts any value.
platform.reconnect_backoffSeconds to wait before each redial. Default [1, 2, 4, 8, 16, 30]; the last value repeats.
platform.heartbeat_intervalSeconds between heartbeats. Default 30, which is also the most allowed: a longer value is refused at start. The daemon calls a client offline after 90 seconds with no heartbeat. ORCA_CLIENT_HEARTBEAT_INTERVAL sets it when the file does not.
machinePrograms and folders on this computer. See below.

${VAR} in platform.url and platform.api_key is replaced from the environment.

The file does not list devices. A config.json with a devices key is refused at start, with a message that says where devices go now.

The machine block​

Paths on the lab PC stay in config.json, under machine. The daemon never sends a program path, so it cannot choose what this computer starts.

{
"machine": {
"venus_exe_path": "C:\\Program Files (x86)\\HAMILTON\\Bin\\HxRun.exe",
"venus_methods_folder": "C:\\Program Files (x86)\\HAMILTON\\Methods"
}
}

Those two values are the defaults. machine.opentrons_sim says where a vendor Opentrons simulator is, with interpreter, cwd and config_folder.

Set up each device​

Devices are declared in the package's topology.py. How each one is driven is in the package too, in devices/<name>.json, where <name> is the device's name in the topology. The file is optional.

A device with no file runs its simulator on the default client, local. So one orca-client with "client_id": "local" simulates a whole lab with no setup files at all.

A real instrument needs a file:

{
"client": "local",
"real": {
"type": "plr",
"backend": "PreciseFlex",
"connection": { "type": "tcp", "host": "192.168.1.100" }
}
}
FieldMeaning
clientThe client_id of the orca-client that runs this device. Left out, it is the daemon's default client.
realThe real driver. Left out, the device can only be simulated.
real.typeplr (a PyLabRobot backend), venus (a Hamilton VENUS method runner, see Venus) or human (a person, see Transporters).
real.backendFor plr: a PyLabRobot backend class, or a device name Orca maps to one. Required for plr.
real.connectionFor plr. One of the three shapes below.
real.venusFor venus: the method files to run on each event.
simSettings for the simulator: channels (1, 8 or 96), faults, and use_vendor_sim with simulator_config.
always_simtrue means this device never drives hardware.
armFor an arm: the gripper fitted to it, which its controller cannot report.

A connection is one of:

{ "type": "tcp", "host": "192.168.1.100", "port": 10100 }
{ "type": "serial", "port": "COM3" }
{ "type": "usb", "serial_number": "ABC123" }

port is optional for tcp; without it the driver's default port is used. usb takes serial_number, device_address or device_id; with none, the first matching instrument found is used.

An unknown field is refused. A bad file is refused with the file, the field and the reason.

Read and replace a setup file through the daemon:

orca device setup shaker
orca device write-setup shaker ./shaker.json --reason "moved to COM4"

A changed setup file takes effect on the next orca runtime reload.

A file tells Orca how to reach the real instrument. It does not switch the device to it. A new device starts as sim, and orca device mode <name> LIVE switches it. See Sim or live, per device.

The daemon's default client name comes from the ORCA_DEFAULT_CLIENT environment variable. Unset, it is local.

Run it​

Start the daemon and mount the package first, in the Orca environment:

orca start --port 8765
orca topology mount

Then, in the orca-client environment:

python -m orca_client --config config.json
FlagEffect
--config, -cConfig file path. Defaults to ./config.json.
--env, -eLoad this .env file before reading the config.
--verbose, -vDebug logging.
--versionPrint the version and exit.

The order does not matter. orca-client connects and says who it is. The daemon sends it the devices its client_id runs, and sends them again after every orca topology mount and orca runtime reload. orca-client builds the drivers and reports what it built.

Devices are not initialized when orca-client connects. A SIM or LIVE run brings every device up when it starts, and orca device connect and orca device initialize do it by hand.

A person who moves plates is set up with "real": {"type": "human"}. In LIVE, orca-client prompts in its terminal at each pick and place, so run it in a terminal you can type into.

Confirm the devices connected​

orca device list

The columns are name, kind, client, device, link, initialized, busy, holding and fault.

  • client: the device's orca-client is connected.
  • device: the driver's connection to the instrument is open. This can be false while client is true.
  • initialized: the device has been brought up.

orca device registry show <name> prints everything Orca knows about one device. orca device info <name> --capabilities lists the commands it takes, with each command's parameters.

If a run is refused with devices_not_ready, the message names each device and why.

Advanced​

Protocol version​

orca-client and the daemon both take their wire protocol from cheshire-drivers. This release speaks version 1.8.0. orca-client sends its version when it connects, and the daemon checks it before anything else.

A mismatch is refused at once: the daemon closes the socket with code 1002. There is no compatibility window, so orca-client and the daemon must come from the same release.

Reconnecting​

A dropped connection is retried automatically. Before each redial orca-client waits the next value in platform.reconnect_backoff, and repeats the last value once it runs out.

orca-client stops instead of redialing when the daemon closes the socket with code 1002 or 1008. A retry cannot fix those: the protocol version does not match, or the connection was refused.

A second orca-client that connects with a client_id already in use is closed with code 4409. Two programs driving one set of instruments is a mistake. Stop the first, then start the replacement.

A command that was in flight when the connection dropped is never sent again after the reconnect. The thread that sent it pauses, so a person can look at the instrument and decide. See Recovery.

Taking a device by hand​

To drive an instrument yourself while a workflow is running, take it out of the workflow's reach with orca device take-control <name> and give it back with orca device release-control <name>. See CLI: control.

See also​