Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #pragma once
00028 #ifndef CMapPubPlugin_H_included
00029 #define CMapPubPlugin_H_included
00030
00031 #include <srs_env_model/but_server/server_tools.h>
00032 #include <srs_env_model/GetCollisionMap.h>
00033 #include <srs_env_model/IsNewCollisionMap.h>
00034 #include <srs_env_model/LockCollisionMap.h>
00035
00036 #include <arm_navigation_msgs/CollisionMap.h>
00037 #include <tf/transform_listener.h>
00038 #include <tf/message_filter.h>
00039 #include <srs_env_model/RemoveCube.h>
00040
00041 namespace srs_env_model
00042 {
00043
00044 class CCMapPlugin : public CServerPluginBase, public COctomapCrawlerBase<tButServerOcTree::NodeType>, public CDataHolderBase< arm_navigation_msgs::CollisionMap >
00045 {
00046 protected:
00048 typedef COctomapCrawlerBase<tButServerOcTree::NodeType> tOctomapCrawler;
00049
00051 typedef arm_navigation_msgs::CollisionMap::_boxes_type tBoxVec;
00052
00054 typedef arm_navigation_msgs::OrientedBoundingBox tBox;
00055
00057 typedef geometry_msgs::Point32 tBoxPoint;
00058
00059 public:
00061 CCMapPlugin(const std::string & name);
00062
00064 void enable( bool enabled ){ m_publishCollisionMap = enabled; }
00065
00067 virtual void init(ros::NodeHandle & node_handle);
00068
00070 bool lockChanges( bool bLock );
00071
00073 virtual void pause( bool bPause, ros::NodeHandle & node_handle);
00074
00075
00076 protected:
00078 virtual void newMapDataCB( SMapWithParameters & par );
00079
00081 void handleOccupiedNode(tButServerOcTree::iterator& it, const SMapWithParameters & mp);
00082
00084 virtual void publishInternal(const ros::Time & timestamp);
00085
00087 virtual bool shouldPublish( );
00088
00090 bool sameCMaps( arm_navigation_msgs::CollisionMap * map1, arm_navigation_msgs::CollisionMap * map2 );
00091
00093 bool isNearRobot( const btVector3 & point, double extent );
00094
00101 bool getCollisionMapSrvCallback( srs_env_model::GetCollisionMap::Request & req, srs_env_model::GetCollisionMap::Response & res );
00102
00108 bool isNewCmapSrvCallback( srs_env_model::IsNewCollisionMap::Request & req, srs_env_model::IsNewCollisionMap::Response & res );
00109
00115 bool lockCmapSrvCallback( srs_env_model::LockCollisionMap::Request & req, srs_env_model::LockCollisionMap::Response & res );
00116
00123 long removeInsideBox( const tBoxPoint & center, const tBoxPoint & size, tBoxVec & boxes );
00124
00130 bool removeBoxCallback( srs_env_model::RemoveCube::Request & req, srs_env_model::RemoveCube::Response & res );
00131
00137 void addBox( const tBoxPoint & center, const tBoxPoint & size, tBoxVec & boxes );
00138
00144 bool addBoxCallback( srs_env_model::RemoveCube::Request & req, srs_env_model::RemoveCube::Response & res );
00145
00150 void retransformTF( const ros::Time & currentTime );
00151
00152 protected:
00154 std::string m_cmapPublisherName;
00155
00157 ros::Publisher m_cmapPublisher;
00158
00160 double m_collisionMapLimitRadius;
00161
00163 long int m_collisionMapVersion;
00164
00166 tf::Stamped<btVector3> m_robotBasePosition;
00167
00169 std::string m_cmapFrameId;
00170
00172 tDataPtr m_dataBuffer;
00173
00175 arm_navigation_msgs::CollisionMap m_dataEmpty;
00176
00178 bool m_publishCollisionMap;
00179
00181 ros::ServiceServer m_serviceGetCollisionMap;
00182
00184 ros::ServiceServer m_serviceIsNewCMap;
00185
00187 ros::ServiceServer m_serviceLockCMap;
00188
00190 ros::ServiceServer m_serviceRemoveCube;
00191
00193 ros::ServiceServer m_serviceAddCube;
00194
00196 tf::TransformListener m_tfListener;
00197
00199 Eigen::Matrix4f m_worldToCMapTM;
00200
00202 Eigen::Matrix3f m_worldToCMapRot;
00203 Eigen::Vector3f m_worldToCMapTrans;
00204
00205
00206 bool m_latchedTopics;
00207
00209 bool m_bConvertPoint;
00210
00212 bool m_bLocked;
00213
00215 ros::Time m_mapTime;
00216
00217
00218 public:
00219 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00220
00221 };
00222
00223
00224
00225 }
00226
00227
00228 #endif
00229
00230
srs_env_model
Author(s): Vit Stancl (stancl@fit.vutbr.cz), Tomas Lokaj, Jan Gorig, Michal Spanel (spanel@fit.vutbr.cz)
autogenerated on Mon Oct 6 2014 08:05:04