scoutos / scout / libscout / src / test_behaviors / ApproachEmitter.h @ 64a67b32
History | View | Annotate | Download (2.18 KB)
1 | 9b5d3fff | Hui Jun Tay | /**
|
---|---|---|---|
2 | * Copyright (c) 2011 Colony Project
|
||
3 | *
|
||
4 | * Permission is hereby granted, free of charge, to any person
|
||
5 | * obtaining a copy of this software and associated documentation
|
||
6 | * files (the "Software"), to deal in the Software without
|
||
7 | * restriction, including without limitation the rights to use,
|
||
8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
9 | * copies of the Software, and to permit persons to whom the
|
||
10 | * Software is furnished to do so, subject to the following
|
||
11 | * conditions:
|
||
12 | *
|
||
13 | * The above copyright notice and this permission notice shall be
|
||
14 | * included in all copies or substantial portions of the Software.
|
||
15 | *
|
||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||
17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||
18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||
19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||
20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||
21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||
23 | * OTHER DEALINGS IN THE SOFTWARE.
|
||
24 | */
|
||
25 | |||
26 | #ifndef _APPR_EMITTER_H_
|
||
27 | #define _APPR_EMITTER_H_
|
||
28 | #include "../Behavior.h" |
||
29 | #include "../Sensors.h" |
||
30 | #include "../helper_classes/ScoutPosition.h" |
||
31 | /* Details about map:
|
||
32 | * 1 meter = 200 pixels
|
||
33 | * 1 block is a 13x13 pixel section
|
||
34 | * actual meter x meter map has 15 blocks in one row/column
|
||
35 | * # blocks per robot map row = 2*(block per map's row)-1
|
||
36 | */
|
||
37 | |||
38 | // number of blocks in one row/column of robot's map
|
||
39 | #define MAP_LENGTH 29 |
||
40 | |||
41 | class ApproachEmitter: public Behavior |
||
42 | { |
||
43 | public:
|
||
44 | ApproachEmitter(std::string scoutname, Sensors* sensors); |
||
45 | fb61cb17 | Yuyang (Misty) Guo | void run();
|
46 | private:
|
||
47 | int identifyPosition(std::vector<uint32_t> readings,
|
||
48 | std::vector<uint32_t> senders); |
||
49 | 64a67b32 | Hui Jun Tay | |
50 | bool reverse_park();
|
||
51 | int get_side();
|
||
52 | bool checkBOM(int bNum, unsigned int ID); |
||
53 | void update_readings();
|
||
54 | bool at_destination();
|
||
55 | |||
56 | 9b5d3fff | Hui Jun Tay | std::string name; |
57 | pos* scout_pos; |
||
58 | fb61cb17 | Yuyang (Misty) Guo | std::vector<uint8_t> LEFT; |
59 | std::vector<uint8_t> RIGHT; |
||
60 | std::vector<uint8_t> FRONT; |
||
61 | std::vector<uint8_t> BACK; |
||
62 | 9b5d3fff | Hui Jun Tay | |
63 | 64a67b32 | Hui Jun Tay | int start_side;
|
64 | std::vector<uint32_t> readings; |
||
65 | std::vector<uint32_t> senders; |
||
66 | |||
67 | |||
68 | |||
69 | 9b5d3fff | Hui Jun Tay | }; |
70 | #endif |