00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00021
00022
00023
00024
00025
00026
00028
00029 #ifndef AMCL_FIDUCIAL_H
00030 #define AMCL_FIDUCIAL_H
00031
00032 #include "amcl_sensor.h"
00033 #include "map/map.h"
00034 #include "models/laser.h"
00035
00036
00037 class AMCLFiducialData : public AMCLSensorData
00038 {
00039
00040 public: int fiducial_count;
00041 public: double fiducials[PLAYER_FIDUCIAL_MAX_SAMPLES][3];
00042 };
00043
00044
00045 class AMCLFiducialMap
00046 {
00047
00048 public: int fiducial_count;
00049 public: double origin_x;
00050 public: double origin_y;
00051 public: double scale;
00052 public: double fiducials[100][3];
00053 };
00054
00055 double fiducial_map_calc_range( AMCLFiducialMap* fmap, double ox, double oy, double oa, double max_range, int id, int k);
00056 double fiducial_map_calc_bearing( AMCLFiducialMap* fmap, double ox, double oy, double oa, double max_range, int id, int k);
00057
00058 AMCLFiducialMap* fiducial_map_alloc();
00059
00060
00061 class AMCLFiducial : public AMCLSensor
00062 {
00063
00064 public: AMCLFiducial(player_device_id_t id);
00065
00066
00067 public: virtual int Load(ConfigFile* cf, int section);
00068
00069
00070 public: virtual int Unload(void);
00071
00072
00073 public: virtual int Setup(void);
00074
00075
00076 public: virtual int Shutdown(void);
00077
00078
00079 private: virtual AMCLSensorData *GetData(void);
00080
00081
00082
00083 public: virtual bool UpdateSensor(pf_t *pf, AMCLSensorData *data);
00084
00085
00086 private: static double SensorModel(AMCLFiducialData *data, pf_vector_t pose);
00087
00088
00089 private: int SetupMap(void);
00090
00091 private: int read_map_file(const char *);
00092
00093
00094 private: player_device_id_t fiducial_id;
00095 private: player_device_id_t map_id;
00096 private: Driver *driver;
00097
00098
00099 private: struct timeval time;
00100
00101
00102 private: map_t *map;
00103
00104
00105 private: AMCLFiducialMap *fmap;
00106
00107
00108 private: pf_vector_t laser_pose;
00109
00110
00111 private: double range_max;
00112
00113
00114 private: double range_var;
00115
00116
00117 private: double angle_var;
00118
00119
00120 private: double range_bad;
00121
00122
00123 private: double angle_bad;
00124
00125 #ifdef INCLUDE_RTKGUI
00126
00127 private: virtual void SetupGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig);
00128
00129
00130 private: virtual void ShutdownGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig);
00131
00132
00133 public: virtual void UpdateGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig, AMCLSensorData *data);
00134
00135
00136 private: rtk_fig_t *fig, *map_fig;
00137 #endif
00138
00139 };
00140
00141
00142
00143
00144 #endif