etrobocon2018 feat.KatLab  770af34cce41ae9c30c41303275e1add2daae0c3 (with uncommitted changes)
 全て クラス 名前空間 ファイル 関数 変数 列挙型 列挙値 フレンド マクロ定義 ページ
AIAnswerBlock.cpp
[詳解]
1 
7 #include "AIAnswerBlock.h"
8 
14 void AIAnswerBlock::throwBlock(bool angle_direction)
15 {
16  navigator.spin(35, angle_direction);
17  lifter.liftUp(55, 30);
18  lifter.liftDown(0, 3);
19  navigator.spin(150, angle_direction);
20 }
21 
23 {
24  navigator.moveOnLine(250, target_brightness, 30, true); // 左エッジ
25  navigator.move(100);
26  navigator.spin(100, true); // 100度右回転
27  navigator.moveToColor(250, target_brightness, Color::RED, 30, true); // 左エッジ
28  throwBlock(false); // 左に放る
29 
30  navigator.moveOnLine(100, target_brightness, 30, false); // 右エッジ
31  navigator.move(100);
32  navigator.moveToColor(200, target_brightness, Color::BLUE, 30, false); // 右エッジ
33  throwBlock(true); // 右に放る
34 
35  navigator.moveOnLine(100, target_brightness, 30, false); // 右エッジ
36  navigator.move(50); // 5cmただ進む
37  navigator.spin(100, false); // 100度左回転
38  navigator.moveOnLine(200, target_brightness, 30, false); // 右エッジ
39  navigator.move(100); // 10cmただ進む
40  navigator.spin(100, true); // 100度右回転
41  navigator.moveToColor(200, target_brightness, Color::GREEN, 30, true); // 左エッジ
42  throwBlock(false); // 左に放る
43 
44  navigator.moveOnLine(100, target_brightness, 30, false); // 右エッジ
45  navigator.move(150); // 15cmただ進む
46  navigator.moveToColor(100, target_brightness, Color::YELLOW, 30, false); // 右エッジ
47  throwBlock(true); // 右に放る
48 
49  navigator.moveOnLine(100, target_brightness, 30, true); // 左エッジ
50  navigator.spin(100, false); // 100度左回転
51  navigator.moveOnLine(200, target_brightness, 30, true); // 左エッジ
52  navigator.move(100);
53  navigator.spin(100, true); // 100度右回転
54  navigator.moveToColor(200, target_brightness, Color::RED, 30, true); // 左エッジ
55  // navigator.move(100);
56  throwBlock(false); // 左に放る
57 
58  navigator.moveOnLine(100, target_brightness, 30, false); // 右エッジ
59  navigator.move(150);
60  navigator.moveToColor(100, target_brightness, Color::RED, 30, false); // 右エッジ
61  throwBlock(true); // 右に放る
62 
63  navigator.moveOnLine(100, target_brightness, 30, true); // 左エッジ
64  navigator.move(100);
65  navigator.spin(100, false); // 100度左回転
66  navigator.moveOnLine(150, target_brightness, 30, true);
67 }
68 
69 // ただブロックを00におくだけ
71 {
72  navigator.moveOnLine(250, target_brightness, 30, true); // 左エッジ
73  navigator.move(60);
74  navigator.spin(90, true); // 90度右回転
75  navigator.moveToColor(250, target_brightness, Color::RED, 30, true); // 左エッジ
76  throwBlock(false); // 左に放る
77 
78  navigator.moveOnLine(60, target_brightness, 30, false); // 右エッジ
79  navigator.move(150);
80  navigator.moveToColor(200, target_brightness, Color::BLUE, 30, false); // 右エッジ
81  throwBlock(true); // 右に放る
82 
83  navigator.moveOnLine(100, target_brightness, 30, false); // 右エッジ
84  navigator.move(50); // 5cmただ進む
85  navigator.spin(110, false); // 110度左回転
86  navigator.moveOnLine(750, target_brightness, 30, true); // 左エッジ
87 }
void moveOnLine(float distance, std::int16_t target, std::int8_t pwm=20, bool is_leftside_line=true)
指定した距離だけライントレースする
Definition: Navigator.cpp:163
void move(float distance, std::int8_t pwm=20)
指定した距離まで走行体を移動させる
Definition: Navigator.cpp:48
void moveToColor(float distance, std::int16_t target_brightness, Color target_color, std::int8_t speed=20, bool is_leftside_line=true)
指定した距離分ライントレースして指定した色があると停止する
Definition: Navigator.cpp:211
void liftDown(std::uint8_t angle, std::int8_t pwm=20)
Definition: Lifter.cpp:45
AIアンサーのブロックを並べる
void spin(float angle, bool clockwise=false, std::int8_t pwm=10)
指定した角度まで走行体を回転させる(基本左エッジ)
Definition: Navigator.cpp:25
void block00()
アナログ数字が0,デジタル数字が0
void throwBlock(bool angle_direction=false)
リフターを使ってブロックを放って後ろを向く
void block01()
アナログ数字が0,デジタル数字が1
void liftUp(std::uint8_t angle, std::int8_t pwm=20)
Definition: Lifter.cpp:33