Skip to content
⚙ Development Guide

MMK2 Robot SDK API Reference#

Initialization#

Function Interface Parameters Return Value
Connect to the robot MMK2Robot.__init__(ip) ip: Wired or wireless IP address of the lower-level controller -

Data Retrieval#

Function Interface Parameters Return Value
Get current joint data get_joint_states() -> JointStates - Joint-state object containing positions, velocities, and torques
Get the current end-effector pose get_arm_pose(arm: str) -> Tuple[List[float], List[float]] arm: Robotic arm ('left' or 'right') Tuple of (position, quaternion); position is in meters
Get the base pose get_base_pose() -> List[float] - [x, y, theta] list in meters and radians

Camera Data Retrieval#

Function Interface Parameters Return Value
Enable a camera and configure its parameters camera.set_camera_config(config: Dict[str, Any]) -> None config: Camera configuration dictionary in YAML format -
Get head-camera data camera.get_head_camera_frame() -> Dict[str, np.ndarray] - Dictionary containing 'rgb' and 'depth'
Get left-arm camera data camera.get_left_camera_frame() -> Dict[str, np.ndarray] - Dictionary containing 'rgb' and 'depth'
Get right-arm camera data camera.get_right_camera_frame() -> Dict[str, np.ndarray] - Dictionary containing 'rgb' and 'depth'

Robotic-Arm Control#

Function Interface Parameters Return Value
Control dual-arm joint angles move_arm_joints(arm: str, joints: List[float], block: bool = True) -> bool arm: 'left'/'right'/'all'
joints: List of joint angles
block: Whether to block until complete
Whether the target position was reached successfully
Control dual-arm joint trajectories move_arm_joint_waypoints(arm: str, waypoints: List[float], block: bool = True) -> bool arm: 'left'/'right'/'all'
waypoints: List of joint-trajectory waypoints
block: Whether to block until complete
Whether the target position was reached successfully
Control absolute dual-arm end-effector poses move_arm_pose(arm: str, pose: List[float], block: bool = True) -> bool arm: 'left'/'right'/'all'
pose: Pose list
block: Whether to block until complete
Whether the target pose was reached successfully
Control dual-arm end-effector pose trajectories move_arm_pose_waypoints(arm: str, waypoints: List[float], block: bool = True) -> bool arm: 'left'/'right'/'all'
waypoints: List of pose-trajectory waypoints
block: Whether to block until complete
Whether the target pose was reached successfully
Control relative dual-arm end-effector poses move_arm_relative(arm: str, delta_pose: List[float], block: bool = True) -> bool arm: 'left'/'right'
delta_pose: Relative pose change
block: Whether to block until complete
Whether the relative motion completed successfully
Open/close an end-effector gripper control_gripper(arm: str, position: float, block: bool = True) -> bool arm: 'left'/'right'/'all'
position: Gripper opening (0.0-1.0)
block: Whether to block until complete
Whether the gripper position was set successfully

Head Control#

Function Interface Parameters Return Value
Control head joint angles set_head(yaw: float, pitch: float, block: bool = True) -> bool yaw: Yaw angle (-0.47 to 0.47 radians)
pitch: Pitch angle (-0.98 to 0.32 radians)
block: Whether to block until complete
Whether the values were set successfully

Spine Control#

Function Interface Parameters Return Value
Set spine height set_spine(position: float, block: bool = True) -> bool position: Target height (0.04m upward, 0.87m downward)
block: Whether to block until complete
Whether the value was set successfully

Base Control#

Function Interface Parameters Return Value
Pose control move_base(x: float, y: float, theta: float, block: bool = True) -> bool x: Target X coordinate (meters)
y: Target Y coordinate (meters)
theta: Target angle (radians)
block: Whether to block until complete
Whether the target position was reached successfully
Move forward move_forward(distance: float, block: bool = True) -> bool distance: Forward distance (meters)
block: Whether to block until complete
Whether the motion completed successfully
Move backward move_backward(distance: float, block: bool = True) -> bool distance: Backward distance (meters)
block: Whether to block until complete
Whether the motion completed successfully
Turn left turn_left(angle: float, block: bool = True) -> bool angle: Rotation angle (radians)
block: Whether to block until complete
Whether the rotation completed successfully
Turn right turn_right(angle: float, block: bool = True) -> bool angle: Rotation angle (radians)
block: Whether to block until complete
Whether the rotation completed successfully
Move laterally lateral_move(distance: float, block: bool = True) -> bool distance: Lateral distance (meters)
block: Whether to block until complete
Whether the motion completed successfully
Set the initial position set_base_zero() -> bool - Whether the zero position was set successfully

Reset Functions#

Function Interface Parameters Return Value
Reset to the starting pose reset_to_start(arm_type: str = "all") -> bool arm_type: Reset target ('left'/'right'/'all') Whether the reset completed successfully
Reset to the zero pose reset_to_zero(arm_type: str = "all") -> bool arm_type: Reset target ('left'/'right'/'all') Whether the reset completed successfully
Stop control stop_all() -> None - -

Example#

# Initialize the connection
robot = MMK2Robot("192.168.1.100")

# Get joint states
joint_states = robot.get_joint_states()

# Move the left arm
robot.move_arm_joints("left", [0.1, 0.2, 0.3, 0.4, 0.5, 0.6])

# Get camera data
camera_data = robot.camera.get_head_camera_frame()

# Move the base
robot.move_base(1.0, 0.5, 0.0)

📝 Notes#

🔧 Parameter Units#

  • All angle parameters are in radians.

    • This includes joint angles, head yaw/pitch, and base rotation angles.
    • Example: 0.5 means 0.5 radians.
  • All position parameters are in meters.

    • This includes end-effector positions, base movement distances, and spine height.
    • Example: 0.1 means 0.1 meters.

🦾 Gripper Control#

  • The gripper-opening range is 0.0 to 1.0.
    • 0.0: Fully open
    • 1.0: Fully closed
    • Example: 0.5 means half open.

⏱️ Execution Modes#

  • Blocking mode (block=True)

    • Returns after the motion completes.
    • Suitable when motion completion must be ensured.
  • Non-blocking mode (block=False)

    • Returns immediately without waiting for motion completion.
    • Suitable when multiple tasks must run in parallel.

⚠️ Important#

  1. Connection stability: Make sure the IP address is correct and the network connection is stable.
  2. Parameter ranges: Observe the angle limits for each joint.
  3. Exception handling: Appropriate exception handling is recommended.
  4. Resource release: Release resources promptly after use.