mirs_esp_pio
読み取り中…
検索中…
一致する文字列を見つけられません
VelocityCalculator.hpp
[詳解]
1
7
8#ifndef VELOCITY_CALCULATOR_HPP
9#define VELOCITY_CALCULATOR_HPP
10
11#include <stdint.h>
12
15public:
22 VelocityCalculator(double counts_per_rev, double wheel_radius, double dt_sec);
23
28 void setWheelRadius(double radius);
29
34 void setDeltaTime(double dt_sec);
35
42 double calculate(int32_t current_count, int32_t &prev_count);
43
52 static int64_t wrapDelta(int32_t current_count, int32_t last_count);
53
60 double calculate(int64_t current_count, int64_t &prev_count);
61
72 int32_t current_count_l, int32_t current_count_r,
73 int32_t &prev_count_l, int32_t &prev_count_r,
74 double &vel_l, double &vel_r
75 );
76
87 int64_t current_count_l, int64_t current_count_r,
88 int64_t &prev_count_l, int64_t &prev_count_r,
89 double &vel_l, double &vel_r
90 );
91
92private:
93 double counts_per_rev_;
94 double wheel_radius_;
95 double dt_sec_;
96};
97
98#endif // VELOCITY_CALCULATOR_HPP
VelocityCalculator(double counts_per_rev, double wheel_radius, double dt_sec)
コンストラクタ
void setWheelRadius(double radius)
車輪半径を設定
double calculate(int32_t current_count, int32_t &prev_count)
現在のエンコーダーカウントから速度を計算
void setDeltaTime(double dt_sec)
サンプリング周期を設定
void calculateBothWheels(int32_t current_count_l, int32_t current_count_r, int32_t &prev_count_l, int32_t &prev_count_r, double &vel_l, double &vel_r)
左右両輪の速度を計算
static int64_t wrapDelta(int32_t current_count, int32_t last_count)
int32境界のラップを吸収したカウント差分を返す