FSM_STATE(movement)
{
+ static int obstacle_cntr = 0;
+
switch (FSM_EVENT) {
case EV_ENTRY:
break;
break;
case EV_OBSTACLE:
stop();
+ if (obstacle_cntr++ > 5) {
+ FSM_SIGNAL(MAIN, EV_MOTION_ERROR, NULL);
+ FSM_TRANSITION(wait_for_command);
+ break;
+ }
switch (recalculate_trajectory()) {
// We can go to the target:
case TARGET_OK: break;
case TARGET_OK: FSM_TRANSITION(movement); break;
// Target inaccessible because of an obstacle
case TARGET_INACC:
- if (++target_inacc_cnt < 5) {
+ if (++target_inacc_cnt < 3) {
FSM_TRANSITION(wait_and_try_again);
ul_logerr("Inaccessible\n");
FSM_TIMER(1000);
/* FIXME (Filip): this could happen forever */
- } else { /* go away if the point is not accessible, try max. 5x */
+ } else { /* go away if the point is not accessible, try max. 3x */
target_inacc_cnt = 0;
FSM_TRANSITION(wait_for_command);
FSM_SIGNAL(MAIN, EV_MOTION_ERROR, NULL);