11 navigator.
moveOnLine(500, targetBrightness, 55);
15 std::vector<int> route{ 8, 12, 13 };
22 std::vector<int> route2 = { 13, 9, 10 };
28 std::vector<int> route3 = { 10, 9, 5, 6, 7, 11 };
31 navigator.
spin(90,
false);
37 return Selector::BlockColor::Red;
39 return Selector::BlockColor::Blue;
41 return Selector::BlockColor::Green;
43 return Selector::BlockColor::Yellow;
45 return Selector::BlockColor::Undefined;
53 std::vector<int> route{ 8, 9, 10, 11 };
101 for(
auto next_n : route) {
102 if(isFirst ==
true) {
105 }
else if(next_n == nowPlace) {
120 if(diffDirection == -1 || diffDirection == 3) {
122 navigator.
spin(110,
false);
126 navigator.
spin(90,
true);
133 std::int8_t offset = 5;
139 std::int8_t diffDirection
140 =
static_cast<std::int8_t
>(nextDirection) - static_cast<std::int8_t>(
nowDirection);
141 std::int16_t black_line_length = 250;
144 black_line_length = 300;
146 if(diffDirection == 0) {
149 }
else if(diffDirection == -1 || diffDirection == 3) {
152 navigator.
spin(110,
false);
155 }
else if(diffDirection == 1 || diffDirection == -3) {
158 navigator.
spin(90,
true);
162 }
else if(remove_block ==
false) {
164 black_line_length -= 100;
165 navigator.
spin(170,
true);
171 black_line_length -= 200;
174 navigator.
spin(170,
true);
181 nowPlace = nextPlace;
200 std::int8_t tmp =
static_cast<std::int8_t
>(
nowDirection) + angle;
215 if(isRight ==
true) {
223 std::int8_t count = 0;
229 if(circle_color == tmp) {
252 blockColor = distinguisher.
getColor();
260 navigator.
move(90, 5);
263 std::int8_t count = 0;
279 navigator.
move(10, 5);
void speakerPlayTone(uint16_t frequency, int32_t duration)
void byeByeBlock()
バックして180ど回転し、来た方向へ戻ります。ブロックを放置するときに使います。
void tslpTsk(int16_t time)
std::array< std::shared_ptr< ColorBlockPlace >, 16 > colorBlockPlaceArray
void moveOnLine(float distance, std::int16_t target, std::int8_t pwm=20, bool is_leftside_line=true)
指定した距離だけライントレースする
void move(float distance, std::int8_t pwm=20)
指定した距離まで走行体を移動させる
BlockSideBySide::Direction getDirection(std::int8_t n1, std::int8_t n2)
void setPid(double p_gain_, double i_gain_, double d_gain_, double target_)
void moveDirection(const std::int8_t &nextPlace, bool remove_block=false)
指定した方角へ移動します。
void runLine(int32_t countL, int32_t countR, int16_t light_value)
bool buttonIsPressedBack()
BlockSideBySide::Direction getChangeDirection(std::int8_t angle)
次に向かうべき方角を切り替えます。
void run(std::int8_t pwm, std::int8_t turn)
void setBlockPositionList(std::vector< std::int8_t > list)
void passCircle(const Color &circle_color)
ブロック置き場を乗り越えます。
void liftDown(std::uint8_t angle, std::int8_t pwm=20)
void back(float distance, std::int8_t pwm=10)
指定した距離まで走行体を後退させる
void demo()
デモです。アリアに従って移動します。
void spin(float angle, bool clockwise=false, std::int8_t pwm=10)
指定した角度まで走行体を回転させる(基本左エッジ)
std::vector< int > exploreNextOperation(std::int8_t currentPosition, BlockColor color)
std::int32_t get_count_R()
void getBlockColor()
ブロックの色を取得し、blockColorに格納します。
void moveOnLineToColor(std::int8_t pwm, std::int16_t target, const Color &circle_color, bool isRight)
指定した色のブロック置き場までライントレースします。
bool isAlreadyAllBlockMoved()
void moveRoute(std::vector< int > &route)
ルートを移動します。
bool isBacksteppingBeforeNextOperation()
Selector::BlockColor convertSelectorColor(const Color &gameColor)
void liftUp(std::uint8_t angle, std::int8_t pwm=20)
BlockSideBySide::Direction nowDirection
今向いてる方角です。
SpeedControl speedControl
std::int32_t get_count_L()