36 using key_type = std::string_view;
41 std::string_view name;
42 std::string_view can_name;
45 std::chrono::steady_clock::duration control_time;
46 inline std::string_view key()
const{
return name;}
52 inline std::string
desc()
const{
53 return std::format(
"Dji motor {}",info_.name);
65 inline int16_t current()
const{
return current_;}
67 std::pair<uint16_t,uint16_t> can_pkg_id()
const;
69 friend dji_motor_group;
72 fp32 reduction_ratio_;
88 using key_type = std::string_view;
91 std::string_view can_name;
93 inline std::string_view key()
const{
return can_name;}
95 static inline info_type make(std::string_view can_name){
96 return{.can_name = can_name};
114 inline std::string desc()
const{
return std::format(
"Dji motor group on can({})",info_.can_name);}
123 dji_motor::type type;
126 std::vector<dji_motor*> motors_;
将同一 CAN 总线上的电机编组,一次性发送报文。
awaitable< void > task()
与调度器协同的任务,负责读取反馈等。
void register_motor(dji_motor *motor)
注册单个电机到分组内。
awaitable< void > set(fp32 speed)
设置目标电流或速度(取决于电调模式)。
std::string desc() const
描述信息,用于日志输出。
用于提供日志功能的辅助基类 通过CRTP模式实现,要求派生类实现desc()方法以提供描述信息,在继承时传入派生类自身类型作为模板参数。 继承这个类后,派生类可以方便地使用log_debug、log_i...
asio::awaitable< T > awaitable
协程任务类型。
pid_base< fp32, details::linear_error > linear_pid
线性 PID 控制器。