GKD.RoboCtrl
RoboMaster Linux 电控:异步 IO、设备驱动与机器人控制
载入中...
搜索中...
未找到
roboctrl::device 命名空间参考

设备模块 更多...

详细描述

设备模块

类

class  aim_link
 
struct  aim_target
 
class  chassis_base
 底盘的统一控制接口。 更多...
 
class  chassis_registry
 具体底盘实现的运行时工厂注册表。 更多...
 
class  control_pad
 遥控器设备,负责解析上报报文并发布输入状态 更多...
 
struct  control_pad_state
 串口遥控输入的稳定内存表示。 更多...
 
struct  controlled_motor
 被控制算法(例如PID)控制的电机 更多...
 
struct  device_base
 设备基础类,提供判断设备离线的基础功能 更多...
 
class  dji_motor
 DJI 系列电机。 更多...
 
class  dji_motor_group
 将同一 CAN 总线上的电机编组,一次性发送报文。 更多...
 
struct  euler_angle
 以弧度表示的欧拉角快照。 更多...
 
class  gimbal_base
 云台的统一姿态目标接口。 更多...
 
class  gimbal_registry
 具体云台实现的运行时工厂注册表。 更多...
 
class  gimbal_settle
 
class  gkd_sentry_chassis
 
class  gkd_sentry_gimbal
 
struct  imu_base
 IMU 基类,封装常见数据通道。 更多...
 
class  j6006
 
class  m9025
 
struct  motor_base
 
struct  navigation_command
 
class  navigation_link
 
class  referee
 
class  remote_logger
 
class  serial_imu
 
struct  serial_imu_packet
 
struct  serial_imu_sample
 
class  super_cap
 
struct  three_axis
 三轴物理量快照。 更多...
 

概念

concept  device
 设备概念,约束 task() 等接口。
 
concept  chassis
 判断类型是否实现底盘抽象。
 
concept  gimbal
 判断类型是否实现云台抽象。
 
concept  imu
 
concept  motor
 

类型定义

using M9025 = m9025
 

枚举

enum class  control_channel : std::size_t {
  ch0 = 0 , ch1 , ch2 , ch3 ,
  gimbal_pitch_wheel
}
 遥控器模拟通道的统一索引。 更多...
 
enum class  switch_position : std::int32_t { unknown = 0 , up = 1 , down = 2 , middle = 3 }
 遥控器三段开关位置。 更多...
 
enum class  axis : std::size_t {
  roll = 0 , pitch = 1 , yaw = 2 , x = 0 ,
  y = 1 , z = 2
}
 IMU 三轴枚举,兼容姿态/加速度轴序。 更多...
 
enum class  vision_wire_format { legacy_14 , compact_10 }
 

函数

bool is_offline (auto &... devs)
 判断多个设备是否离线
 
fp32 compensated_yaw_rate (fp32 pitch, three_axis gyro)
 
std::optional< serial_imu_packet > decode_serial_imu (std::span< const std::byte > bytes)
 
std::optional< serial_imu_sample > convert_serial_imu (const serial_imu_packet &packet, three_axis angle_sign, three_axis rate_sign, float gyro_scale)
 
template<motor motor_type>
awaitable< void > set_motor (const typename motor_type::info_type::key_type &key, fp32 value)
 设置电机目标状态
 
motor_base & find_motor (std::string_view type, const std::string &name)
 

类型定义说明

◆ M9025

using roboctrl::device::M9025 = typedef m9025

在文件 m9025.h 第 79 行定义.

枚举类型说明

◆ axis

enum class roboctrl::device::axis : std::size_t
strong

IMU 三轴枚举,兼容姿态/加速度轴序。

三轴访问枚举。

在文件 base.hpp 第 23 行定义.

◆ control_channel

enum class roboctrl::device::control_channel : std::size_t
strong

遥控器模拟通道的统一索引。

在文件 controlpad.h 第 17 行定义.

◆ switch_position

enum class roboctrl::device::switch_position : std::int32_t
strong

遥控器三段开关位置。

在文件 controlpad.h 第 19 行定义.

◆ vision_wire_format

enum class roboctrl::device::vision_wire_format
strong

在文件 network_protocol.hpp 第 20 行定义.

函数说明

◆ compensated_yaw_rate()

fp32 roboctrl::device::compensated_yaw_rate ( fp32  pitch,
three_axis  gyro 
)
inline

Body gyro projected onto the yaw axis, as used by the source controller.

在文件 feedback.hpp 第 7 行定义.

被这些函数引用 roboctrl::device::gkd_sentry_gimbal::update().

◆ convert_serial_imu()

std::optional< serial_imu_sample > roboctrl::device::convert_serial_imu ( const serial_imu_packet &  packet,
three_axis  angle_sign,
three_axis  rate_sign,
float  gyro_scale 
)
inline

Validate the converted physical snapshot before publishing a heartbeat.

在文件 serial_imu_codec.hpp 第 37 行定义.

引用了 roboctrl::Pi_f , 以及 roboctrl::utils::rad_format().

◆ decode_serial_imu()

std::optional< serial_imu_packet > roboctrl::device::decode_serial_imu ( std::span< const std::byte >  bytes)
inline

在文件 serial_imu_codec.hpp 第 18 行定义.

◆ find_motor()

motor_base & roboctrl::device::find_motor ( std::string_view  type,
const std::string &  name 
)
inline

在文件 lookup.hpp 第 10 行定义.

◆ is_offline()

bool roboctrl::device::is_offline ( auto &...  devs)

判断多个设备是否离线

参数
devs设备列表
返回
true 有设备离线
false 所有设备都在线

在文件 base.hpp 第 86 行定义.

◆ set_motor()

template<motor motor_type>
awaitable< void > roboctrl::device::set_motor ( const typename motor_type::info_type::key_type &  key,
fp32  value 
)

设置电机目标状态

模板参数
motor_type电机类型
参数
key电机名称
value电机目标状态

示例:

co_await dev::set_motor<my_motor>("motor1", 10.0f);

在文件 base.hpp 第 208 行定义.