GKD.RoboCtrl
RoboMaster Linux 电控:异步 IO、设备驱动与机器人控制
载入中...
搜索中...
未找到
serial_imu.hpp
1#pragma once
2
3#include <string>
4
5#include "device/imu/base.hpp"
6
7namespace roboctrl::device{
8class serial_imu : public imu_base {
9public:
10 struct info_type{
11 using key_type = std::string;
12 using owner_type = serial_imu;
13
14 std::string name;
15 std::string serial_name;
16 fp32 roll_sign {1.0f}, pitch_sign {1.0f}, yaw_sign {1.0f};
17 fp32 roll_rate_sign {1.0f}, pitch_rate_sign {1.0f}, yaw_rate_sign {1.0f};
18 // Preserves the legacy raw conversion; producer units need bench verification.
19 fp32 gyro_scale {Pi_f / 180.0f / 1000.0f};
20 const std::string& key()const{
21 return name;
22 }
23 };
24
25 inline std::string desc()const{return std::format("serial_imu {} on serial {}",info_.name,info_.serial_name);}
26
27 serial_imu(const info_type& info);
28private:
29 info_type info_;
30};
31
32static_assert(imu<serial_imu>);
33};
IMU 抽象基类。
IMU 基类,封装常见数据通道。
Definition base.hpp:36
constexpr auto Pi_f
单精度浮点类型的 Pi 常量。
Definition utils.hpp:34
float fp32
单精度浮点别名。
Definition utils.hpp:22