#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 {
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;
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) */
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
* ---------------------------------------------------------------------- */
}
}
-#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)
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);
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;
}
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
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