]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
Merge branch 'master' of kubiaj1@rtime.felk.cvut.cz:/var/git/eurobot
authorJiri Kubias <jiri.kubias@gmail.com>
Thu, 23 Apr 2009 18:14:29 +0000 (20:14 +0200)
committerJiri Kubias <jiri.kubias@gmail.com>
Thu, 23 Apr 2009 18:14:29 +0000 (20:14 +0200)
src/robofsm/robot.h
src/robofsm/robot_orte.c
src/types/robottype.idl
src/types/robottype.ortegen

index 0d23627dc84dc38de7b5cfa282e18cfa85aac048..0cefd7b4f35263c1a0b4f4bc56b6e1490b47ccd9 100644 (file)
@@ -114,6 +114,7 @@ extern struct lock_log robot_lock_log;
 #define __robot_lock_disp              lock_disp
 #define __robot_lock_motion_irc         lock
 #define __robot_lock_corr_distances     lock
+#define __robot_lock_camera_result      lock_camera
 
 /* robot's main data structure */
 struct robot {
@@ -123,6 +124,7 @@ struct robot {
        pthread_mutex_t lock_meas_angles;
        pthread_mutex_t lock_joy_data;
        pthread_mutex_t lock_disp;
+       pthread_mutex_t lock_camera;
 
        /* competition parameters */
         enum team_color team_color;
@@ -173,7 +175,6 @@ struct robot {
        double puck_distance;   /* sharp sensor to puck distance in meters */
 
        struct hokuyo_scan_type hokuyo;
-       struct cmu_type cmu;
 
        struct map *map;        /* Map for pathplanning (no locking) */
 
index facf8a27b34e96c2d803dac5678930165857b363..f75b083487c62a55d351883a8c3003363948d996 100644 (file)
@@ -230,6 +230,24 @@ void rcv_hokuyo_scan_cb(const ORTERecvInfo *info, void *vinstance,
                        break;
        }
 }
+
+void rcv_camera_result_cb(const ORTERecvInfo *info, void *vinstance,
+                       void *recvCallBackParam)
+{
+       struct camera_result_type *instance = (struct camera_result_type *)vinstance;
+
+       switch (info->status) {
+               case NEW_DATA: {
+                       ROBOT_LOCK(camera_result);
+                       robot.game_conf = instance->lot;
+                       ROBOT_UNLOCK(camera_result);
+                       break;
+               }
+               case DEADLINE:
+                       DBG("%s: ORTE deadline occurred\n", __FUNCTION__);
+                       break;
+       }
+}
 /* ---------------------------------------------------------------------- 
  * SUBSCRIBER CALLBACKS - EB2008
  * ---------------------------------------------------------------------- */
@@ -293,40 +311,6 @@ void rcv_puck_distance_cb(const ORTERecvInfo *info, void *vinstance,
        }
 }
 
-#if 0
-void rcv_cmu_cb(const ORTERecvInfo *info, void *vinstance,
-                       void *recvCallBackParam)
-{
-       struct cmu_type *instance = (struct cmu_type *)vinstance;
-       static enum ball_color last_color = NO_BALL;
-       static unsigned char first = 1;
-
-       switch (info->status) {
-               case NEW_DATA: {
-                       ROBOT_LOCK(cmu);
-                       robot.cmu = *instance;
-                       ROBOT_UNLOCK(cmu);
-                       if (first) {
-                               last_color = robot.cmu.color;
-                               first = 0;
-                       }
-                       if (robot.cmu.color != NO_BALL) {
-                               if (last_color != robot.cmu.color) {
-                                       last_color = robot.cmu.color;
-                                       //FSM_SIGNAL(MAIN, EV_BALL_INSIDE, NULL);
-                               }
-                       }
-                       robot.hw_status[STATUS_CMU] = HW_STATUS_OK;
-                       break;
-               }
-               case DEADLINE:
-                       robot.hw_status[STATUS_CMU] = HW_STATUS_FAILED;
-                       DBG("%s: ORTE deadline occurred\n", __FUNCTION__);
-                       break;
-       }
-}
-#endif
-
 #define HIST_CNT 5
 #if 0
 static int cmp_double(const void *v1, const void *v2)
@@ -370,6 +354,7 @@ int robot_init_orte()
        robottype_publisher_fsm_main_create(&robot.orte, send_dummy_cb, &robot.orte);
        robottype_publisher_fsm_act_create(&robot.orte, send_dummy_cb, &robot.orte);
        robottype_publisher_fsm_motion_create(&robot.orte, send_dummy_cb, &robot.orte);
+       robottype_publisher_camera_control_create(&robot.orte, send_dummy_cb, &robot.orte);
 
        /* create generic subscribers */
        robottype_subscriber_motion_irc_create(&robot.orte, rcv_motion_irc_cb, &robot.orte);
@@ -377,14 +362,14 @@ int robot_init_orte()
        robottype_subscriber_motion_status_create(&robot.orte, rcv_motion_status_cb, &robot.orte);
        robottype_subscriber_corr_distances_create(&robot.orte, rcv_corr_distances_cb, &robot.orte);
        robottype_subscriber_pwr_voltage_create(&robot.orte, rcv_pwr_voltage_cb, &robot.orte);
-       robottype_subscriber_pwr_ctrl_create(&robot.orte, rcv_pwr_ctrl_cb, &robot.orte);
+       //robottype_subscriber_pwr_ctrl_create(&robot.orte, rcv_pwr_ctrl_cb, &robot.orte);
        robottype_subscriber_robot_cmd_create(&robot.orte, rcv_robot_cmd_cb, &robot.orte);
        robottype_subscriber_hokuyo_scan_create(&robot.orte, rcv_hokuyo_scan_cb, &robot.orte);
 
        /* create subscribers */
        robottype_subscriber_actuator_status_create(&robot.orte, rcv_actuator_status_cb, &robot.orte);
        robottype_subscriber_puck_distance_create(&robot.orte, rcv_puck_distance_cb, &robot.orte);
-       //robottype_subscriber_cmu_create(&robot.orte, rcv_cmu_cb, &robot.orte);
+       robottype_subscriber_camera_result_create(&robot.orte, rcv_camera_result_cb, &robot.orte);
 
        return rv;
 }
index fdf656340bbef0ae54aa960bd117ad879f7ebc07..832b5cc9f4899865280b8cc88ab754ea4d9d5be9 100644 (file)
@@ -142,7 +142,7 @@ struct fsm_state {
 };
 
 struct camera_control {
-    bool on;
+    boolean on;
     octet game_color;
 };
 
index 17efebee94c1ef49f1e3d120f96f214c74ee049e..be3f75e5273af004aff2b09c2e765a32b9df3c8b 100644 (file)
@@ -5,7 +5,6 @@ type=belts              topic=belts
 type=binary_data       topic=binary_data
 type=can_msg           topic=can_msg
 type=chelae            topic=chelae
-type=cmu               topic=cmu
 type=corr_distances    topic=corr_distances
 type=corr_trig         topic=corr_trig
 type=est_pos           topic=est_pos
@@ -23,6 +22,8 @@ type=pwr_ctrl         topic=pwr_ctrl
 type=pwr_voltage       topic=pwr_voltage
 type=ref_pos           topic=ref_pos
 type=robot_cmd         topic=robot_cmd
+type=camera_result     topic=camera_result
+type=camera_control    topic=camera_control
 type=fsm_state         topic=fsm_main          pubdelay=1
 type=fsm_state         topic=fsm_act           pubdelay=1
 type=fsm_state         topic=fsm_motion        pubdelay=1