agents

xArm7 Agent Interface Check user manual at https://www.ufactory.cc/download/

class real_robot.agents.xarm.XArm7(ip: str = '192.168.1.229', control_mode: str = 'ee_delta_pos', motion_mode: str = 'position', *, safety_boundary_mm: list[int] = [999, -999, 999, -999, 999, 0], boundary_clip_mm: int = 10, with_hand_camera: bool = True, run_as_process: bool = False)[source]

Bases: object

xArm7 agent class Mimics mani_skill2.agents.base_agent.BaseAgent interface

SUPPORTED_CONTROL_MODES = ('ee_pos', 'ee_delta_pos', 'ee_pose_axangle', 'ee_delta_pose_axangle', 'ee_pose_quat', 'ee_delta_pose_quat')
SUPPORTED_MOTION_MODES = ('position', 'servo', 'joint_teaching', 'cartesian_teaching (invalid)', 'joint_vel', 'cartesian_vel', 'joint_online', 'cartesian_online')
property action_space
static build_grasp_pose(center, approaching=[0.0, 0.0, -1.0], closing=[1.0, 0.0, 0.0]) Pose[source]
property cameras: CameraConfig

CameraConfig of cameras attached to agent

clean_warning_error(mode=None)[source]
close_gripper(speed=None, wait=False)[source]

Close gripper :param speed: gripper speed, range [1, 5000] r/min :param wait: whether to wait for the action to complete, default is False.

property control_mode

Get the currently activated controller uid.

get_err_warn_code(show=False)[source]
get_gripper_position(unit_in_mm=False) float[source]

Get gripper opening width :return pos: if unit_in_mm, position unit is mm. Else unit is m.

get_proprioception()[source]
get_qf() ndarray[source]

Get xarm qf (joint torques) in maniskill2 format :return qf: xArm7 joint torques, [9,] np.float32 np.ndarray

get_qpos() ndarray[source]

Get xarm qpos in maniskill2 format :return qpos: xArm7 joint angles, [9,] np.float32 np.ndarray

get_qvel() ndarray[source]

Get xarm qvel in maniskill2 format :return qvel: xArm7 joint velocities, [9,] np.float32 np.ndarray

get_state() dict[source]

Get current state, including robot state and controller state

get_tcp_pose(unit_in_mm=False) Pose[source]

Get TCP pose in world frame :return pose: If unit_in_mm, position unit is mm. Else, unit is m.

property motion_mode

Get the currently activated controller uid.

open_gripper(speed=None, wait=False)[source]

Open gripper :param speed: gripper speed, range [1, 5000] r/min :param wait: whether to wait for the action to complete, default is False.

reset(wait=True)[source]
property robot

An alias for compatibility.

run_as_process()[source]

Run XArm7 as a separate process

set_action(action: ndarray, translation_scale=100.0, axangle_scale=0.1, speed=None, mvacc=None, gripper_speed=None, skip_gripper=False, wait=False)[source]
Parameters:
  • action – action corresponding to self.control_mode, np.floating np.ndarray action[-1] is gripper action (always has range [-1, 1])

  • translation_scale – action [-1, 1] maps to [-100mm, 100mm], Used for delta control_mode only.

  • axangle_scale – axangle action norm (rotation angle) is clipped by 0.1 rad [-1, 0, 0] => rotate around [1, 0, 0] by -0.1 rad Used for delta control_mode only.

  • speed – move speed. For TCP motion: range is [0.1, 1000.0] mm/s (default=100) For joint motion: range is [0.05, 180.0] deg/s (default=20)

  • mvacc – move acceleration. For TCP motion: range [1.0, 50000.0] mm/s^2 (default=2000) For joint motion: range [0.5, 1145.0] deg/s^2 (default=500)

  • gripper_speed – gripper speed, range [1, 5000] r/min (default=5000)

  • skip_gripper – whether to skip gripper action

  • wait – whether to wait for the arm to complete, default is False. Has no effect in “joint_online” and “cartesian_online” motion mode

set_gripper_position(gripper_pos, unit_in_mm=False, speed=None, wait=False)[source]

Set gripper opening width :param gripper_pos: gripper position (default unit is in meters) :param unit_in_mm: whether gripper_pos has unit mm or m :param speed: gripper speed, range [1, 5000] r/min :param wait: whether to wait for the action to complete, default is False.

set_qpos(qpos, speed=None, mvacc=None, gripper_speed=None, skip_gripper=False, wait=False)[source]

Set xarm qpos using maniskill2 qpos

Parameters:
  • qpos – joint qpos (angles for arm joints, gripper_qpos for gripper) See self.joint_limits_ms2

  • speed – move speed. For TCP motion: range is [0.1, 1000.0] mm/s (default=100) For joint motion: range is [0.05, 180.0] deg/s (default=20)

  • mvacc – move acceleration. For TCP motion: range [1.0, 50000.0] mm/s^2 (default=2000) For joint motion: range [0.5, 1145.0] deg/s^2 (default=500)

  • gripper_speed – gripper speed, range [1, 5000] r/min

  • skip_gripper – whether to skip gripper action

  • wait – whether to wait for the arm to complete, default is False.

set_state(state: dict, ignore_controller=False)[source]