Skip to content
⚙ Development Guide > SDK > API > Data Structures

Control Modes (Controller)#

Controller is the control-mode enum exported at the top level of arm_p7_sdk. It is used by switch_controller(); not all enum names are identical to the display names in ServiceState.fsm_state.

Available Control Modes#

from arm_p7_sdk import Controller
Enum Member Expected FSM State Purpose
Controller.idle IDLE Stops accepting ordinary motion targets; switch back to idle when a task is complete
Controller.planning_control PLANNING_CONTROL Plans and executes PTP, LIN, CIRCLE, OMPL, or waypoint trajectories
Controller.servo_control SERVO_CONTROL Accepts continuous or individual Servo targets
Controller.mit_control FORCE_CONTROL Accepts specially validated low-level MIT joint commands

Gravity compensation is entered through enter_gravity_compensation_mode() and is not a Controller member. The wire protocol's POSITION_CONTROL also has no corresponding public Python enum member.

Usage Rules#

Explicitly acquire control authority before calling switch_controller(). After the method returns True, read ServiceState.fsm_state to confirm the actual state; do not substitute controller_state or a local SDK cache for FSM confirmation.

if not client.switch_controller(Controller.servo_control, timeout_ms=5000):
    raise RuntimeError("控制模式切换失败")

state = client.get_service_state()
if state is None or state.fsm_state != "SERVO_CONTROL":
    raise RuntimeError("尚未确认 SERVO_CONTROL")

For command behavior, safety requirements, and backend wait differences in each mode, see Control Modes and API Reference.