]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
Merge branch 'master' of zidekm1@rtime.felk.cvut.cz:/var/git/eurobot
authorMartin Zidek <zidekm1@gmail.com>
Fri, 24 Apr 2009 20:43:45 +0000 (22:43 +0200)
committerMartin Zidek <zidekm1@gmail.com>
Fri, 24 Apr 2009 20:43:45 +0000 (22:43 +0200)
build/ppc/config.target
src/robofsm/competition.cc
src/robofsm/robot_orte.c

index 773caf20aa58c2f4955099ff392f73ab0cb2cb02..2675a96c13064092fda5a97aa347994a92600d2d 100644 (file)
@@ -8,7 +8,7 @@ AR = $(CROSS_COMPILE)ar
 #CONFIG_OC_ETH_ORTE_IDL=y
 
 CFLAGS = -Wall -DCOMPETITION
-CXXFLAGS = -Wall
+CXXFLAGS = $(CFLAGS)
 
 # ##powerpc
 #BROKEN_G++_INCLUDE=y
index a0604fdaf32204cc1d64e055db6a316dd4223341..5939a85988642e27da238ad9c105a9caa49ea056 100644 (file)
@@ -295,8 +295,8 @@ FSM_STATE(init)
 FSM_STATE(wait_for_start)
 {
        pthread_t thid;
-#ifdef COMPETITON
-       printf("COMPETITION mode set");
+#ifdef COMPETITION
+       printf("COMPETITION mode set\n");
 #endif
        switch (FSM_EVENT) {
 #ifdef WAIT_FOR_START
index 2735cea1453421dbe7f4edce87f726900bab67d1..5d341222cad6a4a82c19a7d460a28d8d88cc0930 100644 (file)
@@ -173,13 +173,13 @@ void rcv_robot_cmd_cb(const ORTERecvInfo *info, void *vinstance,
                case NEW_DATA:
                        /* Stupid way of controlling the robot by
                         * pluggin in and out start connector. */
-                       if (instance->start) {
-                               robot.hw_status[STATUS_STA] = HW_STATUS_WARNING;
-                       } else {
-                               robot.hw_status[STATUS_STA] = HW_STATUS_OK;
-                       }
                        switch (robot.state) {
                                case POWER_ON:
+                                       if (instance->start) {
+                                               robot.hw_status[STATUS_STA] = HW_STATUS_WARNING;
+                                       } else {
+                                               robot.hw_status[STATUS_STA] = HW_STATUS_OK;
+                                       }
                                        if (!instance->start) {
                                                robot.state = START_PLUGGED_IN;
                                                printf("START_PLUGGED_IN\n");
@@ -187,6 +187,7 @@ void rcv_robot_cmd_cb(const ORTERecvInfo *info, void *vinstance,
                                        break;
 
                                case START_PLUGGED_IN:
+                                       robot.hw_status[STATUS_STA] = HW_STATUS_OK;
                                        /* Competition starts when plugged out */
                                        if (instance->start) {
                                                FSM_SIGNAL(MAIN, EV_START, NULL);
@@ -195,12 +196,16 @@ void rcv_robot_cmd_cb(const ORTERecvInfo *info, void *vinstance,
                                        }
                                        break;
 
-                               case COMPETITION_STARTED:
+                               case COMPETITION_STARTED: {
                                        /* Subsequent plug-in stops the robot */
+                                       static int num = 0;
                                        if (!instance->start) {
-                                               //robot_exit();
+                                               robot.hw_status[STATUS_STA] = HW_STATUS_WARNING;
+                                               if (++num == 10)
+                                                       robot_exit();
                                        }
                                        break;
+                               }
                        }
                        last_instance = *instance;
                        break;
@@ -317,15 +322,15 @@ void rcv_puck_distance_cb(const ORTERecvInfo *info, void *vinstance,
 void rcv_puck_inside_cb(const ORTERecvInfo *info, void *vinstance,
                            void *recvCallBackParam)
 {
-       static bool previous_switch_status;
        switch (info->status) {
        case NEW_DATA: {
                if (robot.use_back_switch) {
-                       if (robot.orte.puck_inside.status & 0x01) {
+                       static bool previous_switch_status = 0;
+                       if (robot.orte.puck_inside.status & 0x02) {
                                //FSM_SIGNAL(ACT, EV_PUCK_INSIDE, NULL);
 
                                /* React on the first switch or when moving backward. */
-                               if ((previous_switch_status & 0x01) == 0 ||
+                               if ((previous_switch_status & 0x02) == 0 ||
                                    robot.moves_backward) {
                                        FSM_SIGNAL(MOTION, EV_OBSTACLE_BEHIND, NULL);
                                }