Control Modes#
The control mode determines how P7 handles subsequent motion commands. Switching modes requires an available service and
control authority. After a successful switch, still read ServiceState.fsm_state to confirm the actual state.
Mode Selection#
| SDK Mode | Corresponding FSM State | Applicable Task | Main Limitation |
|---|---|---|---|
Controller.idle |
IDLE |
Idle state before a task begins or after it ends | Does not accept ordinary motion targets |
Controller.planning_control |
PLANNING_CONTROL |
PTP, LIN, CIRCLE, OMPL, and waypoint planning | Planning success and execution completion are different stages |
Controller.servo_control |
SERVO_CONTROL |
Continuous joint or end-pose targets | Maintain a stable sending cadence and prepare an active stop workflow |
Controller.mit_control |
FORCE_CONTROL |
Specially validated low-level MIT joint control | Requires parameters matched to the payload, installation, and complete-system version |
enter_gravity_compensation_mode() |
GRAVITY_COMPENSATION |
Manual dragging and teaching | Not part of the Controller enum; external force can move the robot arm |
POSITION_CONTROL can still appear on the wire protocol, but the current Python SDK has no corresponding public
Controller member. Do not construct an unpublished direct-position-control command from the state name.
Switch and Confirm#
from arm_p7_sdk import Controller
if not client.switch_controller(Controller.planning_control, timeout_ms=5000):
raise RuntimeError("无法进入 planning_control")
state = client.get_service_state()
if state is None or state.fsm_state != "PLANNING_CONTROL":
raise RuntimeError("尚未确认 PLANNING_CONTROL")
controller_state is the low-level controller name reported by the service and cannot replace fsm_state. The mode stored
locally by the SDK can also differ from the actual FSM because of an external switch, gravity compensation, or state-cache
latency.
MIT and gravity compensation require additional safety checks
MIT parameters enter low-level commands; gravity compensation lets external force move the robot arm. Do not enter MIT without parameters matched to the current payload and complete-system version. Before entering gravity compensation, clear the motion range, support the robot arm, and ensure that the physical emergency stop can be operated immediately.
See Controller for the mode enum and confirmation method, and
API Reference for interface entry points.