return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
-void update_map_hokuyo(struct sick_scan_type *s)
+void update_map_hokuyo(struct lidar_scan_type *s)
{
double x, y;
struct robot_pos_type e;
void * thread_obstacle_forgeting(void * arg);
/*void update_map(struct sharps_type *s);*/
-void update_map_hokuyo(struct sick_scan_type *s);
+void update_map_hokuyo(struct lidar_scan_type *s);
#ifdef __cplusplus
}
struct odo_data_type odo_data; /* independent odometry */
struct corr_distances_type corr_distances; /* ultrasound */
- struct hokuyo_scan_type hokuyo;
+ struct lidar_scan_type hokuyo;
bool ignore_hokuyo;
- struct sick_scan_type sick;
+ struct lidar_scan_type sick;
bool ignore_sick;
/* variables for target detection */
}
}
+void rcv_hokuyo_scan_cb(const ORTERecvInfo *info, void *vinstance,
+ void *recvCallBackParam)
+{
+ struct lidar_scan_type *instance = (struct lidar_scan_type *)vinstance;
+
+ switch (info->status) {
+ case NEW_DATA: {
+ ROBOT_LOCK(hokuyo);
+ robot.hokuyo = *instance;
+ robot.status[COMPONENT_HOKUYO] = STATUS_OK;
+ ROBOT_UNLOCK(hokuyo);
+ if(!robot.ignore_hokuyo)
+ {
+ //update_map_hokuyo(instance);
+ }
+ break;
+ }
+ case DEADLINE:
+ robot.status[COMPONENT_HOKUYO] = STATUS_FAILED;
+ //system("killall -9 hokuyo");
+ DBG("%s: ORTE deadline occurred\n", __FUNCTION__);
+ break;
+ }
+}
+
void rcv_sick_scan_cb(const ORTERecvInfo *info, void *vinstance,
void *recvCallBackParam)
{
- struct sick_scan_type *instance = (struct sick_scan_type *)vinstance;
+ struct lidar_scan_type *instance = (struct lidar_scan_type *)vinstance;
switch (info->status) {
case NEW_DATA: {
octet id;
};
-struct hokuyo_scan {
- unsigned short data[681];
-};
-
-struct sick_scan {
- unsigned short data[271];
+struct lidar_scan {
+ unsigned short lidar_type;
+ unsigned short data_lenght;
+ unsigned short data[681];
};
struct pos_short {
type=robot_pos topic=est_pos_odo
type=robot_pos topic=est_pos_indep_odo
type=robot_pos topic=est_pos_best
-type=hokuyo_scan topic=hokuyo_scan deadline=1
-type=sick_scan topic=sick_scan deadline=1
+type=lidar_scan topic=hokuyo_scan deadline=1
+type=lidar_scan topic=sick_scan deadline=1
type=odo_data topic=odo_data deadline=0.3
type=motion_irc topic=motion_irc deadline=0.3
type=motion_speed topic=motion_speed deadline=0.3 pubdelay=0.1