跳转到内容

Chassis::Core API

文档稀疏
符号
69
已记录
49
修订版本
0.1.0+825f1408280d

20 / 69 个公开 API 符号没有说明。

命名空间

4

3

chassis::controller::IChassisController

业务层直接持有的控制器基类。 Motion 负责真正把速度命令下发到轮组 Loc 负责反馈底盘当前状态 Controller 基类负责控制权申请/释放,保证同一时刻只有一个控制器真正驱动底盘 Controller 同时依赖 Motion 和 Loc: 基类保留 acquireControl / releaseControl / enable / disable / stop 这些最基本控制语义, 其他控制能力由子类扩展。 不同 Controller 也可能拆出多个独立更新入口,因此基类不统一要求单一 update()。

Core/IChassisController.hpp:24

chassis::loc::IChassisLoc

定位层基类。 世界系位姿 车体系速度 世界系速度 它对外统一暴露: 同时封装了一组常用坐标变换,避免每个控制器或业务模块都重复写一遍旋转公式。 在接入层里,某些 Loc 后端可能要等到校准完成或首次外部结果到达后才真正构造, 因此业务代码里常会把 Loc 指针先置空,并在周期调用前先检查是否已经构造完成。 update(dt) update() updateLidar(...) 注意:本基类同样不统一规定 update() 形式。不同 Loc 后端可能需要、、等不同入口,具体调用方式由 接入方根据具体实现自行安排。

Core/IChassisLoc.hpp:37

chassis::motion::IChassisMotion

底盘动作系统,仅负责: 把底层轮组组织成统一的“底盘速度输入 / 反馈”模型 执行正逆解算 管理底层执行器的使能状态 它不直接暴露给业务层发送速度命令;真正对外的控制入口应是 Controller。 这里的 Motion 只抽象“全向底盘平面运动”本身。若某些特殊底盘还带有升降、 伸缩等与平面运动独立的自由度,这些自由度不应直接并入本接口,而应在其他 模块中独立抽象后,再与本仓库提供的底盘运动能力组合。 注意:本基类故意不定义统一的 update() 约束。不同 Motion 实现可能需要 不同参数、不同频率、甚至不同名字的更新入口,调用者应按具体实现自行调度。

Core/IChassisMotion.hpp:32

结构体

2

chassis::Posture

底盘位姿。 x/y 所处的世界坐标系由具体定位后端决定,但单位和旋向约定在整个模块内保持一致。

Core/IChassisDef.hpp:33

chassis::Velocity

底盘速度。 x 轴指向车头前方 y 轴指向车体左侧 z 轴向上,逆时针旋转为正 这里约定的是“车体坐标系常用正方向”:

Core/IChassisDef.hpp:19

函数

45

chassis::Posture::operator+

                    Posture chassis::Posture::operator+ (const Posture &rhs) const
                  

上游未提供说明。

Core/IChassisDef.hpp:41

chassis::Posture::operator-

                    Posture chassis::Posture::operator- (const Posture &rhs) const
                  

上游未提供说明。

Core/IChassisDef.hpp:46

chassis::Posture::yawError

                    static float chassis::Posture::yawError (const float current, const float target)
                  

返回 current 相对 target 的最小等效 yaw 误差,单位 deg。

Core/IChassisDef.hpp:52

chassis::Posture::zero

                    static constexpr Posture chassis::Posture::zero ()
                  

上游未提供说明。

Core/IChassisDef.hpp:39

chassis::Velocity::zero

                    static constexpr Velocity chassis::Velocity::zero ()
                  

上游未提供说明。

Core/IChassisDef.hpp:25

chassis::controller::IChassisController::IChassisController

                    chassis::controller::IChassisController::IChassisController (motion::IChassisMotion &chassis_motion, loc::IChassisLoc &chassis_loc)
                  

Controller 在构造时就必须绑定现成的 Motion 和 Loc。

Core/IChassisController.hpp:117

chassis::controller::IChassisController::acquireControl

                    virtual bool chassis::controller::IChassisController::acquireControl ()
                  

申请底盘控制权并进入 stop 状态。 acquireControl() stop() 只做控制权交接,不负责底盘执行器上电。 成功获取控制权后会立即,保证新接手的控制器从安全状态开始工作。 是否成功获取控制权

Core/IChassisController.hpp:44

chassis::controller::IChassisController::applyVelocity

                    void chassis::controller::IChassisController::applyVelocity (const Velocity &velocity)
                  

上游未提供说明。

Core/IChassisController.hpp:126

chassis::controller::IChassisController::disable

                    virtual void chassis::controller::IChassisController::disable ()
                  

直接关闭底盘执行器,同时释放当前控制器对底盘的控制权。

Core/IChassisController.hpp:89

chassis::controller::IChassisController::enable

                    virtual bool chassis::controller::IChassisController::enable ()
                  

使能底盘并申请控制权 enable() 这里的 Controller 应被理解为“更高一层的控制器封装”: 调用它的会继续把使能动作传递给下层 Motion,而 Motion 又会继续把使能传递给更底层的轮组 / 电机控制器。 因此在正常接入里,业务层通常不需要再重复手动使能下层控制器。 是否成功使能底盘并获取控制权

Core/IChassisController.hpp:73

chassis::controller::IChassisController::enabled

                    bool chassis::controller::IChassisController::enabled () const
                  

只有持有控制权,且底层 Motion 已使能并 ready 时,控制器才认为自己可工作。

Core/IChassisController.hpp:103

chassis::controller::IChassisController::hasControl

                    bool chassis::controller::IChassisController::hasControl () const
                  

当前 Controller 是否持有底盘控制权。

Core/IChassisController.hpp:97

chassis::controller::IChassisController::loc

                    const auto & chassis::controller::IChassisController::loc () const
                  

上游未提供说明。

Core/IChassisController.hpp:31

chassis::controller::IChassisController::motion

                    const auto & chassis::controller::IChassisController::motion () const
                  

上游未提供说明。

Core/IChassisController.hpp:30

chassis::controller::IChassisController::postureInWorld

                    auto chassis::controller::IChassisController::postureInWorld () const
                  

上游未提供说明。

Core/IChassisController.hpp:34

chassis::controller::IChassisController::releaseControl

                    virtual void chassis::controller::IChassisController::releaseControl ()
                  

释放底盘控制权,但不关闭底层执行器。

Core/IChassisController.hpp:56

chassis::controller::IChassisController::stop

                    virtual void chassis::controller::IChassisController::stop ()=0
                  

静止底盘 stop 状态应当是控制 motion 锁定在当前位置,即位置环锁定状态

Core/IChassisController.hpp:113

chassis::controller::IChassisController::velocityInBody

                    auto chassis::controller::IChassisController::velocityInBody () const
                  

上游未提供说明。

Core/IChassisController.hpp:32

chassis::controller::IChassisController::velocityInWorld

                    auto chassis::controller::IChassisController::velocityInWorld () const
                  

上游未提供说明。

Core/IChassisController.hpp:33

chassis::controller::IChassisController::~IChassisController

                    virtual chassis::controller::IChassisController::~IChassisController ()
                  

上游未提供说明。

Core/IChassisController.hpp:27

chassis::loc::IChassisLoc::BodyPosture2WorldPosture

                    Posture chassis::loc::IChassisLoc::BodyPosture2WorldPosture (const Posture &posture_in_body) const
                  

把“相对当前车体”的位姿换算回世界系。

Core/IChassisLoc.hpp:84

chassis::loc::IChassisLoc::BodyVelocity2WorldVelocity

                    Velocity chassis::loc::IChassisLoc::BodyVelocity2WorldVelocity (const Velocity &velocity_in_body) const
                  

使用当前朝向,把车体系速度转换为世界系速度。

Core/IChassisLoc.hpp:60

chassis::loc::IChassisLoc::CurrentPostureRelativeTo

                    Posture chassis::loc::IChassisLoc::CurrentPostureRelativeTo (const Posture &base_in_world) const
                  

便捷函数:计算“当前位置相对于某个世界系基准位姿”的相对位姿。

Core/IChassisLoc.hpp:129

chassis::loc::IChassisLoc::IChassisLoc

                    chassis::loc::IChassisLoc::IChassisLoc (motion::IChassisMotion &motion)
                  

Loc 虽然可能还依赖外部传感器,但一定依赖一个 Motion 作为速度输入来源。

Core/IChassisLoc.hpp:41

chassis::loc::IChassisLoc::RelativePosture2WorldPosture

                    static Posture chassis::loc::IChassisLoc::RelativePosture2WorldPosture (const Posture &base_in_world, const Posture &posture_in_base)
                  

已知某个基准位姿在世界系中的位置,把“相对基准”的位姿展开到世界系。

Core/IChassisLoc.hpp:98

chassis::loc::IChassisLoc::WorldPosture2BodyPosture

                    Posture chassis::loc::IChassisLoc::WorldPosture2BodyPosture (const Posture &posture_in_world) const
                  

把世界系位姿换算成“以当前车体为参考”的相对位姿。

Core/IChassisLoc.hpp:66

chassis::loc::IChassisLoc::WorldPosture2RelativePosture

                    static Posture chassis::loc::IChassisLoc::WorldPosture2RelativePosture (const Posture &base_in_world, const Posture &posture_in_world)
                  

已知某个基准位姿在世界系中的位置,把世界系位姿改写成“相对基准”的位姿。

Core/IChassisLoc.hpp:112

chassis::loc::IChassisLoc::WorldVelocity2BodyVelocity

                    Velocity chassis::loc::IChassisLoc::WorldVelocity2BodyVelocity (const Velocity &velocity_in_world) const
                  

使用当前朝向,把世界系速度转换为车体系速度。

Core/IChassisLoc.hpp:54

chassis::loc::IChassisLoc::forwardGetVelocity

                    auto chassis::loc::IChassisLoc::forwardGetVelocity () const
                  

受保护转发:读取 Motion 给出的车体系反馈速度。

Core/IChassisLoc.hpp:138

chassis::loc::IChassisLoc::postureInWorld

                    virtual Posture chassis::loc::IChassisLoc::postureInWorld () const =0
                  

返回世界坐标系位姿。

Core/IChassisLoc.hpp:51

chassis::loc::IChassisLoc::rotateVelocity

                    static Velocity chassis::loc::IChassisLoc::rotateVelocity (const Velocity &inp, const float theta)
                  

二维平面旋转速度向量。角度单位仍是度,内部会转换成弧度。

Core/IChassisLoc.hpp:141

chassis::loc::IChassisLoc::velocityInBody

                    virtual Velocity chassis::loc::IChassisLoc::velocityInBody () const =0
                  

返回车体坐标系速度。

Core/IChassisLoc.hpp:46

chassis::loc::IChassisLoc::velocityInWorld

                    virtual Velocity chassis::loc::IChassisLoc::velocityInWorld () const =0
                  

返回世界坐标系速度。

Core/IChassisLoc.hpp:48

chassis::loc::IChassisLoc::~IChassisLoc

                    virtual chassis::loc::IChassisLoc::~IChassisLoc ()=default
                  

上游未提供说明。

Core/IChassisLoc.hpp:43

chassis::motion::IChassisMotion::IChassisMotion

                    chassis::motion::IChassisMotion::IChassisMotion ()
                  

上游未提供说明。

Core/IChassisMotion.hpp:85

chassis::motion::IChassisMotion::applyVelocity

                    virtual void chassis::motion::IChassisMotion::applyVelocity (const Velocity &velocity)=0
                  

上游未提供说明。

Core/IChassisMotion.hpp:88

chassis::motion::IChassisMotion::currentController

                    controller::IChassisController * chassis::motion::IChassisMotion::currentController () const
                  

当前持有该 Motion 控制权的 Controller。

Core/IChassisMotion.hpp:79

chassis::motion::IChassisMotion::disable

                    virtual void chassis::motion::IChassisMotion::disable ()=0
                  

关闭底层执行器。

Core/IChassisMotion.hpp:39

chassis::motion::IChassisMotion::enable

                    virtual bool chassis::motion::IChassisMotion::enable ()=0
                  

使能底层执行器,返回是否成功进入可工作状态。

Core/IChassisMotion.hpp:37

chassis::motion::IChassisMotion::enabled

                    virtual bool chassis::motion::IChassisMotion::enabled () const =0
                  

查询底层执行器是否已经处于使能状态。

Core/IChassisMotion.hpp:41

chassis::motion::IChassisMotion::forwardGetVelocity

                    virtual Velocity chassis::motion::IChassisMotion::forwardGetVelocity ()=0
                  

正向解算得到当前底盘在车体坐标系下的反馈速度。

Core/IChassisMotion.hpp:53

chassis::motion::IChassisMotion::isReady

                    virtual bool chassis::motion::IChassisMotion::isReady () const =0
                  

是否就位 enabled() isReady() 只表示执行器已经上电/使能;进一步表示该 Motion 已经可以被当成完整底盘使用。像舵轮校准、机构变形、自检这类过程, 都可能出现“enabled 但 not-ready”。

Core/IChassisMotion.hpp:50

chassis::motion::IChassisMotion::releaseController

                    virtual void chassis::motion::IChassisMotion::releaseController (controller::IChassisController *ctrl)
                  

释放控制权;只有当前持有者自己可以释放。

Core/IChassisMotion.hpp:72

chassis::motion::IChassisMotion::tryAcquireController

                    virtual bool chassis::motion::IChassisMotion::tryAcquireController (controller::IChassisController *ctrl)
                  

尝试让某个 Controller 获取该 Motion 的控制权。 同一时刻只允许一个 Controller 真正向 Motion 下发速度命令, 用来避免多个控制器并发写目标。

Core/IChassisMotion.hpp:61

chassis::motion::IChassisMotion::~IChassisMotion

                    virtual chassis::motion::IChassisMotion::~IChassisMotion ()=default
                  

上游未提供说明。

Core/IChassisMotion.hpp:35

变量

10

chassis::controller::IChassisController::loc_

                    loc::IChassisLoc* chassis::controller::IChassisController::loc_
                  

提供底盘状态反馈的定位层

Core/IChassisController.hpp:123

chassis::controller::IChassisController::motion_

                    motion::IChassisMotion* chassis::controller::IChassisController::motion_
                  

真正执行底盘速度命令的运动学层

Core/IChassisController.hpp:122

chassis::loc::IChassisLoc::motion_

                    motion::IChassisMotion* chassis::loc::IChassisLoc::motion_
                  

Loc 读取速度反馈所依赖的 Motion.

Core/IChassisLoc.hpp:135

chassis::motion::IChassisMotion::controller_

                    controller::IChassisController* chassis::motion::IChassisMotion::controller_
                  

当前持有控制权的控制器

Core/IChassisMotion.hpp:93

宏定义

1

文件

4

Core/IChassisDef.hpp

ChassisController 对外统一使用的基础运动学数据结构。 syhanjin 2026-03-15

Core/IChassisDef.hpp

Core/IChassisLoc.hpp

底盘定位层统一接口与坐标变换工具。 syhanjin 2026-03-07

Core/IChassisLoc.hpp