-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwallfollowertest.cpp
More file actions
39 lines (34 loc) · 868 Bytes
/
wallfollowertest.cpp
File metadata and controls
39 lines (34 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
#include "wallfollower.cpp"
int running=1;
void sig_handler(int signo)
{
if (signo == SIGINT) {
printf("closing PWM nicely\n");
running = 0;
}
};
int main(){
signal(SIGINT, sig_handler);
Motor* left = new Motor(0,2,4,false);
Motor* right = new Motor(4,6,2,true);
Location* location = new Location(0.0,0.0,0.0);
IR* irf = new IR(0);
IR* irr = new IR(1);
IR* irb = new IR(2);
IR* irlf = new IR(4);
IR* irlb = new IR(3);
wf = new Wallfollower(left,right,irlf,irlb,irr,irf,irb,location);
Locating* lct = new Locating();
lct->setup_startpoint;
int channel=1;
bool localized = false;
while(running &&!localized) {
channel = wf->run_follower(channel);
lct->channel_switch(wf->locating_channel());
lct->data(wf->data());
localized = !lct->decision();
}
Location* current = lct->get_location();
}
};