TechTheTime-HighLevel 0.0.1
The high level robot's code using ros2-foxy for the robotics competition(Erobot-2022)
script.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "../client/ActionClient.hpp"
4#include "action_msg_srv/srv/order.hpp"
5#include <action_msg_srv_shared/order_codes.hpp>
6#include <functional>
7#include <deque>
8#include <variant>
9#include <unordered_map>
10#include <fstream>
11
12class Script{
13 public:
14
15 using void_profile_T = std::function<void()>;
16 using move_profile_T = std::function<void(double, double)>;
17 using actuator_profile_T = std::function<void(double, int)>;
18 using id_profile_T = std::function<void(int)>;
19
20 using order_profile_T = std::variant<
25 >;
26
27 Script();
28
29 void parse_script(const char* script_file);
30
31 void wait_for_jumper();
32 void move(double, double);
33 void moveREL(double, int);
34 void angleABS(double, int);
35
36 void take_statue();
37 void drop_statue();
38 void drop_replic();
39
40 void reverse_palet(int);
41 void mesure();
42 void knock_over();
43
44 void down_servos();
45 void up_servos();
46
47 void take_palet_vertical(int);
48 void take_palet_horizontal(int);
49 void take_palet_ground(int);
50
51 void drop_palet_gallery(int);
52 void drop_palet_ground(int);
53
54 void pushOrder(std::function<void()>);
55 void run();
56
57 bool treat_response(MotionStatusCodes status, std::function<void()> OrderToReinsert, bool reinsert);
58
59 private:
60 std::shared_ptr<ActionClient> commClient;
61 std::deque<std::function<void()>> deque_order;
62 std::unordered_map<std::string, order_profile_T> orders{};
63};
Definition: script.hpp:12
void take_palet_horizontal(int)
Definition: script.cpp:182
void run()
Definition: script.cpp:147
std::unordered_map< std::string, order_profile_T > orders
Definition: script.hpp:62
void drop_statue()
Definition: script.cpp:366
std::deque< std::function< void()> > deque_order
Definition: script.hpp:61
void reverse_palet(int)
Definition: script.cpp:284
void down_servos()
Definition: script.cpp:431
void moveREL(double, int)
Definition: script.cpp:490
std::variant< void_profile_T, move_profile_T, actuator_profile_T, id_profile_T > order_profile_T
Definition: script.hpp:25
void drop_palet_gallery(int)
Definition: script.cpp:257
void pushOrder(std::function< void()>)
Definition: script.cpp:143
void knock_over()
Definition: script.cpp:394
void mesure()
Definition: script.cpp:408
void drop_replic()
Definition: script.cpp:380
void drop_palet_ground(int)
Definition: script.cpp:232
void wait_for_jumper()
Definition: script.cpp:138
bool treat_response(MotionStatusCodes status, std::function< void()> OrderToReinsert, bool reinsert)
Definition: script.cpp:116
void take_palet_ground(int)
Definition: script.cpp:207
void move(double, double)
Definition: script.cpp:560
std::function< void()> void_profile_T
Definition: script.hpp:15
std::function< void(int)> id_profile_T
Definition: script.hpp:18
std::function< void(double, double)> move_profile_T
Definition: script.hpp:16
void angleABS(double, int)
Definition: script.cpp:453
void parse_script(const char *script_file)
Definition: script.cpp:59
void take_statue()
Definition: script.cpp:352
Script()
Definition: script.cpp:30
void take_palet_vertical(int)
Definition: script.cpp:157
std::function< void(double, int)> actuator_profile_T
Definition: script.hpp:17
std::shared_ptr< ActionClient > commClient
Definition: script.hpp:60
void up_servos()
Definition: script.cpp:442