mirs_esp_pio
読み取り中…
検索中…
一致する文字列を見つけられません
VelocityCalculator クラス

エンコーダカウント→車輪速度[m/s]の時間微分計算。 [詳解]

#include <VelocityCalculator.hpp>

公開メンバ関数

 VelocityCalculator (double counts_per_rev, double wheel_radius, double dt_sec)
 コンストラクタ
void setWheelRadius (double radius)
 車輪半径を設定
void setDeltaTime (double dt_sec)
 サンプリング周期を設定
double calculate (int32_t current_count, int32_t &prev_count)
 現在のエンコーダーカウントから速度を計算
double calculate (int64_t current_count, int64_t &prev_count)
 ラップ吸収済み累積カウントから速度を計算(int64版)
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)
 左右両輪の速度を計算
void calculateBothWheels (int64_t current_count_l, int64_t current_count_r, int64_t &prev_count_l, int64_t &prev_count_r, double &vel_l, double &vel_r)
 左右両輪の速度を計算(int64累積値版)

静的公開メンバ関数

static int64_t wrapDelta (int32_t current_count, int32_t last_count)
 int32境界のラップを吸収したカウント差分を返す

詳解

エンコーダカウント→車輪速度[m/s]の時間微分計算。

VelocityCalculator.hpp の 14 行目に定義があります。

構築子と解体子

◆ VelocityCalculator()

VelocityCalculator::VelocityCalculator ( double counts_per_rev,
double wheel_radius,
double dt_sec )

コンストラクタ

引数
counts_per_revエンコーダーの1回転あたりのカウント数
wheel_radius車輪半径 [m]
dt_secサンプリング周期 [s]

VelocityCalculator.cpp の 12 行目に定義があります。

関数詳解

◆ calculate() [1/2]

double VelocityCalculator::calculate ( int32_t current_count,
int32_t & prev_count )

現在のエンコーダーカウントから速度を計算

引数
current_count現在のエンコーダーカウント
prev_count前回のエンコーダーカウント(参照で更新される)
戻り値
計算された速度 [m/s]

VelocityCalculator.cpp の 51 行目に定義があります。

◆ calculate() [2/2]

double VelocityCalculator::calculate ( int64_t current_count,
int64_t & prev_count )

ラップ吸収済み累積カウントから速度を計算(int64版)

引数
current_count現在の累積カウント
prev_count前回の累積カウント(参照で更新される)
戻り値
計算された速度 [m/s]

VelocityCalculator.cpp の 43 行目に定義があります。

◆ calculateBothWheels() [1/2]

void VelocityCalculator::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 )

左右両輪の速度を計算

引数
current_count_l現在の左輪エンコーダーカウント
current_count_r現在の右輪エンコーダーカウント
prev_count_l前回の左輪エンコーダーカウント(参照で更新される)
prev_count_r前回の右輪エンコーダーカウント(参照で更新される)
vel_l計算された左輪速度 [m/s](出力)
vel_r計算された右輪速度 [m/s](出力)

VelocityCalculator.cpp の 67 行目に定義があります。

◆ calculateBothWheels() [2/2]

void VelocityCalculator::calculateBothWheels ( int64_t current_count_l,
int64_t current_count_r,
int64_t & prev_count_l,
int64_t & prev_count_r,
double & vel_l,
double & vel_r )

左右両輪の速度を計算(int64累積値版)

引数
current_count_l現在の左輪累積カウント
current_count_r現在の右輪累積カウント
prev_count_l前回の左輪累積カウント(参照で更新される)
prev_count_r前回の右輪累積カウント(参照で更新される)
vel_l計算された左輪速度 [m/s](出力)
vel_r計算された右輪速度 [m/s](出力)

VelocityCalculator.cpp の 58 行目に定義があります。

◆ setDeltaTime()

void VelocityCalculator::setDeltaTime ( double dt_sec)

サンプリング周期を設定

引数
dt_secサンプリング周期 [s]

VelocityCalculator.cpp の 23 行目に定義があります。

◆ setWheelRadius()

void VelocityCalculator::setWheelRadius ( double radius)

車輪半径を設定

引数
radius車輪半径 [m]

VelocityCalculator.cpp の 19 行目に定義があります。

◆ wrapDelta()

int64_t VelocityCalculator::wrapDelta ( int32_t current_count,
int32_t last_count )
static

int32境界のラップを吸収したカウント差分を返す

引数
current_count現在のカウント
last_count前回のカウント
戻り値
current - last を [-2^31, 2^31) で解釈した差分(int64)。 さらに16bit幅への畳み込みでHWカウンタ直読時の折返しにも備える。 1制御周期の真の移動は数百カウント以下であることが前提。

VelocityCalculator.cpp の 27 行目に定義があります。


このクラス詳解は次のファイルから抽出されました: