Robot Main Control Service
About 1692 wordsAbout 6 min
2025-05-29
Provides the robot system main controller. Through MagicRobot, you can perform resource initialization, manage communication connections, and access various sub-controllers such as motion controllers, audio controllers, state monitoring, and sensor controllers.
Interface Definition
MagicRobot
is the unified entry class for the robot system.
MagicRobot
Item | Content |
---|---|
Function Name | MagicRobot |
Function Declaration | MagicRobot(); |
Function Overview | Constructor, creates a MagicRobot instance. |
Notes | Constructs internal state. |
~MagicRobot
Item | Content |
---|---|
Function Name | ~MagicRobot |
Function Declaration | ~MagicRobot(); |
Function Overview | Destructor, releases MagicRobot instance resources. |
Notes | Ensures safe resource release. |
Initialize
Item | Content |
---|---|
Function Name | Initialize |
Function Declaration | bool Initialize(const std::string& local_ip); |
Function Overview | Initializes the robot system, including controllers and network modules. |
Parameter Description | local_ip : Local communication IP address. |
Return Value | true indicates success, false indicates failure. |
Notes | Must be called before first use. |
Shutdown
Item | Content |
---|---|
Function Name | Shutdown |
Function Declaration | void Shutdown(); |
Function Overview | Shuts down the robot system and releases resources. |
Notes | Used in conjunction with Initialize. |
Connect
Item | Content |
---|---|
Function Name | Connect |
Function Declaration | Status Connect(); |
Function Overview | Establishes a communication connection with the robot service. |
Return Value | Status::OK indicates success. |
Notes | Blocking interface, should be called after initialization. |
Disconnect
Item | Content |
---|---|
Function Name | Disconnect |
Function Declaration | Status Disconnect(); |
Function Overview | Disconnects from the robot service. |
Return Value | gRPC call status. |
Notes | Blocking interface, used in pair with Connect. |
GetSDKVersion
Item | Content |
---|---|
Function Name | GetSDKVersion |
Function Declaration | std::string GetSDKVersion() const; |
Function Overview | Gets the current SDK version. |
Return Value | SDK version string (e.g., 0.0.1 ). |
Notes | Non-blocking interface, useful for debugging or log marking. |
SetTimeout
Item | Content |
---|---|
Function Name | SetTimeout |
Function Declaration | void SetTimeout(int timeout); |
Function Overview | Sets the timeout for interface calls. |
Parameter Description | timeout : Unit is milliseconds. |
Return Value | None |
Notes | Non-blocking interface, default value is 5000 ms. |
GetMotionControlLevel
Item | Content |
---|---|
Function Name | GetMotionControlLevel |
Function Declaration | ControllerLevel GetMotionControlLevel(); |
Function Overview | Gets the current motion control level (high/low). |
Return Value | ControllerLevel enum value. |
Notes | Non-blocking interface, used to determine current control permission. |
SetMotionControlLevel
Item | Content |
---|---|
Function Name | SetMotionControlLevel |
Function Declaration | Status SetMotionControlLevel(ControllerLevel level); |
Function Overview | Sets the current motion control level. |
Parameter Description | level : Control permission enum value. |
Return Value | Status::OK indicates success, others indicate failure. |
Notes | Blocking interface, used when switching control modes. |
GetHighLevelMotionController
Item | Content |
---|---|
Function Name | GetHighLevelMotionController |
Function Declaration | HighLevelMotionController& GetHighLevelMotionController(); |
Function Overview | Gets the high-level motion controller object. |
Return Value | Reference type, used to call high-level control interfaces. |
Notes | Non-blocking interface, encapsulates gait, stunt, remote control and other control functions. |
GetLowLevelMotionController
Item | Content |
---|---|
Function Name | GetLowLevelMotionController |
Function Declaration | LowLevelMotionController& GetLowLevelMotionController(); |
Function Overview | Gets the low-level motion controller object. |
Return Value | Reference type, used to control joints or motors. |
Notes | Non-blocking interface, can directly control joint motors, etc. |
GetAudioController
Item | Content |
---|---|
Function Name | GetAudioController |
Function Declaration | AudioController& GetAudioController(); |
Function Overview | Gets the audio controller object. |
Return Value | Reference type, used for voice control. |
Notes | Non-blocking interface, can play voice and control volume. |
GetSensorController
Item | Content |
---|---|
Function Name | GetSensorController |
Function Declaration | SensorController& GetSensorController(); |
Function Overview | Gets the sensor controller object. |
Return Value | Reference type, used to access sensor data. |
Notes | Non-blocking interface, encapsulates IMU, RGBD and other sensor data reading. |
GetStateMonitor
Item | Content |
---|---|
Function Name | GetStateMonitor |
Function Declaration | StateMonitor& GetStateMonitor(); |
Function Overview | Gets the state monitor object. |
Return Value | Reference type, used to get the current robot state information. |
Notes | Non-blocking interface, encapsulates BMS, fault and other state information reading. |