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

#include <c6x0.hpp>

tutrcos::module::C6x0 の継承関係図
tutrcos::module::C6x0 連携図

クラス

class  Manager
 

公開型

enum class  Type { C610 , C620 }
 
enum class  ID {
  _1 , _2 , _3 , _4 ,
  _5 , _6 , _7 , _8
}
 

公開メンバ関数

 C6x0 (Manager &manager, Type type, ID id)
 
 ~C6x0 ()
 
float get_rps () override
 
float get_rpm () override
 
int16_t get_current ()
 
void set_current (int16_t current)
 
- 基底クラス tutrcos::module::EncoderBase に属する継承公開メンバ関数
 EncoderBase (int64_t cpr)
 
virtual ~EncoderBase ()
 
int64_t get_cpr ()
 
int64_t get_count ()
 
virtual float get_rotation ()
 
virtual float get_rad ()
 
virtual float get_degree ()
 
virtual float get_radps ()
 
virtual float get_radpm ()
 

その他の継承メンバ

- 基底クラス tutrcos::module::EncoderBase に属する継承限定公開メンバ関数
void set_count (int64_t count)
 

詳解

FDCAN の Classic CAN モードを用いて C610 と通信を行う場合は、tutrcos::peripheral::FDCAN を用いて構築してください。

#include <cstdio>
#include <tutrcos.hpp>
extern UART_HandleTypeDef huart2;
extern CAN_HandleTypeDef hcan1;
extern "C" void main_thread(void *) {
using namespace tutrcos::core;
using namespace tutrcos::peripheral;
using namespace tutrcos::module;
UART uart2(&huart2); // デバッグ出力用
uart2.enable_stdout();
CAN can1(&hcan1);
C6x0::Manager c610_manager(can1);
C6x0 c610_1(c610_manager, C6x0::Type::C610, C6x0::ID::_1);
while (true) {
c610_manager.update(); // データ送受信
float Kp = 100;
float v_target = 100.0f;
// 現在の速度をrpsで取得
float v_actual = c610_1.get_rps();
float error = v_target - v_actual;
// 電流値をmAで指定
c610_1.set_current(Kp * error);
// M2006の回転速度と絶対位置を出力
printf("%f %f\r\n", c610_1.get_rps(), c610_1.get_rotation());
Thread::delay(10);
}
}
Definition c6x0.hpp:77
Definition c6x0.hpp:59
Definition can.hpp:17
Definition uart.hpp:51
Definition kernel.hpp:8
Definition amt21.hpp:13
Definition can.hpp:15

列挙型メンバ詳解

◆ ID

enum class tutrcos::module::C6x0::ID
strong
列挙値
_1 
_2 
_3 
_4 
_5 
_6 
_7 
_8 

◆ Type

enum class tutrcos::module::C6x0::Type
strong
列挙値
C610 
C620 

構築子と解体子

◆ C6x0()

tutrcos::module::C6x0::C6x0 ( Manager & manager,
Type type,
ID id )
inline

◆ ~C6x0()

tutrcos::module::C6x0::~C6x0 ( )
inline

関数詳解

◆ get_current()

int16_t tutrcos::module::C6x0::get_current ( )
inline

◆ get_rpm()

float tutrcos::module::C6x0::get_rpm ( )
inlineoverridevirtual

tutrcos::module::EncoderBaseを再実装しています。

◆ get_rps()

float tutrcos::module::C6x0::get_rps ( )
inlineoverridevirtual

tutrcos::module::EncoderBaseを再実装しています。

◆ set_current()

void tutrcos::module::C6x0::set_current ( int16_t current)
inline

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