/***************************************************************************** * PROJECT: AAAI Challenge * * (c) Copyright 2002 Reid Simmons & Nick Roy. All rights reserved. * * FILE: mobInterface.h * * ABSTRACT: Interface specification for the mobility subsystem. * * $Source: /usr3/Challenge/challenge/src/interfaces/mobInterface.h,v $ * $Revision: 1.2 $ * $Date: 2002年05月05日 19:15:09 $ * $Author: reids $ * * REVISION HISTORY: * $Log: mobInterface.h,v $ * Revision 1.2 2002年05月05日 19:15:09 reids * Changed MOD to MOB on some functions * * Revision 1.1.1.1 2002年05月02日 15:30:51 nickr * First import of AAAI Challenge software * ****************************************************************/ #ifndef MOB_INTERFACE_H #define MOB_INTERFACE_H #include #include "commonInterface.h" #define SUCCESS_MSG "commandSucceeded" typedef struct { char *failure; char *dataFormat; IPC_VARCONTENT_TYPE failureData; } Failure, *Failure_p; #define FAILURE_MSG "commandFailed" #define FAILURE_FORMAT "{string, string, {uint, }}" typedef struct { Pose pose; M_Per_Sec t_vel; Rad_Per_Sec r_vel; } MOB_Traj_Point, *MOB_Traj_Point_p; typedef struct { int x_size; int y_size; Meters_Per_Cell resolution; char *map_name; } MOB_Map_Config, *MOB_Map_Config_p; typedef struct { MOB_Map_Config config; float* complete_map; float** map; } MOB_Map, *MOB_Map_p; typedef struct { Pose pose; MOB_Map_p map; } MOB_World_Pose, *MOB_World_Pose_p; /****************************************************************************** * * Carmen Map-based navigation interface * ******************************************************************************/ typedef struct { Timestamp timestamp; } MOB_Query_Message; typedef struct { int autonomous; int goal_set; Pose goal; MOB_Traj_Point robot; Timestamp timestamp; } MOB_Status_Message; typedef struct { MOB_Traj_Point *path; int path_length; Timestamp timestamp; } MOB_Plan_Message; typedef struct { Meters x, y; Timestamp timestamp; } MOB_Set_Goal_Message; typedef struct { Meters x, y; Timestamp timestamp; } MOB_Set_Robot_Message; typedef struct { Timestamp timestamp; } MOB_Go_Message; typedef enum{MOB_GOAL_REACHED_v, MOB_USER_STOPPED_v, MOB_UNKNOWN_v} MOB_Reason; typedef struct { Timestamp timestamp; MOB_Reason reason; } MOB_Autonomous_Stopped_Message; typedef enum {MOB_MAP_v, MOB_ENTROPY_v, MOB_COST_v, MOB_UTILITY_v} MOB_Map_Kind; typedef struct { MOB_Map_Kind map_type; Timestamp timestamp; } MOB_Map_Request_Message; typedef struct { float *data; int size; MOB_Map_Config config; MOB_Map map_type; Timestamp timestamp; } MOB_Map_Message; void MOB_subscribe_status_message(MOB_Status_Message *plan, void(* handler)(void)); void MOB_subscribe_plan_message(MOB_Plan_Message *plan, void(* handler)(void)); void MOB_query_status(void); void MOB_query_plan(void); int MOB_set_goal(Meters x, Meters y); int MOB_set_robot(Meters x, Meters y); int MOB_set_goal_map(MOB_World_Pose_p goal); int MOB_set_robot_map(MOB_World_Pose_p robot); int MOB_go(void); int MOB_get_map(MOB_Map_Kind map_type, MOB_Map_Message **map_pointer); /****************************************************************************** * * Carmen Localisation interface * ******************************************************************************/ typedef struct { Pose pose; double weight; } MOB_Robot_Particle, *MOB_Robot_Particle_p; typedef struct { Point point; double weight; } MOB_Person_Particle_t, *MOB_Person_Particle_p; typedef struct { Meters range; /* Range reading */ Meters x, y; /* x and y position in robot coordinates */ Meters global_x, global_y; /* x and y in global coordinates */ Meters mean_x, mean_y; /* x and y in global coordinates - mean particle */ double mean_prob; /* probability of mean particle */ Meters ml_x, ml_y; /* x and y in global coordinates - ml particle */ double ml_prob; /* probability of ml particle */ int mask; /* localization mask 1 = used 0 = ignored */ int assignment; /* person filter assignment */ } MOB_Sensor_Point, *MOB_Sensor_Point_p; typedef struct { int num_readings; int which_laser; Meters forward_offset; Radians angular_offset; int mask_valid; MOB_Sensor_Point_p scan; } MOB_Sensor_Scan, *MOB_Sensor_Scan_p; /* Contains the mean and standard deviation of the position of the robot */ typedef struct { Pose globalpos, globalpos_std; Pose odometrypos; double globalpos_xy_cov; int converged; Timestamp timestamp; } MOB_Globalpos_Message; /* Contains the full state of the particle filter */ typedef struct { int num_robot_particles; MOB_Robot_Particle_p robot_particles; Pose robot_particle_mean, robot_particle_std; double robot_particle_xy_cov; int num_people_particles; MOB_Person_Particle_p people_particles; Timestamp timestamp; } MOB_Particle_Message; /* status information for the particle filter */ typedef struct { int laser_skip; MOB_Sensor_Scan front_laser_scan; MOB_Sensor_Scan rear_laser_scan; Timestamp timestamp; } MOB_Sensor_Message; /* Initialization message for localize */ typedef struct { int distribution; Pose mean, std; Timestamp timestamp; } MOB_Initialize_Message; void MOB_subscribe_globalpos_message(void (*handler)(void), MOB_Globalpos_Message *globalpos = NULL, bool just_use_latest = false); void MOB_query_globalpos_message(MOB_Globalpos_Message *globalpos, void (*handler)(MOB_Globalpos_Message *)=NULL); void MOB_subscribe_particle_message(void (*handler)(MOB_Particle_Message *), MOB_Particle_Message *particle = NULL, bool just_use_latest = false); void MOB_query_particle_message(MOB_Particle_Message *globalpos, void (*handler)(MOB_Particle_Message *) = NULL); void MOB_subscribe_sensor_message(MOB_Sensor_Message *sensor_msg, void (*handler)(MOB_Sensor_Message *) = NULL, bool just_use_latest = false); void MOB_query_sensor_message(MOB_Sensor_Message *sensor_msg, void (*handler)(MOB_Sensor_Message *) = NULL); void MOB_subscribe_initialize_message(void (*handler)(MOB_Initialize_Message *), MOB_Initialize_Message *init_msg = NULL, bool just_use_latest = false); void MOB_initialize_gaussian_command(Meters mean_x, Meters mean_y, Radians mean_theta, Meters std_x, Meters std_y, Radians std_theta); /****************************************************************************** * * TCA Robot control interface * ******************************************************************************/ typedef struct { int num; Meters *obs_x; Meters *obs_y; } MOB_Laser, *MOB_Laser_p; typedef struct { Pose pose; /* base position and orientation */ MOB_Laser readings; /* laser readings */ Timestamp timestamp; } MOB_Laser_Readings, *MOB_Laser_Readings_p; typedef struct { Pose pose; /* base position and orientation */ int sonar_frame; /* sonar frame number */ Meters data[24]; /* sonar readings */ Timestamp timestamp; } MOB_Sonar_Readings, *MOB_Sonar_Readings_p; typedef struct { Pose pose; /* base position and orientation */ M_Per_Sec trans_speed; /* translation speed */ Rad_Per_Sec rot_speed; /* rotational speed */ Timestamp timestamp; } MOB_Odometry, *MOB_Odometry_p; /* If you subscribe to a message, the handler gets called whenever a message of that type is received. If you pass a pointer to a data structure, that data structure (filled in appropriately) will be passed to the handler. If the data structure is NULL, then a data structure will be allocated. YOU SHOULD NOT ATTEMPT TO FREE THE DATA STRUCTURE WITHIN THE HANDLER! (however, if the data structure includes pointers, you *do* need to free that data). If "just_use_latest" is true, pending messages of that type will not be queued, and the handler will be invoked only on the most recent instance of that message */ void MOB_subscribe_laser(void (*handler)(MOB_Laser_Readings_p), MOB_Laser_Readings_p message_data = NULL, bool just_use_latest = false); void MOB_query_laser(MOB_Laser_Readings_p message_data, void (*handler)(MOB_Laser_Readings_p) = NULL); void MOB_subscribe_sonar(void (*handler)(MOB_Sonar_Readings_p), MOB_Sonar_Readings_p message_data = NULL, bool just_use_latest = false); void MOB_query_sonar(MOB_Sonar_Readings_p message_data, void (*handler)(MOB_Sonar_Readings_p) = NULL); void MOB_subscribe_odometry(void (*handler)(MOB_Odometry_p), MOB_Odometry_p message_data = NULL, bool just_use_latest = false); void MOB_query_odometry(MOB_Odometry_p message_data, void (*handler)(MOB_Odometry_p) = NULL); /* Each command has three variants -- non-blocking, blocking, and responded. Non-blocking commands just send the message and return. Blocking commands wait for a response -- and return true for success, false for failure. Responded commands send the command and set up a handler to wait for the command to be completed. The handler is either passed NULL (which indicates that the command completed successfully) or a pointer to failure data that describes what went wrong. The failure data is specific to the particular type of failure, and must be decoded specially (Reid can provide examples of how to deal with this failure data, if anyone is interested). The failure data is automatically cleaned up after the handler executes. */ void MOB_go_forward(Meters distance); bool MOB_go_forward_blocking(Meters distance); void MOB_go_forward(Meters distance, void (*handler)(Failure_p failureDataOrNull)); void MOB_turn(Radians relative_angle); bool MOB_turn_blocking(Radians relative_angle); void MOB_turn(Radians relative_angle, void (*handler)(Failure_p failureDataOrNull)); void MOB_head_in_direction(Radians relative_angle); void MOB_go_to(Meters x, Meters y, Meters threshold); bool MOB_go_to_blocking(Meters x, Meters y, Meters threshold); void MOB_go_to(Meters x, Meters y, Meters threshold, void (*handler)(Failure_p failureDataOrNull)); void MOB_stop(void); bool MOB_stop_blocking(void); void MOB_stop(void (*handler)(Failure_p failureDataOrNull)); void MOB_set_max_speeds(M_Per_Sec max_trans_speed, Rad_Per_Sec max_rot_speed); bool MOB_set_max_speeds_blocking(M_Per_Sec max_trans_speed, Rad_Per_Sec max_rot_speed); void MOB_set_max_speeds(M_Per_Sec max_trans_speed, Rad_Per_Sec max_rot_speed, void (*handler)(Failure_p failureDataOrNull)); #endif

AltStyle によって変換されたページ (->オリジナル) /