Chassis v2.1.1
Chassisはロボコンでの足回り制御を行うためのC++ライブラリである。
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1
3#include <../snippets/Motor.h>
4#include <Odom.h>
5#include <mbed.h>
6
7#include <array>
8#include <functional>
9
10using namespace rct;
11
12Timer timer;
13Odom<3> odom{};
14
15int main() {
16 timer.start();
17 while(1) {
18 // エンコーダ角変位の変化量を引数に渡す
19 odom.integrate({0, 0, 0});
20
21 // 現在座標の取得
22 Coordinate pos = odom.get();
23
24 // 前回からの経過時間を取得
25 auto now = timer.elapsed_time();
26 static decltype(now) pre = {};
27 auto delta = pre - now;
28 pre = now;
29
30 // 速度の取得
31 static Coordinate pre_pos = {};
33 pre_pos = pos;
34
35 printf("pos{x:%d,y:%d:,ang:%d}", (int)pos.x_milli, (int)pos.y_milli, (int)(pos.ang_rad * 180 / M_PI));
36 printf("vel{x:%d,y:%d:,ang:%d}", (int)vel.x_milli, (int)vel.y_milli, (int)(vel.ang_rad * 180 / M_PI));
37 }
38}
オドメトリを行う Odom クラスを提供する。
robot control library
Definition Chassis.h:16
N輪オムニの制御を行うクラス。
Definition Omni.h:25