Robot Main Control Service
About 1756 wordsAbout 6 min
2025-07-0810:18:56
Provides robot system main controller. Through the
MagicRobot
class, you can perform resource initialization, manage communication connections, and access various sub-controllers such as motion controllers, audio, state monitoring, and sensor controllers.
Interface Definition
MagicRobot
is the unified entry class for the robot SDK.
MagicRobot
Item | Content |
---|---|
Function Name | MagicRobot |
Function Declaration | MagicRobot(); |
Function Overview | Constructor, creates 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 | Initialize 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 | Shutdown robot system and release resources. |
Notes | Used in conjunction with Initialize. |
Release
Item | Content |
---|---|
Function Name | Release |
Function Declaration | void Release(); |
Function Overview | Release resources. |
Notes | Releases SDK-occupied topic resources. |
Connect
Item | Content |
---|---|
Function Name | Connect |
Function Declaration | Status Connect(); |
Function Overview | Establish communication connection with robot service. |
Return Value | Status::OK indicates success. |
Notes | Blocking interface, must be called after initialization. |
Disconnect
Item | Content |
---|---|
Function Name | Disconnect |
Function Declaration | Status Disconnect(); |
Function Overview | Disconnect from robot service. |
Return Value | gRPC call status. |
Notes | Blocking interface, used in conjunction with Connect. |
GetSDKVersion
Item | Content |
---|---|
Function Name | GetSDKVersion |
Function Declaration | std::string GetSDKVersion() const; |
Function Overview | Get current SDK version number. |
Return Value | SDK version string (e.g., 0.0.1 ). |
Notes | Non-blocking interface, convenient for debugging or log marking. |
SetTimeout
Item | Content |
---|---|
Function Name | SetTimeout |
Function Declaration | void SetTimeout(int timeout); |
Function Overview | Set timeout for interface calls. |
Parameter Description | timeout : Unit is milliseconds. |
Return Value | None |
Notes | Non-blocking interface, default value is 5000 milliseconds. |
GetMotionControlLevel
Item | Content |
---|---|
Function Name | GetMotionControlLevel |
Function Declaration | ControllerLevel GetMotionControlLevel(); |
Function Overview | Get current motion control level (high-level/low-level). |
Return Value | ControllerLevel enumeration value. |
Notes | Non-blocking interface, used to determine current control permissions. |
SetMotionControlLevel
Item | Content |
---|---|
Function Name | SetMotionControlLevel |
Function Declaration | Status SetMotionControlLevel(ControllerLevel level); |
Function Overview | Set current motion control level. |
Parameter Description | level : Control permission enumeration value. |
Return Value | Status::OK indicates successful setting, others indicate setting failure. |
Notes | Blocking interface, used when switching control modes. |
GetHighLevelMotionController
Item | Content |
---|---|
Function Name | GetHighLevelMotionController |
Function Declaration | HighLevelMotionController& GetHighLevelMotionController(); |
Function Overview | Get high-level motion controller object. |
Return Value | Reference type, used to call high-level control interfaces. |
Notes | Non-blocking interface, encapsulates gait, tricks, remote control, etc. |
GetLowLevelMotionController
Item | Content |
---|---|
Function Name | GetLowLevelMotionController |
Function Declaration | LowLevelMotionController& GetLowLevelMotionController(); |
Function Overview | Get low-level motion controller object. |
Return Value | Reference type, used to control joints or motors. |
Notes | Non-blocking interface, directly controls joint motors, gets IMU data, etc. |
GetAudioController
Item | Content |
---|---|
Function Name | GetAudioController |
Function Declaration | AudioController& GetAudioController(); |
Function Overview | Get audio controller object. |
Return Value | Reference type, used for audio control. |
Notes | Non-blocking interface, plays audio and controls volume. |
GetSensorController
Item | Content |
---|---|
Function Name | GetSensorController |
Function Declaration | SensorController& GetSensorController(); |
Function Overview | Get sensor controller object. |
Return Value | Reference type, used to access sensor data. |
Notes | Non-blocking interface, encapsulates LiDAR, RGBD, etc. reading. |
GetStateMonitor
Item | Content |
---|---|
Function Name | GetStateMonitor |
Function Declaration | StateMonitor& GetStateMonitor(); |
Function Overview | Get state monitor object. |
Return Value | Reference type, used to get current robot state information. |
Notes | Non-blocking interface, encapsulates reading of BMS, faults, and other state information. |