{
struct timespec start;
+ sem_wait(&robot.start);
+
clock_gettime(CLOCK_MONOTONIC, &start);
#define WAIT(sec) \
do { \
}
}
+void set_initial_position()
+{
+ robot_set_est_pos_trans(0.16,
+ PLAYGROUND_HEIGHT_M - 0.16,
+ DEG2RAD(-45));
+}
+
FSM_STATE(wait_for_start)
{
pthread_t thid;
printf("COMPETITION mode set\n");
#endif
switch (FSM_EVENT) {
-#ifdef WAIT_FOR_START
case EV_ENTRY:
+ pthread_create(&thid, NULL, timing_thread, NULL);
+#ifdef WAIT_FOR_START
+ FSM_TIMER(1000);
break;
- case EV_START:
-#else
- case EV_ENTRY:
- case EV_START:
#endif
+ case EV_START:
act_camera_off();
/* start competition timer */
- pthread_create(&thid, NULL, timing_thread, NULL);
+ sem_post(&robot.start);
/* FIXME: */
- robot_set_est_pos_trans(0.16,
- PLAYGROUND_HEIGHT_M - 0.16,
- DEG2RAD(-45));
+ set_initial_position();
FSM_TRANSITION(decide_what_next);
- break;
case EV_TIMER:
+ FSM_TIMER(1000);
+ // We set initial position periodically in
+ // order for it to be updated on the display
+ // if the team color is changed during waiting
+ // for start.
+ set_initial_position();
+ break;
case EV_RETURN:
case EV_GOAL_NOT_REACHABLE: // currently not used
case EV_ACTION_DONE: