crsm_slam.h
Go to the documentation of this file.
00001 /*
00002  *      This file is part of CrsmSlam.
00003     CrsmSlam is free software: you can redistribute it and/or modify 
00004     it under the terms of the GNU General Public License as published by
00005     the Free Software Foundation, either version 3 of the License, or
00006     (at your option) any later version.
00007 
00008     CrsmSlam is distributed in the hope that it will be useful,
00009     but WITHOUT ANY WARRANTY; without even the implied warranty of
00010     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011     GNU General Public License for more details.
00012 
00013     You should have received a copy of the GNU General Public License
00014     along with CrsmSlam.  If not, see <http://www.gnu.org/licenses/>.
00015 * 
00016 * Author : Manos Tsardoulias, etsardou@gmail.com
00017 * Organization : AUTH, PANDORA Robotics Team
00018 * */
00019 
00020 #ifndef CRSM_SLAM_HEADER
00021 #define CRSM_SLAM_HEADER
00022 
00023 
00024 #include <iostream>
00025 #include <cstdlib>
00026 #include <cmath>
00027 #include <vector>
00028 #include <string>
00029 
00030 #include "tf/transform_broadcaster.h"
00031 #include "tf/transform_listener.h"
00032 #include "ros/ros.h"
00033 
00034 #include <geometry_msgs/Quaternion.h>
00035 #include <nav_msgs/OccupancyGrid.h>
00036 #include <nav_msgs/Path.h>
00037 
00038 #include "crsm_laser.h"
00039 #include "crsm_hillClimbing.h"
00040 #include "crsm_pose.h"
00041 #include "crsm_map.h"
00042 #include "crsm_slamParameters.h"
00043 
00044 namespace crsm_slam{
00045 
00050         class CrsmSlam{
00051 
00052                 private:
00053                         ros::Subscriber clientLaserValues;                              
00054                         ros::Publisher _occupancyGridPublisher;                 
00055                         ros::Publisher _pathPublisher;                                  
00056                         tf::TransformBroadcaster _slamFrameBroadcaster; 
00057                         tf::TransformListener _listener;                                
00058                         
00059                         CrsmExpansion expansion;
00060                         
00061                         CrsmMap map;            
00062                         CrsmLaser laser;        
00063                                 
00064                         int argc;                       
00065                         char **argv;            
00066 
00067                         unsigned int counter;   
00068 
00069                         float bestFitness;              
00070                         float meanDensity;              
00071 
00072                         CrsmTransformation bestTransformation;  
00073                         CrsmPose robotPose;                                     
00074                         CrsmSlamParameters slamParams;                  
00075                         
00076                         std::vector<CrsmPose> robotTrajectory;  
00077 
00078                         std::set<int> scanSelections;                   
00079                         std::set<int> bigChanges;                               
00080                         
00085                         void updateParameters(void);
00086                         
00087                         bool checkExpansion(int x,int y,bool update);
00088                         
00089                         void expandMap(void);
00090                         
00091                         ros::Timer _pathPublishingTimer;                
00092                         ros::Timer _robotPosePublishingTimer;   
00093                         ros::Timer _mapPublishingTimer;                 
00094 
00095                 public:
00096                 
00097                         ros::NodeHandle n;      
00098                         
00099 
00106                         CrsmSlam(int argc, char **argv);
00107                         
00112                         ~CrsmSlam(){}
00113                         
00118                         void updateMapProbabilities(void);
00119 
00124                         void calculateCriticalRays(void);
00125 
00130                         void findTransformation(void);
00131                         
00137                         void fixNewScans(const sensor_msgs::LaserScanConstPtr& msg);
00138                         
00143                         void startLaserSubscriber(void);
00144                         
00149                         void stopLaserSubscriber(void);
00150 
00155                         void startOGMPublisher(void);
00156                         
00161                         void stopOGMPublisher(void);
00162                         
00168                         void publishOGM(const ros::TimerEvent& e);
00169                         
00175                         void publishRobotPoseTf(const ros::TimerEvent& e);
00176                         
00181                         void startTrajectoryPublisher(void);
00182                         
00187                         void stopTrajectoryPublisher(void);
00188                         
00194                         void publishTrajectory(const ros::TimerEvent& e);
00195                         
00200                         CrsmMapInfo getMapInfo(void);
00201                         
00208                         char getMapProbability(int x,int y);
00209                         
00214                         CrsmPose getRobotPose(void);
00215                         
00220                         CrsmLaserInfo getLaserInfo(void);
00221                         
00226                         std::vector<CrsmPose> getTrajectory(void);
00227                         
00228                         //---------------------- Setters for slamParameters ----------------------------//
00234                         void setDisparity(int disparity);
00235                         
00241                         void setInitialMapSize(int size);
00242                         
00248                         void setOcgd(double ocgd);
00249                         
00255                         void setDensity(double density);
00256                         
00262                         void setObstacleDensity(double ob_density);
00263                         
00269                         void setScanSelectionMeters(double scan_selection_meters);
00270                         
00276                         void setMaxHillClimbingIterations(int iterations);
00277                         
00283                         void setDxLaserRobotCenter(double dx);
00284                         
00290                         void setOccupancyGridMapFreq(double freq);
00291                         
00297                         void setRobotPoseTfFreq(double freq);
00298                         
00304                         void setTrajectoryFreq(double freq);
00305                         
00311                         void setDesiredNumberOfPickedRays(int rays);
00312                         
00318                         void setRobotWidth(double width);
00319                         
00325                         void setRobotLength(double length);
00326                         
00332                         void setOccupancyGridPublishTopic(std::string topic);
00333                         
00339                         void setRobotTrajectoryPublishTopic(std::string topic);
00340                         
00346                         void setTrajectoryPublisherFrameId(std::string frame_id);
00347                         
00353                         void setLaserSubscriberTopic(std::string topic);
00354                         
00360                         void setWorldFrame(std::string frame);
00361                         
00367                         void setBaseFootprintFrame(std::string frame);
00368                         
00374                         void setBaseFrame(std::string frame);
00375                         
00381                         void setMapFrame(std::string frame);
00382                         
00388                         void setLaserFrame(std::string frame);
00389                         
00390                         //------------------- Getters for slamParameters ----------------------//
00391                         
00396                         int getDisparity(void);
00397                         
00402                         int getInitialMapSize(void);
00403                         
00408                         double getOcgd(void);
00409                         
00414                         double getDensity(void);
00415                         
00420                         double getObstacleDensity(void);
00421                         
00426                         double getScanSelectionMeters(void);
00427                         
00432                         int getMaxHillClimbingIterations(void);
00433                         
00438                         double getDxLaserRobotCenter(void);
00439                         
00444                         double getOccupancyGridMapFreq(void);
00445                         
00450                         double getRobotPoseTfFreq(void);
00451                         
00456                         double getTrajectoryFreq(void);
00457                         
00462                         int getDesiredNumberOfPickedRays(void);
00463                         
00468                         double getRobotWidth(void);
00469                         
00474                         double getRobotLength(void);
00475                         
00480                         std::string getOccupancyGridPublishTopic(void);
00481                         
00486                         std::string getRobotTrajectoryPublishTopic(void);
00487                         
00492                         std::string getTrajectoryPublisherFrameId(void);
00493                         
00498                         std::string getLaserSubscriberTopic(void);
00499                         
00504                         std::string getWorldFrame(void);
00505                         
00510                         std::string getBaseFootprintFrame(void);
00511                         
00516                         std::string getBaseFrame(void);
00517                         
00522                         std::string getMapFrame(void);
00523                         
00528                         std::string getLaserFrame(void);
00529                 };
00530 
00531 }
00532 
00533 #endif
00534 


crsm_slam
Author(s): Manos Tsardoulias
autogenerated on Sat Jun 8 2019 19:18:57