00001 00008 #include <nav_msgs/Odometry.h> 00009 00010 #include <ros/ros.h> 00011 00012 #include <youbot_overhead_localization/Pose2d.h> 00013 #include <youbot_overhead_vision/CoordConversion.h> 00014 #include <youbot_overhead_vision/PositionFromCamera.h> 00015 00016 //Noise covariance matrix 00017 #define Q_X .05 00018 #define Q_Y .05 00019 #define Q_T .05 00020 00021 //Measurement covariance matrix 00022 #define R_X .1 00023 #define R_Y .1 00024 #define R_T .1 00025 00026 #define PI 3.14159 00027 00036 class localizer 00037 { 00038 public: 00039 //ROS subscribers, publishers, and services 00040 ros::NodeHandle n; 00041 ros::Publisher baseLocalizationPublisher; 00042 ros::ServiceClient coordConversionClient; 00043 ros::Subscriber baseOdometrySubscriber; 00044 ros::Subscriber positionFromCameraSubscriber; 00045 00046 //the localization object 00047 youbot_overhead_localization::Pose2d pose; 00048 00049 //Kalman filter 00050 float P[3]; //error covariance 00051 float Q[3]; //noise covariance 00052 float R[3]; //measurement covariance 00053 00054 //odometry 00055 bool odometryInitialized; 00056 nav_msgs::Odometry lastReceivedOdometry; 00057 00062 void baseOdometryCallback(const nav_msgs::Odometry& odometry); 00063 00068 void positionFromCameraCallback(const youbot_overhead_vision::PositionFromCamera& newPos); 00069 00075 float convertAngle(float theta); 00076 00080 localizer(); 00081 };