Revision b1fdaaf6
ID | b1fdaaf62c9a219ee2786b467bc79c908c2e0a70 |
Added toggle for Sonar. Added backsonar indicate
-Sonar can be toggled under Sim -> Sonar
-Front and Back onars now display most recent scan point as a green dot
scout/scoutsim/src/scout.cpp | ||
---|---|---|
233 | 233 |
/// @todo Consider using different cutoffs for different features |
234 | 234 |
while (reading < 128); /// @todo Get rid of hardcoded stuff like this |
235 | 235 |
|
236 |
if(sonar_on == TRUE) |
|
237 |
{ |
|
238 |
// draw a circle at the wall_x, wall_y where reading > 128 |
|
239 |
sonar_dc.SelectObject(*path_bitmap); |
|
240 |
sonar_dc.SetBrush(*wxRED_BRUSH); //old value |
|
241 |
sonar_dc.DrawCircle(wxPoint(old_dx,old_dy), 2); |
|
236 |
if(sonar_on) |
|
237 |
{ |
|
238 |
if(isFront) |
|
239 |
{ |
|
240 |
// draw a circle at the wall_x, wall_y where reading > 128 |
|
241 |
sonar_dc.SelectObject(*path_bitmap); |
|
242 |
sonar_dc.SetBrush(*wxRED_BRUSH); //old value |
|
243 |
sonar_dc.DrawCircle(wxPoint(old_front_dx,old_front_dy), 2); |
|
244 |
old_front_dx = d_x; |
|
245 |
old_front_dy = d_y; |
|
246 |
} |
|
247 |
else |
|
248 |
{ |
|
249 |
// draw a circle at the wall_x, wall_y where reading > 128 |
|
250 |
sonar_dc.SelectObject(*path_bitmap); |
|
251 |
sonar_dc.SetBrush(*wxRED_BRUSH); //old value |
|
252 |
sonar_dc.DrawCircle(wxPoint(old_back_dx,old_back_dy), 2); |
|
253 |
old_back_dx = d_x; |
|
254 |
old_back_dy = d_y; |
|
255 |
} |
|
242 | 256 |
|
243 | 257 |
sonar_dc.SetBrush(*wxGREEN_BRUSH); //newest value |
244 | 258 |
sonar_dc.DrawCircle( wxPoint(d_x,d_y), 2); |
245 |
old_dx = d_x; |
|
246 |
old_dy = d_y; |
|
259 |
if (isFront) //for some reason isFront = (!isFront) is not working |
|
260 |
{ |
|
261 |
isFront = FALSE; |
|
262 |
} |
|
263 |
else |
|
264 |
{ |
|
265 |
isFront = TRUE; |
|
266 |
} |
|
267 |
|
|
247 | 268 |
} |
248 | 269 |
return d; |
249 | 270 |
} |
Also available in: Unified diff