|
GKD.RoboCtrl
|
用于存放工具函数的命名空间。 更多...
用于存放工具函数的命名空间。
封装了工具函数,如字节序列转换、角度处理等。
命名空间 | |
| namespace | byte_literals |
| 字节面向的用户字面量命名空间。 | |
类 | |
| struct | control_chain |
| 控制链,将多个控制器串联组合。 更多... | |
| struct | function_arg |
| struct | function_arg< Ret(*)(Arg)> |
| struct | function_arg< Ret(Class::*)(Arg) const > |
| struct | immovable_base |
| 快速继承获得“不可移动”约束的基类。 更多... | |
| class | Matrix |
| struct | not_copyable_base |
| 快速继承获得“不可复制”约束的基类。 更多... | |
| struct | pair |
| 双值绑定结构,兼容 std::pair。 更多... | |
| struct | pid_base |
| PID 控制器基础模板。 更多... | |
| class | ramp |
| 一阶斜坡控制器 (Ramp) 更多... | |
| class | RLS |
| class | singleton_base |
| 提供单例模式的单例基类 更多... | |
概念 | |
| concept | invocable_r |
| 约束可调用对象的返回值。 | |
| concept | instance_of |
| 判断类型是否为某模板的实例。 | |
| concept | immovable |
| 判断类型不可移动。 | |
| concept | not_copyable |
| 判断类型不可复制。 | |
| concept | package |
| 用于约束“可安全作为报文搬运”的平凡类型。 | |
| concept | controller |
| 控制器概念,约束 update/state/构造能力。 | |
| concept | singleton_info |
| 单例信息 | |
| concept | singleton |
| concept | byte_container |
描述具有 data() 与 size() 接口的字节容器。 | |
类型定义 | |
| template<int r, int c> | |
| using | Matrixf = Matrix< r, c, float > |
| using | linear_pid = pid_base< fp32, details::linear_error > |
| 线性 PID 控制器。 | |
| using | rad_pid = pid_base< fp32, details::rad_error > |
| 角度 PID 控制器。 | |
| template<device::motor motor_type> | |
| using | linear_pid_motor = device::controlled_motor< motor_type, linear_pid > |
| 将线性 PID 附着于特定电机类型的别名。 | |
| template<device::motor motor_type> | |
| using | rad_pid_motor = device::controlled_motor< motor_type, rad_pid > |
| 将角度 PID 附着于特定电机类型的别名。 | |
| using | ramp_f = ramp< float > |
float 精度的 Ramp 控制器别名。 | |
| using | ramp_d = ramp< double > |
double 精度的 Ramp 控制器别名。 | |
| template<typename Fn > | |
| using | function_arg_t = typename function_arg< decltype(&Fn::operator())>::type |
函数 | |
| template<controller controller_type> | |
| controller_type | make_controller (const typename controller_type::info_type &info) |
| constexpr fp32 | rad_format (fp32 ang) |
| 将角度限制到[-Pi,Pi]范围内 | |
| template<package T, byte_container C> | |
| T | from_bytes (const C &bytes) |
| 将字节容器内容反序列化为平凡类型。 | |
| template<package T, typename C > requires requires(C& c) { { c.data() } -> std::convertible_to<std::byte*>; { c.size() } -> std::convertible_to<std::size_t>; } | |
| void | to_bytes (const T &t, C &container) |
| 将平凡类型序列化到指定容器。 | |
| auto | now () |
| 记录程序启动后的纳秒级时间戳。 | |
| constexpr uint16_t | make_u16 (uint16_t high, uint16_t low) noexcept |
| 将高低字节组合成无符号 16 位整数。 | |
| constexpr int16_t | make_i16 (int16_t high, int16_t low) noexcept |
| 将高低字节组合成有符号 16 位整数。 | |
| constexpr std::byte | to_byte (std::integral auto v) noexcept |
辅助将整数转换为 std::byte。 | |
| using roboctrl::utils::function_arg_t = typedef typename function_arg<decltype(&Fn::operator())>::type |
| using roboctrl::utils::linear_pid_motor = typedef device::controlled_motor<motor_type, linear_pid> |
在文件 Matrix.hpp 第 483 行定义.
| using roboctrl::utils::rad_pid_motor = typedef device::controlled_motor<motor_type, rad_pid> |
将字节容器内容反序列化为平凡类型。
| T | 目标类型,需满足 package |
| C | 字节容器类型 |
| bytes | 输入字节缓冲 |
| controller_type roboctrl::utils::make_controller | ( | const typename controller_type::info_type & | info | ) |
在文件 controller.hpp 第 84 行定义.
|
inline |
记录程序启动后的纳秒级时间戳。
被这些函数引用 roboctrl::device::device_base::offline(), roboctrl::device::device_base::tick() , 以及 roboctrl::utils::ramp< T >::update().
| void roboctrl::utils::to_bytes | ( | const T & | t, |
| C & | container | ||
| ) |
将平凡类型序列化到指定容器。
| T | 输入类型 |
| C | 可写容器类型 |
| t | 待写入对象 |
| container | 目标容器 |
被这些函数引用 roboctrl::io::bare_io_base::send(), roboctrl::io::send() , 以及 roboctrl::io::send().