FSM_STATE(to_cntainer_and_unld)
{
+ TrajectoryConstraints tcNotSoFast = trajectoryConstraintsDefault;
+ tcNotSoFast.maxv = 0.5; tcNotSoFast.maxacc = 0.3; tcNotSoFast.maxomega = 2;
switch(FSM_EVENT) {
case EV_ENTRY:
- robot_goto_trans(PLAYGROUND_WIDTH_M-0.35, 0.45, ARRIVE_FROM(DEG2RAD(90),0.05), &tcFast);
+ robot_goto_trans(PLAYGROUND_WIDTH_M-0.35, 0.45, ARRIVE_FROM(DEG2RAD(90),0.05), &tcNotSoFast);
break;
case EV_MOTION_DONE:
FSM_TIMER(1000); // FIXME: test this
switch(FSM_EVENT) {
case EV_ENTRY:
move_cnt = 0;
- robot_move_by(-0.05, NO_TURN(), &tcSlow);
+ robot_move_by(-0.05, NO_TURN(), &tcJerk);
break;
case EV_MOTION_DONE:
if (move_cnt == 0) {
where_to_go = TURN_AROUND;
break;
case EV_MOTION_DONE:
- FSM_TRANSITION(rush_corns_decider);
+ FSM_TRANSITION(rush_last_cms);
break;
case EV_START:
case EV_TIMER:
}
}
+FSM_STATE(rush_last_cms)
+{
+ static char move_cnt;
+ switch(FSM_EVENT) {
+ case EV_ENTRY:
+ robot.ignore_hokuyo = true;
+ robot.check_turn_safety = false;
+ move_cnt = 0;
+ robot_move_by(0.08, NO_TURN(), &tcSlow);
+ break;
+ case EV_MOTION_DONE:
+ if (move_cnt == 0) {
+ robot_move_by(-0.08, NO_TURN(), &tcSlow);
+ } else if (move_cnt > 0) {
+ FSM_TRANSITION(rush_corns_decider);
+ }
+ move_cnt++;
+ break;
+ case EV_START:
+ case EV_TIMER:
+ case EV_RETURN:
+ case EV_VIDLE_DONE:
+ case EV_MOTION_ERROR:
+ case EV_SWITCH_STRATEGY:
+ DBG_PRINT_EVENT("unhandled event");
+ case EV_EXIT:
+ robot.ignore_hokuyo = false;
+ robot.check_turn_safety = true;
+ break;
+ }
+}
+
// used to perform the maneuvre
FSM_STATE(turn_around)
{
FSM_STATE_DECL(rush_corns_decider);
FSM_STATE_DECL(approach_next_corn);
FSM_STATE_DECL(rush_the_corn);
+FSM_STATE_DECL(rush_last_cms);
FSM_STATE_DECL(turn_around);
FSM_STATE_DECL(approach_the_slope);