garmi_parti.teleoperation package

Submodules

garmi_parti.teleoperation.client module

Networking teleoperation module for the client side.

class garmi_parti.teleoperation.client.Client(teleoperator, host, port)

Bases: object

Network client that connects a teleoperator input device (leader) to a teleoperated robot (follower).

Parameters:
close(end_effector='')

Sends a request to close an end-effector.

Parameters:

end_effector (str)

Return type:

None

open(end_effector='')

Sends a request to open an end-effector.

Parameters:

end_effector (str)

Return type:

None

pause(end_effector='')

Pause the teleoperation service.

Parameters:

end_effector (str)

Return type:

None

reset()

Reset teleoperation client.

Return type:

None

shutdown()

Shutdown the teleoperation network client.

Return type:

None

unpause(end_effector='')

Unpause the teleoperation service. Triggers synchronization events of the teleoperator interfaces before continuing teleoperation.

Parameters:

end_effector (str)

Return type:

None

garmi_parti.teleoperation.client.user_interface(cli)

Waits for the user to press enter to quit. The user can also reset the teleoperator by entering r and pressing enter.

Parameters:

cli (Client)

Return type:

None

garmi_parti.teleoperation.containers module

Container dataclasses for robot and teleoperation entities.

class garmi_parti.teleoperation.containers.Displacement(linear=<factory>, angular=<factory>)

Bases: object

Container holding a relative pose, i.e. SE3 displacement.

Parameters:
  • linear (ndarray)

  • angular (Rotation)

angular: Rotation
linear: ndarray
class garmi_parti.teleoperation.containers.JointPositions(positions)

Bases: object

Joint positions container.

Parameters:

positions (ndarray)

positions: ndarray
class garmi_parti.teleoperation.containers.JointStates(q, dq, tau_ext)

Bases: object

Joint state container.

Parameters:
dq: JointVelocities
classmethod from_state(state)

Construct a joint states container from a libfranka robot state.

Parameters:

state (RobotState)

Return type:

JointStates

q: JointPositions
tau_ext: JointTorques
class garmi_parti.teleoperation.containers.JointTorques(torques)

Bases: object

Joint torques container.

Parameters:

torques (ndarray)

torques: ndarray
class garmi_parti.teleoperation.containers.JointVelocities(velocites)

Bases: object

Joint velocities container.

Parameters:

velocites (ndarray)

velocites: ndarray
class garmi_parti.teleoperation.containers.Pose(position=<factory>, orientation=<factory>)

Bases: object

Pose container.

Parameters:
  • position (ndarray)

  • orientation (Rotation)

orientation: Rotation
position: ndarray
class garmi_parti.teleoperation.containers.TeleopContainer(arm, gripper, controller=None, params=<factory>, position_init=<factory>, orientation_init=<factory>, orientation_init_inv=<factory>, transform=<factory>, transform_inv=<factory>)

Bases: object

Container utility class for multi-arm teleoperation.

Parameters:
  • arm (Panda)

  • gripper (Gripper)

  • controller (Optional[TorqueController])

  • params (TeleopParams)

  • position_init (ndarray)

  • orientation_init (Rotation)

  • orientation_init_inv (Rotation)

  • transform (Rotation)

  • transform_inv (Rotation)

arm: Panda
controller: TorqueController = None
get_rotation()

Get a scipy.spatial.tr.Rotation from the robot’s current end effector orientation.

Returns:

Unit quaternion representing the

the robot end effector’s orientation.

Return type:

scipy.spatial.tr.Rotation

gripper: Gripper
orientation_init: Rotation
orientation_init_inv: Rotation
params: TeleopParams
position_init: ndarray
reinitialize()

Reinitialize the reference pose to the current robot pose.

Return type:

None

transform: Rotation
transform_inv: Rotation
class garmi_parti.teleoperation.containers.TeleopParams(hostname, transform=<factory>, q_idle=None, q_teleop=None, lock_translation=False, lock_rotation=False, stiffness=<factory>, damping=<factory>, linear_stiffness=400, angular_stiffness=20, nullspace_stiffness=0.5, damping_ratio=1.0, filter_coeff=1.0, gain_force=0.4, gain_torque=0.0, gain_joint_torque=0.8, speed_factor=0.2, gain_drift=8.0)

Bases: object

Parameters for a teleoperator.

Parameters:
angular_stiffness: float = 20
damping: ndarray
damping_ratio: float = 1.0
filter_coeff: float = 1.0
gain_drift: float = 8.0
gain_force: float = 0.4
gain_joint_torque: float = 0.8
gain_torque: float = 0.0
hostname: str
linear_stiffness: float = 400
lock_rotation: bool = False
lock_translation: bool = False
nullspace_stiffness: float = 0.5
q_idle: JointPositions | None = None
q_teleop: JointPositions | None = None
speed_factor: float = 0.2
stiffness: ndarray
transform: Rotation
class garmi_parti.teleoperation.containers.TwoArmContainer(left, right)

Bases: ABC, Generic[T]

Abstract base class for two-arm containers.

Parameters:
left: TypeVar(T)
right: TypeVar(T)
class garmi_parti.teleoperation.containers.TwoArmDisplacement(left, right)

Bases: TwoArmContainer[Displacement]

Two-arm displacement container.

Parameters:
class garmi_parti.teleoperation.containers.TwoArmJointPositions(left, right)

Bases: TwoArmContainer[JointPositions | None]

Two-arm joint positions container.

Parameters:
class garmi_parti.teleoperation.containers.TwoArmJointStates(left, right)

Bases: TwoArmContainer[JointStates | None]

Two-arm joint states container.

Parameters:
class garmi_parti.teleoperation.containers.TwoArmJointTorques(left, right)

Bases: TwoArmContainer[JointTorques]

Two-arm joint torques container.

Parameters:
class garmi_parti.teleoperation.containers.TwoArmJointVelocities(left, right)

Bases: TwoArmContainer[JointVelocities | None]

Two-arm joint positions container.

Parameters:
class garmi_parti.teleoperation.containers.TwoArmPose(left, right)

Bases: TwoArmContainer[Pose]

Two-arm pose container.

Parameters:
class garmi_parti.teleoperation.containers.TwoArmTeleopContainer(left, right)

Bases: TwoArmContainer[TeleopContainer]

Two arm teleoperation container.

Parameters:
class garmi_parti.teleoperation.containers.TwoArmWrench(left, right)

Bases: TwoArmContainer[Wrench]

Two-arm wrench container.

Parameters:
class garmi_parti.teleoperation.containers.Wrench(force, torque)

Bases: object

Wrench container.

Parameters:
  • force (ndarray)

  • torque (ndarray)

force: ndarray
torque: ndarray

garmi_parti.teleoperation.interfaces module

This module defines interfaces for teleoperation. These include the most generic Interface class but also more device specific interfaces such as PandaInterface etc. The Interface class defines the interface as used by the networking modules, by implementing the abstract methods, you will have a teleoperator compatible with the garmi_parti.teleoperation module. Implementations of these interfaces are generally referred to as teleoperators. We think of server-side teleoperators as followers and client-side teleoperators as leaders.

class garmi_parti.teleoperation.interfaces.Interface

Bases: ABC

General teleoperator interface definition.

abstract close(end_effector='')

This method is called by server (followers) and requested via network from clients (leaders). Use this method to close end effectors specified by end_effector. Refer to garmi_parti.teleoperation.client.close for the network call. :type end_effector: str :param end_effector: End effector name

Return type:

None

abstract get_command()

Get the command to be sent over the network.

Return type:

bytes

abstract get_sync_command()

Called by teleoperation clients to be sent to the server for synchronization. This call happens after a connection is established but before teleoperation starts, i.e. between the pre_teleop and start_teleop hooks.

Return type:

bytes

abstract open(end_effector='')

This method is called by server (followers) and requested via network from clients (leaders). Use this method to open end effectors specified by end_effector. Refer to garmi_parti.teleoperation.client.open for the network call. :type end_effector: str :param end_effector: End effector name

Return type:

None

abstract pause(end_effector='')

Executed when a pause was requested.

Parameters:

end_effector (str)

Return type:

None

abstract post_teleop()

Executed after teleoperation has finished.

Return type:

bool

abstract pre_teleop()

Executed after connection has been established but before teleoperation.

Return type:

bool

abstract set_command(command)

Called when a new command has been received over the network.

Parameters:

command (bytes) – Received command

Return type:

None

abstract set_sync_command(command, end_effector='')

Called by the network server. The command argument of this method is generated by get_sync_command on the client side. Use this mechanism to synchronize teleoperators before teleoperation begins.

Parameters:
  • command (bytes) – Received synchronization command

  • end_effector (str)

Return type:

None

abstract start_teleop()

Executed after pre_teleop was executed on both ends.

Return type:

None

abstract unpause(end_effector='')

Executed when an unpause was requested.

Parameters:

end_effector (str)

Return type:

None

class garmi_parti.teleoperation.interfaces.PandaInterface(params, has_gripper=False)

Bases: Interface, ABC

Generic teleoperation interface for Panda robots.

Parameters:
close(end_effector='')

This method is called by server (followers) and requested via network from clients (leaders). Use this method to close end effectors specified by end_effector. Refer to garmi_parti.teleoperation.client.close for the network call. :type end_effector: str :param end_effector: End effector name

Return type:

None

fdir(container)

Fault detection, isolation, and recovery.

Parameters:

container (TeleopContainer)

Return type:

None

get_sync_command()

Called by teleoperation clients to be sent to the server for synchronization. This call happens after a connection is established but before teleoperation starts, i.e. between the pre_teleop and start_teleop hooks.

Return type:

bytes

init_gripper(hostname, has_gripper)

Connect to the hardware and initialize gripper.

Parameters:
  • hostname (str)

  • has_gripper (bool)

Return type:

Gripper

move_arm(joint_positions)

Move the robot arm into the given joint positions.

Parameters:

joint_positions (JointPositions | None)

Return type:

None

open(end_effector='')

This method is called by server (followers) and requested via network from clients (leaders). Use this method to open end effectors specified by end_effector. Refer to garmi_parti.teleoperation.client.open for the network call. :type end_effector: str :param end_effector: End effector name

Return type:

None

post_teleop()

Executed after teleoperation has finished.

Return type:

bool

pre_teleop()

Executed after connection has been established but before teleoperation.

Return type:

bool

set_sync_command(command, end_effector='')

Called by the network server. The command argument of this method is generated by get_sync_command on the client side. Use this mechanism to synchronize teleoperators before teleoperation begins.

Parameters:
  • command (bytes) – Received synchronization command

  • end_effector (str)

Return type:

None

start_teleop()

Executed after pre_teleop was executed on both ends.

Return type:

None

class garmi_parti.teleoperation.interfaces.TwoArmLogger(interface, frequency=50, log_directory='./logs')

Bases: object

Logs the robot states of two Panda robots.

Parameters:
stop()

Stop the logger’s thread.

Return type:

None

class garmi_parti.teleoperation.interfaces.TwoArmPandaInterface(left, right, has_left_gripper=False, has_right_gripper=False)

Bases: PandaInterface, ABC

Common base class for two-arm teleoperators.

Parameters:
close(end_effector='')

This method is called by server (followers) and requested via network from clients (leaders). Use this method to close end effectors specified by end_effector. Refer to garmi_parti.teleoperation.client.close for the network call. :type end_effector: str :param end_effector: End effector name

Return type:

None

move_arms(joint_positions)

Move both arms to the given joint positions simultaneously.

Parameters:

joint_positions (TwoArmJointPositions)

Return type:

None

open(end_effector='')

This method is called by server (followers) and requested via network from clients (leaders). Use this method to open end effectors specified by end_effector. Refer to garmi_parti.teleoperation.client.open for the network call. :type end_effector: str :param end_effector: End effector name

Return type:

None

post_teleop()

Executed after teleoperation has finished.

Return type:

bool

pre_teleop()

Executed after connection has been established but before teleoperation.

Return type:

bool

start_teleop()

Executed after pre_teleop was executed on both ends.

Return type:

None

garmi_parti.teleoperation.server module

Networking teleoperation module for the server side.

class garmi_parti.teleoperation.server.Server(teleoperator, port, udp_timeout=1.0)

Bases: object

Teleoperation network server for a teleoperated robot that accepts connection from teleoperation clients.

Parameters:
close(end_effector='')

Close an end-effector on the teleoperation interface.

Parameters:

end_effector (str)

Return type:

None

open(end_effector='')

Open an end-effector on the teleoperation interface.

Parameters:

end_effector (str)

Return type:

None

pause(end_effector='')

Pause teleoperation service.

Parameters:

end_effector (str)

Return type:

None

shutdown()

Shutdown the server and end any running teleoperation.

Return type:

None

unpause(end_effector='')

Unpause teleoperation service.

Parameters:

end_effector (str)

Return type:

None

garmi_parti.teleoperation.server.user_interface(srv)

Waits for the user to press enter or ctrl+c.

Parameters:

srv (Server)

Return type:

None

garmi_parti.teleoperation.utils module

Utility module.

exception garmi_parti.teleoperation.utils.TeleopTimeoutError

Bases: RuntimeError

Teleoperation network timeout error.

class garmi_parti.teleoperation.utils.Timer(timestep, timeout, buffer_size=100)

Bases: object

Utility class to track timeouts.

Parameters:
check_timeout()

Check whether a timeout occurred since the last call to tick.

Return type:

None

tick()

Tick the internal clock. This function will keep track of the time between calls and block if necessary to keep the required timestep interval.

Return type:

None

garmi_parti.teleoperation.utils.compute_displacement(container)

Compute the displacement between the teleoperator’s initial and its current pose.

Parameters:

container (TeleopContainer) – The teleoperator container.

Returns:

Container holding the relative pose.

Return type:

Displacement

garmi_parti.teleoperation.utils.get_robot_hostnames(required=True)

Retrieve the left and right robot ips (hostnames) from the environment variables PANDA_LEFT and PANDA_RIGHT.

Parameters:

required (bool)

Return type:

tuple[str, str]