GKD.RoboCtrl
载入中...
搜索中...
未找到
m9025.h
1
#pragma once
2
#include "
core/async.hpp
"
3
#include "
device/motor/base.hpp
"
4
#include "
utils/pid.h
"
5
6
namespace
roboctrl::device
{
7
8
class
M9025
:
public
motor_base
,
public
logable
<M9025> {
9
public
:
10
struct
info_type
{
11
std::string name;
12
std::string can_name;
13
uint16_t
id;
14
15
utils::linear_pid::params_type
pid_params;
16
fp32
radius;
17
};
18
19
inline
std::string desc()
const
{
20
return
std::format(
"M9025 motor {} on {}"
,info_.name,info_.can_name);
21
}
22
23
M9025
(
const
info_type& info);
24
awaitable<void>
set(
float
speed
);
25
awaitable<void>
enable();
26
27
private
:
28
info_type info_;
29
utils::linear_pid
pid_;
30
};
31
32
static_assert
(
motor<M9025>
);
33
34
}
async.hpp
异步任务上下文组件。
roboctrl::device::M9025
Definition
m9025.h:8
roboctrl::log::logable
用于提供日志功能的辅助基类 通过CRTP模式实现,要求派生类实现desc()方法以提供描述信息,在继承时传入派生类自身类型作为模板参数。 继承这个类后,派生类可以方便地使用log_debug、log_i...
Definition
logger.h:178
base.hpp
电机基础组件。
roboctrl::async::awaitable
asio::awaitable< T > awaitable
协程任务类型。
Definition
async.hpp:42
roboctrl::device
设备模块
Definition
base.hpp:25
pid.h
通用 PID 控制器实现。
roboctrl::device::M9025::info_type
Definition
m9025.h:10
roboctrl::device::motor_base
Definition
base.hpp:63
roboctrl::utils::pid_base::params_type
统一的参数封装,方便序列化。
Definition
pid.h:35
roboctrl::utils::pid_base
PID 控制器基础模板。
Definition
pid.h:21
roboctrl::fp32
float fp32
单精度浮点别名。
Definition
utils.hpp:22
include
device
motor
m9025.h
制作者
1.9.8