Skip to content

RL gRPC Interface

High-level motion control is implemented via gRPC. The reinforcement-learning (RL) client is a standalone program, deployed separately from the controller; the server runs with the robot control program and does not support secondary development.

Complete the robot Quick Start before use. For client setup and examples, see gRPC Example. The full project will be published at pnd_grpc.

Item Description
Service port 50051 (fixed; do not change)
Address Local: localhost:50051; remote: <robot IP>:50051
Call flow GetRobotState → check switchable_states / available_actions → send command
Motion file path Sources/motion/<filename>.txt (relative to /etc/pndbotics/pnd_adam_dds/)

API Description

pnd.robot.RobotControl

The RobotControl service exposes Adam high-level motion APIs. Call the RPCs below through a client Stub.

Service RobotControl
Package pnd.robot
Default port 50051

Interface Definition (Proto)

syntax = "proto3";
package pnd.robot;

service RobotControl {
  rpc SetMode         (SetModeRequest)         returns (SetModeResponse);
  rpc SetVelocity     (SetVelocityRequest)     returns (SetVelocityResponse);
  rpc SetHeight       (SetHeightRequest)       returns (SetHeightResponse);
  rpc SetMotion       (SetMotionRequest)       returns (SetMotionResponse);
  rpc SetTrackingMotion (SetTrackingMotionRequest) returns (SetTrackingMotionResponse);
  rpc GetRobotState   (GetRobotStateRequest)   returns (GetRobotStateResponse);
  rpc SetControlMode  (SetControlModeRequest)  returns (SetControlModeResponse);
  rpc GetControlState (GetControlStateRequest) returns (GetControlStateResponse);
  rpc Shutdown        (ShutdownRequest)        returns (ShutdownResponse);
}
API GetRobotState
Prototype rpc GetRobotState (GetRobotStateRequest) returns (GetRobotStateResponse)
Description Returns current FSM state, velocity/height feedback, motion and tracking playback status, and lists of switchable states and available APIs.
Parameters None (GetRobotStateRequest is empty)
Return GetRobotStateResponse: success (bool), fsm_state (string), vx / vy / vyaw (double), height (double), current_motion_file (string), motion_playing (bool), current_tracking_motion (string), tracking_playing (bool), switchable_states (repeated string), available_actions (repeated string)
Note Callable at any time. Call before other commands; treat switchable_states and available_actions as authoritative for the current moment.
API SetMode
Prototype rpc SetMode (SetModeRequest) returns (SetModeResponse)
Description Switch the robot FSM state.
Parameters target_state (string): target FSM state; see "SetMode Values" below
Return SetModeResponse: success (bool), message (string), current_state (string)
Note Only states in switchable_states are valid; success=true means accepted—the transition completes asynchronously (poll fsm_state); ZEROSTAND_WALK completes after zeroing. Typical flow: STOP → ZERO → STAND_WALK → MULTI_AGENT / MOTION_TRACK / ...
API SetMotion
Prototype rpc SetMotion (SetMotionRequest) returns (SetMotionResponse)
Description Play or stop an upper-body motion file in MULTI_AGENT.
Parameters command (enum): PLAY / STOP
motion_file (string): required for PLAY
Return SetMotionResponse: success (bool), message (string), current_motion (string), is_playing (bool)
Note Callable only when available_actions includes SetMotion. motion_file must be a .txt on the robot; preset motions are under Sources/motion/. Full list: Arm Motion Service Interface.
API SetTrackingMotion
Prototype rpc SetTrackingMotion (SetTrackingMotionRequest) returns (SetTrackingMotionResponse)
Description Switch full-body trajectory tracking file in MOTION_TRACK.
Parameters motion_file (string): trajectory file path
Return SetTrackingMotionResponse: success (bool), message (string), current_tracking_motion (string)
Note Callable only when available_actions includes SetTrackingMotion. See Arm Motion Service Interface.
API SetVelocity
Prototype rpc SetVelocity (SetVelocityRequest) returns (SetVelocityResponse)
Description Set walking velocity.
Parameters vx (double): forward/back, normalized [-1.0, 1.0]
vy (double): lateral
vyaw (double): yaw rate
Return SetVelocityResponse: success (bool), message (string)
Note Reserved; not connected yet. Use the handheld controller for walking.
API SetHeight
Prototype rpc SetHeight (SetHeightRequest) returns (SetHeightResponse)
Description Set standing height.
Parameters height (double): normalized [-1.0, 1.0]; 0 is default height
Return SetHeightResponse: success (bool), message (string)
Note Reserved; not connected yet.
API SetControlMode
Prototype rpc SetControlMode (SetControlModeRequest) returns (SetControlModeResponse)
Description Switch control paradigm (Traditional / RL).
Parameters domain_id (int32): 0=Traditional, 1=RL
Return SetControlModeResponse: success (bool), message (string)
Note Call GetControlState after switching to confirm.
API GetControlState
Prototype rpc GetControlState (GetControlStateRequest) returns (GetControlStateResponse)
Description Query the current control paradigm.
Parameters None (GetControlStateRequest is empty)
Return GetControlStateResponse: success (bool), message (string), domain_id (int32)
Note domain_id=-1 means no feedback received yet.
API Shutdown
Prototype rpc Shutdown (ShutdownRequest) returns (ShutdownResponse)
Description Request shutdown of the robot controller.
Parameters force (bool): force shutdown
Return ShutdownResponse: success (bool), message (string)
Note

API Summary

API Description Parameters Example values
GetRobotState Query state and available capabilities
SetMode Switch FSM state target_state "ZERO", "STAND_WALK", "MULTI_AGENT", "STOP"
SetMotion Play/stop upper-body motion (MULTI_AGENT) command, motion_file PLAY, "Sources/motion/Greeting.txt"
SetTrackingMotion Switch full-body trajectory (MOTION_TRACK) motion_file See Arm Motion Service Interface
SetVelocity Set walking velocity (reserved) vx, vy, vyaw 0.5, 0.0, 0.0
SetHeight Set standing height (reserved) height -0.1
SetControlMode Switch control paradigm domain_id 0 (Traditional), 1 (RL)
GetControlState Query control paradigm
Shutdown Shut down controller force false

FSM States

FSM state Description Available APIs (available_actions)
STOP Emergency stop (none)
ZERO Zero calibration (none)
STAND_WALK Basic stand/walk SetVelocity
MULTI_AGENT Upper-body motion overlay SetVelocity, SetHeight, SetMotion
MOTION_TRACK Full-body trajectory tracking SetVelocity, SetTrackingMotion
JOG Jogging SetVelocity
VISION_TERRAIN Vision terrain SetVelocity

State transitions

Which strategy states are reachable from STAND_WALK depends on robot-side authorization. Use GetRobotState().switchable_states as the source of truth. SetVelocity / SetHeight appear in some states' available_actions but are currently reserved.


SetMode Values

Value Description
STOP Emergency stop
ZERO Zero calibration
STAND_WALK Basic stand/walk
MULTI_AGENT Upper-body motion overlay (SetMotion)
MOTION_TRACK Full-body trajectory tracking (SetTrackingMotion)
JOG Jogging
VISION_TERRAIN Vision terrain

SetControlMode Values

domain_id Description
0 Traditional control
1 RL control
-1 Only in GetControlState response when no feedback yet

Notes

  1. Startup order: Start the robot control program before the client.
  2. Query before command: Use GetRobotState to check switchable_states and available_actions.
  3. Async mode switch: After SetMode succeeds, poll fsm_state until the target is reached.
  4. Motion and tracking files: See Arm Motion Service Interface.
  5. Real-time upper-body control: See Arm Control Example (DDS); hands: Hand Control.

Doc Description
MPC gRPC Interface Traditional control (MPC) gRPC interface definition and parameters
gRPC Example Client setup and interactive examples
Arm Motion Service Interface SetMotion / SetTrackingMotion and motion files
Arm Control Example DDS real-time upper-body control
Hand Control DDS finger control