Revision 1094
simulating rangefinder and smart run around
changed the position of IR sensors defined in libsim
libsim and libdragonfly use different numbering for IRs (#418, #419)
added smart_run_around to template, right now it just hits wall, backs
up then segfaults
rangefinders.c | ||
---|---|---|
6 | 6 |
#include "world.h" |
7 | 7 |
|
8 | 8 |
//TODO: These need to be measured... |
9 |
double rf_thetas[5] = {0.0, 2*M_PI/5, 4*M_PI/5, 6*M_PI/5, 8*M_PI/5};
|
|
9 |
double rf_thetas[5] = {8*M_PI/5, 0.0, 2*M_PI/5, 4*M_PI/5, 6*M_PI/5};
|
|
10 | 10 |
//double rf_thetas[5] = {0.0, 0.0, M_PI/2, M_PI, 3*M_PI/2}; |
11 | 11 |
|
12 | 12 |
void update_rangefinders(Robot *bot) |
... | ... | |
24 | 24 |
{ |
25 | 25 |
rf.d = theta + rf_thetas[ir]; |
26 | 26 |
x = collide_world(&rf); |
27 |
//printf("@(%g) - [%d] = %g --> %d\n",rf.d, ir, x, (short)x); |
|
27 |
// printf("@(%g) - [%d] = %g --> %d\n",rf.d, ir, x, (short)x);
|
|
28 | 28 |
bot->shared->ranges.d[ir] = x; |
29 | 29 |
} |
30 | 30 |
} |
Also available in: Unified diff