FrankaRemoteController (Server Mode)
Synchronous remote controller client for aiofranka.
Communicates with the aiofranka server process via shared memory (state reads) and ZMQ (commands). Drop-in replacement for FrankaController with a sync API.
- exception aiofranka.remote.ServerDiedError(server_error)[source]
Bases:
RuntimeErrorRaised when the server process dies (e.g. reflex error).
- Parameters:
server_error (str)
- server_error
The error message from the server (e.g. libfranka reflex details).
- class aiofranka.remote.FrankaRemoteController(robot_ip=None, *, home=True)[source]
Bases:
objectSynchronous remote controller for Franka robots.
Connects to a running aiofranka server process and provides the same API as FrankaController, but fully synchronous (no async/await needed).
The 1kHz control loop runs in the server process. This client sends commands via ZMQ and reads state from shared memory (zero-copy).
Examples
>>> controller = FrankaRemoteController() # default IP >>> controller.start() >>> controller.switch("impedance") >>> controller.set_freq(50) >>> for i in range(100): ... state = controller.state ... controller.set("q_desired", target) >>> controller.stop()
- start()[source]
Start the server subprocess and connect.
Spawns a 1kHz control loop in a child process, then connects to it via shared memory and ZMQ. The subprocess terminates automatically when this script exits.
The robot must already be unlocked with FCI active (via
aiofranka.unlock()or the Franka Desk web GUI). If not, the server subprocess will fail to start and a helpful error message is printed.- Raises:
RuntimeError – If the server fails to start.
- property initial_qpos: ndarray
Initial joint positions (7,) set at last switch() from shared memory.
- property initial_ee: ndarray
Initial end-effector pose (4,4) set at last switch() from shared memory.
- switch(controller_type)[source]
Switch control mode on the server (“impedance”, “pid”, “osc”, “torque”).
- Parameters:
controller_type (str)
- set_freq(freq)[source]
Set update frequency for rate-limited set() calls (Hz).
- Parameters:
freq (float)
- set(attr, value)[source]
Rate-limited setter for controller attributes.
Sends value to server and sleeps to maintain frequency from set_freq().
- Parameters:
attr (str) – “q_desired”, “ee_desired”, or “torque”
value – numpy array