rti_connect¶
Runs at once IDLE or RTI or SOFT_RTI mode Enabled Homed Takes control
Pair this PC with the robot and switch to a real-time mode. The robot then sends its state to pc_ip every 4 ms tick and accepts real-time commands only from that address. It switches from IDLE mode to a real-time mode and holds the arm still where it is. Nothing moves, and no command is applied, until rti_claim(). RTIClient.connect() calls this for you and opens the link.
rate_hz picks the contract. Without it the robot enters RTI mode, hard real time: your PC sends one target per tick over UDP, each with its send time, and the robot replays your position targets one tick behind; it stops when no command comes for 40 ms. With it the robot enters SOFT_RTI mode: you send joint position targets at your own rate, the robot fills in the ticks between them, and it stops when three of your intervals pass without one.
Each call sets the session's contract again: the command timeout, the servo generator, the minimum duration and the dynamics feedforward, and in RTI mode the pace limit and the state rate too. It also switches the rate limiter, the start-pose check and real-time gravity compensation on, and sets the tool speed cap back to its start value: a session never inherits them from an earlier one. The other real-time settings keep their values. Without pc_ip, a client that is not connected raises RuntimeError and sends nothing.
Syntax¶
Arguments¶
| Name | Type | Default | Description |
|---|---|---|---|
pc_ip |
str | None |
None |
The IPv4 address the robot sends its state to and accepts commands from. None uses this connection's own address on the route to the robot. |
wait |
bool | None |
None |
Wait until the robot reports the real-time mode, up to 10 s: RTI without rate_hz, SOFT_RTI with it. None follows the client's sync setting. |
rate_hz |
float | None |
None |
Your command rate in Hz, for SOFT_RTI; None for RTI mode. It sets the command timeout to three of your intervals, at most 1 s. Prefer a rate that divides 250 Hz evenly: 125, 50, 25 or 10 Hz. Zero, a negative or a non-finite rate is refused. |
transport |
str | None |
None |
"udp" or "tcp"; None means "udp". With "tcp" the robot waits for your PC to dial its port 30003 from pc_ip, and one stream carries both directions (RTIClient dials it). SOFT_RTI only: without rate_hz the robot uses UDP. |
Returns¶
Nothing.
Examples¶
robot.rti_connect(rate_hz=50, wait=True)
robot.latest_status()["mode"]
robot.rti_disconnect(wait=True)
Usage restrictions 6 codes
This command runs at once; it is not queued. The robot accepts it only when it is in IDLE or RTI or SOFT_RTI mode, enabled and homed, from the client that holds control or when no client does.
It answers with one of these codes when it does not carry the command out:
- [6010] Command not allowed now — a PC drives the arm (a claim is active):
rti_release()first; a session still stopping is waited for, up to 2 s. Or the robot is in the other real-time mode:rti_disconnect()first - [6101] Control held by another client — another client holds control; the message names it
- [6003] Invalid arguments —
pc_ipis not an IPv4 address,rate_hzis not above 0,transportis not"udp"or"tcp", or the message did not carry exactly three values - [6025] RTI not running or not answering — rTI did not answer within 1 s: it is not running or not responding. The command may still have taken effect
- [6014] Mode change refused — rTI refused RTI / SOFT_RTI mode: an error is latched, or the arm is not enabled or not homed. The message says why
- [6026] Refused by RTI — the message reached RTI without your PC's address. The message says why
In Python, a code above raises CommandRejected; its number is the code. The call raises:
CommandRejected: The robot refused it: it is not in IDLE mode or in the real-time mode asked for, a PC drives the arm or its session did not stop within 2 s, a value is invalid, it is not enabled or not homed, or another client holds control. Or RTI refused it or did not answer within 1 s (Errors:).RobotTimeout: The robot did not answer within 5 s, or, withwait, did not report the mode within 10 s.RobotConnectionError: The client is not connected.ValueError:transportis neither"udp"nor"tcp", orrate_hzis not a number. Nothing is sent.TypeError:rate_hzis not a number. Nothing is sent.
If the connection drops while the call waits for the robot's answer, it raises CommandRejected with the code CONNECTION_LOST (DISCONNECTED after disconnect()); while it waits for the robot's status, RobotConnectionError.
Like every immediate command, it also answers BAD_ARGS when a raw client sends a value the robot cannot read at all, and INTERNAL when it fails inside the robot.