One Motor
0.5.1
RoboMaster全平台一站式电机驱动库
载入中...
搜索中...
未找到
DeltaT.hpp
浏览该文件的文档.
1
7
#ifndef DELTAT_HPP
8
#define DELTAT_HPP
9
10
#ifdef ONE_MOTOR_LINUX
11
#include <chrono>
12
#endif
13
14
#include "
Arithmetic.hpp
"
15
16
namespace
OneMotor::Util
17
{
26
template
<Arithmetic T =
float
>
27
class
DeltaT
28
{
29
public
:
33
DeltaT
();
34
39
T
getDeltaMS
();
40
45
void
reset
();
46
47
private
:
48
#ifdef ONE_MOTOR_LINUX
49
std::chrono::time_point<std::chrono::steady_clock> last_time;
50
#endif
51
};
52
}
53
54
#endif
//DELTAT_HPP
Arithmetic.hpp
定义了一个C++20概念,用于约束模板参数必须为算术类型。
OneMotor::Util::DeltaT::DeltaT
DeltaT()
构造函数,初始化计时器。
定义
L_DeltaT.cpp:6
OneMotor::Util::DeltaT::getDeltaMS
T getDeltaMS()
获取自上次调用以来经过的时间。
定义
L_DeltaT.cpp:12
OneMotor::Util::DeltaT::reset
void reset()
重置计时器。
定义
L_DeltaT.cpp:21
include
OneMotor
Util
DeltaT.hpp
制作者
1.13.2