Skip to content

Chassis APIs

The ChassisFactory class provides the following method for creating a chassis instance.

  • Method:

    create_chassis_from_config(config_file: str) -> ChassisInterface
  • Parameter:

    ParameterDescription
    config_path

    Path 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.

The ChassisFactoryParam class is used to describe the parameters required to create a chassis instance.

AttributeData TypeDescription
chassis_typestrChassis vendor
chassis_namestrChassis name (e.g., "chassis")
ipstrIP address (e.g., "127.0.0.1")
portintPort number (e.g., 54051)

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.

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.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

You can disconnect from the chassis using the following method.

  • Method:

    disconnect(self) -> alphabot.core.AbcErrorCode
  • Return Value:

    AbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    get_pose_speed(self) -> tuple[alphabot.core.AbcErrorCode, ChassisPoseSpeed]
  • Return Value:

    A tuple containing two elements.

    Element TypeDescription
    AbcErrorCodeAbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.
    ChassisPoseSpeedThe chassis pose and speed. For details, please refer to ChassisPoseSpeed.
  • Method:

    get_pose(self) -> tuple[alphabot.core.AbcErrorCode, ChassisPose2D]
  • Return Value:

    A tuple containing two elements.

    Element TypeDescription
    AbcErrorCodeAbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.
    ChassisPose2DThe chassis pose. For details, please refer to ChassisPose2D.
  • Method:

    get_speed(self) -> tuple[alphabot.core.AbcErrorCode, ChassisTwist]
  • Return Value:

    A tuple containing two elements.

    Element TypeDescription
    AbcErrorCodeAbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.
    ChassisTwistThe chassis speed. For details, please refer to ChassisTwist.
  • Method:

    get_mileage(self) -> tuple[alphabot.core.AbcErrorCode, int]
  • Return Value:

    A tuple containing two elements.

    Element TypeDescription
    AbcErrorCodeAbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.
    intAccumulated mileage.
  • Method:

    get_battery(self) -> tuple[alphabot.core.AbcErrorCode, ChassisBattery]
  • Return Value:

    A tuple containing two elements.

    Element TypeDescription
    AbcErrorCodeAbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.
    ChassisBatteryThe chassis battery information. For details, please refer to ChassisBattery.
  • Method:

    get_robot_state(self) -> tuple[alphabot.core.AbcErrorCode, ChassisState]
  • Return Value:

    A tuple containing two elements.

    Element TypeDescription
    AbcErrorCodeAbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.
    ChassisStateThe chassis status. For details, please refer to ChassisState.
  • Method:

    get_status_code(self) -> tuple[alphabot.core.AbcErrorCode, ChassisStatusCode]
  • Return Value:

    A tuple containing two elements.

    Element TypeDescription
    AbcErrorCodeAbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.
    ChassisStatusCodeThe chassis status code. For details, please refer to ChassisStatusCode.
  • Method:

    get_hardware_state(self) -> tuple[alphabot.core.AbcErrorCode, ChassisHardwareState]
  • Return Value:

    A tuple containing two elements.

    Element TypeDescription
    AbcErrorCodeAbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.
    ChassisHardwareStateThe hardware status of the chassis. For details, please refer to ChassisHardwareState.
  • Method:

    get_static_tf(self) -> tuple[alphabot.core.AbcErrorCode, list[ChassisTransformStamped]]
  • Return Value:

    A tuple containing two elements.

    Element TypeDescription
    AbcErrorCodeAbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.
    list[ChassisTransformStamped]Chassis static transforms. For details, please refer to ChassisTransformStamped.
  • Method:

    twist_control(self, linear: float, angular: float) -> alphabot.core.AbcErrorCode
  • Parameters:

    Parameter
    Description
    linearLinear velocity
    angularAngular velocity
  • Return Value:

    AbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    set_max_speed(self, max_spd: float) -> alphabot.core.AbcErrorCode
  • Parameter:

    Parameter
    Description
    max_spdMaximum speed
  • Return Value:

    AbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    init_robot(self, pose: ChassisPose2D, update_flg: int) -> alphabot.core.AbcErrorCode
  • Parameters:

    Parameter
    Description
    poseThe chassis pose. For details, please refer to ChassisPose2D.
    update_flgFlag indicating whether to update the chassis pose.
  • Return Value:

    AbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    move_to_point_sync(
    self,
    x: float,
    y: float,
    theta: float,
    callback: typing.Callable,
    max_spd: float = 1.0
    ) -> alphabot.core.AbcErrorCode
  • Parameters:

    Parameter
    Description
    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.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    to_charge_sync(self, max_spd: float = 1.0) -> alphabot.core.AbcErrorCode
  • Parameter:

    Parameter
    Description
    max_spdMaximum speed
  • Return Value:

    AbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    exit_charge_sync(self, max_spd: float = 1.0) -> alphabot.core.AbcErrorCode
  • Parameter:

    Parameter
    Description
    max_spdMaximum speed
  • Return Value:

    AbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    move_straight_sync(
    self,
    distance: float,
    speed: float,
    callback: typing.Callable,
    use_avoid: bool = True
    ) -> alphabot.core.AbcErrorCode
  • Parameters:

    Parameter
    Description
    distanceTravel distance.
    speedTravel speed.
    callbackCallback function.
    use_avoidWhether to enable obstacle avoidance.
  • Return Value:

    AbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    move_rotate_sync(
    self,
    angle: float,
    speed: float,
    callback: typing.Callable,
    use_avoid: bool = True
    ) -> alphabot.core.AbcErrorCode
  • Parameters:

    Parameter
    Description
    angleRotation angle.
    speedRotation speed.
    callbackCallback function.
    use_avoidWhether to enable obstacle avoidance.
  • Return Value:

    AbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    get_local_footprint(self) -> tuple[alphabot.core.AbcErrorCode, list[ChassisPoint32]]
  • Return Value:

    A tuple containing two elements.

    Element TypeDescription
    AbcErrorCodeAbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.
    list[ChassisPoint32]Local footprint points. For details, please refer to ChassisPoint32.
  • Method:

    get_global_footprint(self) -> tuple[alphabot.core.AbcErrorCode, list[ChassisPoint32]]
  • Return Value:

    A tuple containing two elements.

    Element TypeDescription
    AbcErrorCodeAbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.
    list[ChassisPoint32]Global footprint points. For details, please refer to ChassisPoint32.
  • Method:

    get_all_footprint(self) -> tuple[alphabot.core.AbcErrorCode, tuple[list[ChassisPoint32], list[ChassisPoint32]]]
  • Return Value:

    A tuple containing two elements.

    Element TypeDescription
    AbcErrorCodeAbcErrorCode.SUCCESS indicates 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.
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 TypeDescription
    AbcErrorCodeAbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.
    list[ChassisPoint32]Footprint points. For details, please refer to ChassisPoint32.
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 TypeDescription
    AbcErrorCodeAbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.
    list[ChassisPoint32]Footprint points. For details, please refer to ChassisPoint32.
  • Method:

    ai2_get_all_footprint(self) -> tuple[alphabot.core.AbcErrorCode, tuple[list[ChassisPoint32], list[ChassisPoint32]]]
  • Return Value:

    A tuple containing two elements.

    Element TypeDescription
    AbcErrorCodeAbcErrorCode.SUCCESS indicates 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.
  • Method:

    set_local_footprint(self, points: list[ChassisPoint32]) -> alphabot.core.AbcErrorCode
  • Parameter:

    Parameter
    Description
    pointsLocal footprint points. For details, please refer to ChassisPoint32.
  • Return Value:

    AbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    set_global_footprint(self, points: list[ChassisPoint32]) -> alphabot.core.AbcErrorCode
  • Parameter:

    Parameter
    Description
    pointsGlobal footprint points. For details, please refer to ChassisPoint32.
  • Return Value:

    AbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    set_all_footprint(self, local_points: list[ChassisPoint32], global_points: list[ChassisPoint32]) -> alphabot.core.AbcErrorCode
  • Parameters:

    Parameter
    Description
    local_pointsLocal footprint points. For details, please refer to ChassisPoint32.
    global_pointsGlobal footprint points. For details, please refer to ChassisPoint32.
  • Return Value:

    AbcErrorCode.SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    get_name(self) -> str
  • Return Value:

    The name of the chassis instance.

AttributeData TypeDescription
map_idintMap ID
mileageintAccumulated mileage
robot_idintChassis ID
poseChassisPose2D2D pose
twistChassisTwistTwist (linear + angular velocity)

The ChassisPose2D class represents the 2D pose of a chassis.

AttributeData TypeDescription
thetafloatOrientation
xfloatX-axis coordinate value
yfloatY-axis coordinate value

The ChassisPoint32 class represents the position of a footprint point.

AttributeData TypeDescription
xfloatX-axis coordinate value
yfloatY-axis coordinate value
zfloatZ-axis coordinate value
AttributeData TypeDescription
angularfloatAngular velocity
linearfloatLinear velocity
AttributeData TypeDescription
charge_stateChargeStateCharging State
robot_idintChassis ID
powerintBattery percentage (0—100).
- 100: Fully charged.
- 0: No charge.
healthintBattery Health (full charge capacity / design capacity)
charge_cycleintCharge Cycle Count
battery_cycleintBattery cycle
temp_maxintBattery temperature (maximum temperature)
successboolRequest success flag.
- True: Request succeeded.
- False: Request failed to process.
msgstrResponse message description, typically used to explain why a request could not be processed.

The ChargeState class is an enumerator representing the charging status of the chassis battery.

Constant MemberValueDescription
UNDEFINED0Undefined
NOT1Not charging
MANUAL2Manual charging in progress
AUTO3Auto charging in progress
AttributeData TypeDescription
robot_idintChassis ID
stateChassisStateTypeChassis auto mode status
successboolRequest success flag.
- True: Request succeeded.
- False: Request failed to process.
msgstrResponse message description, typically used to explain why a request could not be processed.

The ChassisStateType class is an enumerator representing the chassis state.

Constant MemberValueDescription
UNDEFINED0Undefined
UNINIT1Uninitialized
IDLE2Idle
PARKING3Parking
TASK4In Task
WARNING5Warning
FAULT6Fault
FOLLOWING7Following
CHARGING8Charging
MAPPING9Mapping
AttributeData TypeDescription
robot_idintChassis ID
codeintStatus code
timeintTime
status_msgstrMessage
robot_task_idintTask ID
stateStatusCodeRobotStateChassis auto mode status
typeActionTypeAction type
levelStatusLevelLevel
successboolRequest success flag.
- True: Request succeeded.
- False: Request failed to process.
msgstrResponse message description, typically used to explain why a request could not be processed.
Constant MemberValueDescription
UNDEFINED0Undefined
UNINIT1Uninitialized
IDLE2Idle
PARKING3Parking
TASK4In Task
WARNING5Warning
FAULT6Fault
FOLLOWING7Following
CHARGING8Charging
MAPPING9Mapping

The ActionType class is an enumerator representing the type of chassis action.

Constant MemberValueDescription
UNDEFINED0Undefined
NAV1Navigation
STEP_CTRL2Step Control
SECONDPOS_ENTER3Second Position Enter
SECONDPOS_QUIT4Second Position Quit
CARRY5Carrying Action
WAIT6Wait
CHARGE7Charge
Constant MemberValueDescription
NORMAL0Normal
TIPS1Tips
WARN2Warning
FAULT3Fault
AttributeData TypeDescription
robot_idintChassis ID
lidarslist[HardwareStateType]Repeated Lidar 2
cameraslist[HardwareStateType]Repeated Camera 2
successboolRequest success flag.
- True: Request succeeded.
- False: Request failed to process.
msgstrResponse message description, typically used to explain why a request could not be processed.
Constant MemberValueDescription
NORMAL0Normal
INFO1Tips
WARN16Warning
FATAL17Fault
AttributeData TypeDescription
frame_idstrFrame ID
secsintSeconds
nsecsintNanoseconds
child_frame_idstrChild frame ID
t_xfloatXYZ-axis coordinate values
t_yfloat
t_zfloat
r_xfloatQuaternion
r_yfloat
r_zfloat
r_wfloat
AttributeData TypeDescription
robot_idintChassis ID
navNavStateChassis navigation information
robotRobotBitChassis bit information
successboolRequest success flag.
- True: Request succeeded.
- False: Request failed to process.
msgstrResponse message description, typically used to explain why a request could not be processed.
Constant MemberValueDescription
UNDEFINED0Undefined
NARROW1Narrow passage
GUIDE2Guide to destination
INA_LIFT3In elevator
IMPEDE4Obstruct
QR_CODE5QR code
STAGE6Segment arrival
Constant MemberValueDescription
UNDEFINED0Undefined
TASKABLE1Taskable