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

ServiceState (Server State)#

ServiceState describes whether the P7 service is available, its high-level FSM state, and the low-level controller name. It does not contain a field that indicates whether the current Python client holds control authority.

Fields#

Field Type Meaning
service_state bool Whether the most recent service probe or state retrieval considers the service available
fsm_state str High-level operating or protection state, such as IDLE, PLANNING_CONTROL, SERVO_CONTROL, or UNKNOWN_ERROR
controller_state str Name of the active robot-arm controller reported by the service; not a closed enum
valid bool Whether the service-state cache update was within its 0.5 s TTL when the getter was called

valid=True does not imply service_state=True, nor does it indicate that other telemetry is fresh. Use fsm_state to confirm the high-level mode; controller_state cannot replace it.

Retrieving and Evaluating State#

state = client.get_service_state()
if state is None:
    print("服务状态尚无首帧")
elif not state.valid:
    print("服务状态缓存已经过期")
elif not state.service_state:
    print("服务当前不可用")
else:
    print(state.fsm_state, state.controller_state)

The retrieval method does not require control authority. The current DDS background polling interval is 1 s, while the cache TTL is 0.5 s. Consequently, even on a healthy connection, valid can briefly be False between adjacent polls. Continue sampling and evaluate it together with service_state during ongoing diagnostics.

See Robot Arm State for FSM state meanings and API Reference for complete backend retrieval differences.