Chassis APIs
ChassisFactory
Section titled “ChassisFactory”The ChassisFactory class provides the following method for creating a chassis instance.
-
Method:
create_chassis_from_config(config_file: str) -> ChassisInterface -
Parameter:
Parameter Description config_pathPath to the configuration file. The configuration file must be a JSON file.
{"chassis_type":"xxx", # Chassis vendor"chassis_name":"chassis", # Chassis name"ip":"127.0.0.1", # IP address"port":51051 # Port number} -
Return value:
An ChassisInterface instance if creation succeeds, otherwise
None.
ChassisFactoryParam
Section titled “ChassisFactoryParam”The ChassisFactoryParam class is used to describe the parameters required to create a chassis instance.
| Attribute | Data Type | Description |
|---|---|---|
chassis_type | str | Chassis vendor |
chassis_name | str | Chassis name (e.g., "chassis") |
ip | str | IP address (e.g., "127.0.0.1") |
port | int | Port number (e.g., 54051) |
ChassisInterface
Section titled “ChassisInterface”The ChassisInterface class provides a series of public methods for controlling the chassis, such as moving it, obtaining its footprint, and querying its status. Ensure a chassis instance has been created before using these methods.
Connect to the Chassis
Section titled “Connect to the Chassis”After creating a chassis instance, you can establish a connection to the chassis using the following method.
-
Method:
connect(self) -> alphabot.core.AbcErrorCode -
Return Value:
AbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.
Disconnect from the Chassis
Section titled “Disconnect from the Chassis”You can disconnect from the chassis using the following method.
-
Method:
disconnect(self) -> alphabot.core.AbcErrorCode -
Return Value:
AbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.
Get Chassis Pose and Speed
Section titled “Get Chassis Pose and Speed”-
Method:
get_pose_speed(self) -> tuple[alphabot.core.AbcErrorCode, ChassisPoseSpeed] -
Return Value:
A tuple containing two elements.
Element Type Description AbcErrorCodeAbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.ChassisPoseSpeedThe chassis pose and speed. For details, please refer to ChassisPoseSpeed.
Get Chassis Pose
Section titled “Get Chassis Pose”-
Method:
get_pose(self) -> tuple[alphabot.core.AbcErrorCode, ChassisPose2D] -
Return Value:
A tuple containing two elements.
Element Type Description AbcErrorCodeAbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.ChassisPose2DThe chassis pose. For details, please refer to ChassisPose2D.
Get Chassis Speed
Section titled “Get Chassis Speed”-
Method:
get_speed(self) -> tuple[alphabot.core.AbcErrorCode, ChassisTwist] -
Return Value:
A tuple containing two elements.
Element Type Description AbcErrorCodeAbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.ChassisTwistThe chassis speed. For details, please refer to ChassisTwist.
Get Chassis Mileage
Section titled “Get Chassis Mileage”-
Method:
get_mileage(self) -> tuple[alphabot.core.AbcErrorCode, int] -
Return Value:
A tuple containing two elements.
Element Type Description AbcErrorCodeAbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.intAccumulated mileage.
Get Chassis Battery Information
Section titled “Get Chassis Battery Information”-
Method:
get_battery(self) -> tuple[alphabot.core.AbcErrorCode, ChassisBattery] -
Return Value:
A tuple containing two elements.
Element Type Description AbcErrorCodeAbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.ChassisBatteryThe chassis battery information. For details, please refer to ChassisBattery.
Get Chassis Status
Section titled “Get Chassis Status”-
Method:
get_robot_state(self) -> tuple[alphabot.core.AbcErrorCode, ChassisState] -
Return Value:
A tuple containing two elements.
Element Type Description AbcErrorCodeAbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.ChassisStateThe chassis status. For details, please refer to ChassisState.
Get Chassis Status Code
Section titled “Get Chassis Status Code”-
Method:
get_status_code(self) -> tuple[alphabot.core.AbcErrorCode, ChassisStatusCode] -
Return Value:
A tuple containing two elements.
Element Type Description AbcErrorCodeAbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.ChassisStatusCodeThe chassis status code. For details, please refer to ChassisStatusCode.
Get Chassis Hardware Status
Section titled “Get Chassis Hardware Status”-
Method:
get_hardware_state(self) -> tuple[alphabot.core.AbcErrorCode, ChassisHardwareState] -
Return Value:
A tuple containing two elements.
Element Type Description AbcErrorCodeAbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.ChassisHardwareStateThe hardware status of the chassis. For details, please refer to ChassisHardwareState.
Get Chassis Static Transform
Section titled “Get Chassis Static Transform”-
Method:
get_static_tf(self) -> tuple[alphabot.core.AbcErrorCode, list[ChassisTransformStamped]] -
Return Value:
A tuple containing two elements.
Element Type Description AbcErrorCodeAbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.list[ChassisTransformStamped]Chassis static transforms. For details, please refer to ChassisTransformStamped.
Set Chassis Twist
Section titled “Set Chassis Twist”-
Method:
twist_control(self, linear: float, angular: float) -> alphabot.core.AbcErrorCode -
Parameters:
ParameterDescription linearLinear velocity angularAngular velocity -
Return Value:
AbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.
Set Chassis Maximum Speed
Section titled “Set Chassis Maximum Speed”-
Method:
set_max_speed(self, max_spd: float) -> alphabot.core.AbcErrorCode -
Parameter:
ParameterDescription max_spdMaximum speed -
Return Value:
AbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.
Initialize Chassis
Section titled “Initialize Chassis”-
Method:
init_robot(self, pose: ChassisPose2D, update_flg: int) -> alphabot.core.AbcErrorCode -
Parameters:
ParameterDescription poseThe chassis pose. For details, please refer to ChassisPose2D. update_flgFlag indicating whether to update the chassis pose. -
Return Value:
AbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.
Move to a Target Position
Section titled “Move to a Target Position”-
Method:
move_to_point_sync(self,x: float,y: float,theta: float,callback: typing.Callable,max_spd: float = 1.0) -> alphabot.core.AbcErrorCode -
Parameters:
ParameterDescription xX-axis coordinate of the target position. yY-axis coordinate of the target position. thetaOrientation of the target position. callbackCallback function. max_spdMaximum speed. -
Return Value:
AbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.
Charge
Section titled “Charge”-
Method:
to_charge_sync(self, max_spd: float = 1.0) -> alphabot.core.AbcErrorCode -
Parameter:
ParameterDescription max_spdMaximum speed -
Return Value:
AbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.
Exit Charging
Section titled “Exit Charging”-
Method:
exit_charge_sync(self, max_spd: float = 1.0) -> alphabot.core.AbcErrorCode -
Parameter:
ParameterDescription max_spdMaximum speed -
Return Value:
AbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.
Move Linearly
Section titled “Move Linearly”-
Method:
move_straight_sync(self,distance: float,speed: float,callback: typing.Callable,use_avoid: bool = True) -> alphabot.core.AbcErrorCode -
Parameters:
ParameterDescription distanceTravel distance. speedTravel speed. callbackCallback function. use_avoidWhether to enable obstacle avoidance. -
Return Value:
AbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.
Move Rotationally
Section titled “Move Rotationally”-
Method:
move_rotate_sync(self,angle: float,speed: float,callback: typing.Callable,use_avoid: bool = True) -> alphabot.core.AbcErrorCode -
Parameters:
ParameterDescription angleRotation angle. speedRotation speed. callbackCallback function. use_avoidWhether to enable obstacle avoidance. -
Return Value:
AbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.
Get Local Footprint
Section titled “Get Local Footprint”-
Method:
get_local_footprint(self) -> tuple[alphabot.core.AbcErrorCode, list[ChassisPoint32]] -
Return Value:
A tuple containing two elements.
Element Type Description AbcErrorCodeAbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.list[ChassisPoint32]Local footprint points. For details, please refer to ChassisPoint32.
Get Global Footprint
Section titled “Get Global Footprint”-
Method:
get_global_footprint(self) -> tuple[alphabot.core.AbcErrorCode, list[ChassisPoint32]] -
Return Value:
A tuple containing two elements.
Element Type Description AbcErrorCodeAbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.list[ChassisPoint32]Global footprint points. For details, please refer to ChassisPoint32.
Get Local and Global Footprint
Section titled “Get Local and Global Footprint”-
Method:
get_all_footprint(self) -> tuple[alphabot.core.AbcErrorCode, tuple[list[ChassisPoint32], list[ChassisPoint32]]] -
Return Value:
A tuple containing two elements.
Element Type Description AbcErrorCodeAbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.tuple[list[ChassisPoint32], list[ChassisPoint32]]The first element is the local footprint, and the second element is the global footprint. For the data structure of footprint points, please refer to ChassisPoint32.
Get Static Footprint (Based on odom and base_link Frames)
Section titled “Get Static Footprint (Based on odom and base_link Frames)”-
Method:
ai2_get_local_footprint(self) -> tuple[alphabot.core.AbcErrorCode, list[ChassisPoint32]] -
Return Value:
A tuple containing two elements.
Element Type Description AbcErrorCodeAbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.list[ChassisPoint32]Footprint points. For details, please refer to ChassisPoint32.
Get Static Footprint (Based on map and base_link Frames)
Section titled “Get Static Footprint (Based on map and base_link Frames)”-
Method:
ai2_get_global_footprint(self) -> tuple[alphabot.core.AbcErrorCode, list[ChassisPoint32]] -
Return Value:
A tuple containing two elements.
Element Type Description AbcErrorCodeAbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.list[ChassisPoint32]Footprint points. For details, please refer to ChassisPoint32.
Get Static Footprint
Section titled “Get Static Footprint”-
Method:
ai2_get_all_footprint(self) -> tuple[alphabot.core.AbcErrorCode, tuple[list[ChassisPoint32], list[ChassisPoint32]]] -
Return Value:
A tuple containing two elements.
Element Type Description AbcErrorCodeAbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.tuple[list[ChassisPoint32], list[ChassisPoint32]]The first element is the footprint calculated based on the odom and base_link frames, and the second element is the footprint calculated based on the map and base_link frames.
For the data structure of footprint points, please refer to ChassisPoint32.
Set Local Footprint
Section titled “Set Local Footprint”-
Method:
set_local_footprint(self, points: list[ChassisPoint32]) -> alphabot.core.AbcErrorCode -
Parameter:
ParameterDescription pointsLocal footprint points. For details, please refer to ChassisPoint32. -
Return Value:
AbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.
Set Global Footprint
Section titled “Set Global Footprint”-
Method:
set_global_footprint(self, points: list[ChassisPoint32]) -> alphabot.core.AbcErrorCode -
Parameter:
ParameterDescription pointsGlobal footprint points. For details, please refer to ChassisPoint32. -
Return Value:
AbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.
Set Local and Global Footprint
Section titled “Set Local and Global Footprint”-
Method:
set_all_footprint(self, local_points: list[ChassisPoint32], global_points: list[ChassisPoint32]) -> alphabot.core.AbcErrorCode -
Parameters:
ParameterDescription local_pointsLocal footprint points. For details, please refer to ChassisPoint32. global_pointsGlobal footprint points. For details, please refer to ChassisPoint32. -
Return Value:
AbcErrorCode.SUCCESSindicates success. For other error codes, please refer to AbcErrorCode.
Get Chassis Name
Section titled “Get Chassis Name”-
Method:
get_name(self) -> str -
Return Value:
The name of the chassis instance.
ChassisPoseSpeed
Section titled “ChassisPoseSpeed”| Attribute | Data Type | Description |
|---|---|---|
map_id | int | Map ID |
mileage | int | Accumulated mileage |
robot_id | int | Chassis ID |
pose | ChassisPose2D | 2D pose |
twist | ChassisTwist | Twist (linear + angular velocity) |
ChassisPose2D
Section titled “ChassisPose2D”The ChassisPose2D class represents the 2D pose of a chassis.
| Attribute | Data Type | Description |
|---|---|---|
theta | float | Orientation |
x | float | X-axis coordinate value |
y | float | Y-axis coordinate value |
ChassisPoint32
Section titled “ChassisPoint32”The ChassisPoint32 class represents the position of a footprint point.
| Attribute | Data Type | Description |
|---|---|---|
x | float | X-axis coordinate value |
y | float | Y-axis coordinate value |
z | float | Z-axis coordinate value |
ChassisTwist
Section titled “ChassisTwist”| Attribute | Data Type | Description |
|---|---|---|
angular | float | Angular velocity |
linear | float | Linear velocity |
ChassisBattery
Section titled “ChassisBattery”| Attribute | Data Type | Description |
|---|---|---|
charge_state | ChargeState | Charging State |
robot_id | int | Chassis ID |
power | int | Battery percentage (0—100). - 100: Fully charged. - 0: No charge. |
health | int | Battery Health (full charge capacity / design capacity) |
charge_cycle | int | Charge Cycle Count |
battery_cycle | int | Battery cycle |
temp_max | int | Battery temperature (maximum temperature) |
success | bool | Request success flag. - True: Request succeeded.- False: Request failed to process. |
msg | str | Response message description, typically used to explain why a request could not be processed. |
ChargeState
Section titled “ChargeState”The ChargeState class is an enumerator representing the charging status of the chassis battery.
| Constant Member | Value | Description |
|---|---|---|
UNDEFINED | 0 | Undefined |
NOT | 1 | Not charging |
MANUAL | 2 | Manual charging in progress |
AUTO | 3 | Auto charging in progress |
ChassisState
Section titled “ChassisState”| Attribute | Data Type | Description |
|---|---|---|
robot_id | int | Chassis ID |
state | ChassisStateType | Chassis auto mode status |
success | bool | Request success flag. - True: Request succeeded.- False: Request failed to process. |
msg | str | Response message description, typically used to explain why a request could not be processed. |
ChassisStateType
Section titled “ChassisStateType”The ChassisStateType class is an enumerator representing the chassis state.
| Constant Member | Value | Description |
|---|---|---|
UNDEFINED | 0 | Undefined |
UNINIT | 1 | Uninitialized |
IDLE | 2 | Idle |
PARKING | 3 | Parking |
TASK | 4 | In Task |
WARNING | 5 | Warning |
FAULT | 6 | Fault |
FOLLOWING | 7 | Following |
CHARGING | 8 | Charging |
MAPPING | 9 | Mapping |
ChassisStatusCode
Section titled “ChassisStatusCode”| Attribute | Data Type | Description |
|---|---|---|
robot_id | int | Chassis ID |
code | int | Status code |
time | int | Time |
status_msg | str | Message |
robot_task_id | int | Task ID |
state | StatusCodeRobotState | Chassis auto mode status |
type | ActionType | Action type |
level | StatusLevel | Level |
success | bool | Request success flag. - True: Request succeeded.- False: Request failed to process. |
msg | str | Response message description, typically used to explain why a request could not be processed. |
StatusCodeRobotState
Section titled “StatusCodeRobotState”| Constant Member | Value | Description |
|---|---|---|
UNDEFINED | 0 | Undefined |
UNINIT | 1 | Uninitialized |
IDLE | 2 | Idle |
PARKING | 3 | Parking |
TASK | 4 | In Task |
WARNING | 5 | Warning |
FAULT | 6 | Fault |
FOLLOWING | 7 | Following |
CHARGING | 8 | Charging |
MAPPING | 9 | Mapping |
ActionType
Section titled “ActionType”The ActionType class is an enumerator representing the type of chassis action.
| Constant Member | Value | Description |
|---|---|---|
UNDEFINED | 0 | Undefined |
NAV | 1 | Navigation |
STEP_CTRL | 2 | Step Control |
SECONDPOS_ENTER | 3 | Second Position Enter |
SECONDPOS_QUIT | 4 | Second Position Quit |
CARRY | 5 | Carrying Action |
WAIT | 6 | Wait |
CHARGE | 7 | Charge |
StatusLevel
Section titled “StatusLevel”| Constant Member | Value | Description |
|---|---|---|
NORMAL | 0 | Normal |
TIPS | 1 | Tips |
WARN | 2 | Warning |
FAULT | 3 | Fault |
ChassisHardwareState
Section titled “ChassisHardwareState”| Attribute | Data Type | Description |
|---|---|---|
robot_id | int | Chassis ID |
lidars | list[HardwareStateType] | Repeated Lidar 2 |
cameras | list[HardwareStateType] | Repeated Camera 2 |
success | bool | Request success flag. - True: Request succeeded.- False: Request failed to process. |
msg | str | Response message description, typically used to explain why a request could not be processed. |
HardwareStateType
Section titled “HardwareStateType”| Constant Member | Value | Description |
|---|---|---|
NORMAL | 0 | Normal |
INFO | 1 | Tips |
WARN | 16 | Warning |
FATAL | 17 | Fault |
ChassisTransformStamped
Section titled “ChassisTransformStamped”| Attribute | Data Type | Description |
|---|---|---|
frame_id | str | Frame ID |
secs | int | Seconds |
nsecs | int | Nanoseconds |
child_frame_id | str | Child frame ID |
t_x | float | XYZ-axis coordinate values |
t_y | float | |
t_z | float | |
r_x | float | Quaternion |
r_y | float | |
r_z | float | |
r_w | float |
ChassisOperationState
Section titled “ChassisOperationState”| Attribute | Data Type | Description |
|---|---|---|
robot_id | int | Chassis ID |
nav | NavState | Chassis navigation information |
robot | RobotBit | Chassis bit information |
success | bool | Request success flag. - True: Request succeeded.- False: Request failed to process. |
msg | str | Response message description, typically used to explain why a request could not be processed. |
NavState
Section titled “NavState”| Constant Member | Value | Description |
|---|---|---|
UNDEFINED | 0 | Undefined |
NARROW | 1 | Narrow passage |
GUIDE | 2 | Guide to destination |
INA_LIFT | 3 | In elevator |
IMPEDE | 4 | Obstruct |
QR_CODE | 5 | QR code |
STAGE | 6 | Segment arrival |
RobotBit
Section titled “RobotBit”| Constant Member | Value | Description |
|---|---|---|
UNDEFINED | 0 | Undefined |
TASKABLE | 1 | Taskable |