56 int main(
int argc,
char **argv) {
58 ros::init(argc, argv,
"octree_stamped_pa_node");
68 tf_listener_(
ros::Duration(20), true) {
79 paramloader.
load(
"~/map_prob_threshold", temp); setOccupancyThres (temp);
81 paramloader.
load(
"~/map_clamp_min" , temp); setClampingThresMin(temp);
83 paramloader.
load(
"~/map_clamp_max" , temp); setClampingThresMax(temp);
90 paramloader.
load(
"~/pcd_voxel_explicit_relative_resolution",
92 paramloader.
load(
"~/pcd_explicit_transform",
98 paramloader.
load(
"~/auto_degrading_intervall",
102 paramloader.
loadTopic(
"~/topic_in_cloud" ,
104 paramloader.
loadTopic(
"~/topic_in_cloud_old",
106 paramloader.
loadTopic(
"~/topic_in_laser" ,
110 paramloader.
loadTopic(
"~/topic_out_octomap" ,
112 paramloader.
loadTopic(
"~/topic_out_octomap_full" ,
114 paramloader.
loadTopic(
"~/topic_out_cloud_free" ,
116 paramloader.
loadTopic(
"~/topic_out_cloud_occupied",
155 std::string str_service(
"~/");
202 const sensor_msgs::PointCloud2ConstPtr &msg) {
213 msg->header.frame_id, msg->header.stamp,
ros::Duration(0.2));
215 msg->header.frame_id, msg->header.stamp, transform);
230 const sensor_msgs::PointCloudConstPtr &msg) {
241 msg->header.frame_id, msg->header.stamp,
ros::Duration(0.2));
243 msg->header.frame_id, msg->header.stamp, transform);
258 const sensor_msgs::LaserScanConstPtr &msg) {
269 msg->header.frame_id, msg->header.stamp,
ros::Duration(0.2));
271 msg->header.frame_id, msg->header.stamp, transform);
288 std_srvs::Empty::Response &res) {
290 ROS_INFO(
"cOctreeStampedPaNode::clear()");
304 octomap_pa::OctomapPaGetSize::Request &req,
305 octomap_pa::OctomapPaGetSize::Response &res) {
307 ROS_INFO(
"cOctreeStampedPaNode::getsize()");
321 octomap_pa::OctomapPaFileName::Request &req,
322 octomap_pa::OctomapPaFileName::Response &res) {
327 filename = req.filename;
332 res.ok = this->write(filename);
339 octomap_pa::OctomapPaFileName::Request &req,
340 octomap_pa::OctomapPaFileName::Response &res) {
345 filename = req.filename;
sensor_msgs::PointCloud2Ptr getOctomapPcdFree(const int tree_depth=0, const bool expand=false) const
similar to getOctomapPcd, but only returning just empty voxels
cOctreeStampedPaRosParameter rosparams_
parameters
bool clearCallbackSrv(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res)
void setResolution(double r)
ros::ServiceServer srv_load_
service for loading a octomap
ros::Publisher pub_cloud_free_
puplisher for free voxels as pointcloud
std::string topic_out_octomap_full_
name of the topic for publishing the octomap ("~out_octomap_full")
std::string output_frame_
name of the output frame ("map")
octomap_msgs::OctomapPtr getOctomapFull(void) const
function for getting the full octomap
std::string topic_out_cloud_occupied_
double map_prob_miss_
octomap parameter: probability for a "miss"
void addPointcloudOldCallbackSub(const sensor_msgs::PointCloudConstPtr &msg)
callback function for receiving a pointcloud (old format)
bool saveCallbackSrv(octomap_pa::OctomapPaFileName::Request &req, octomap_pa::OctomapPaFileName::Response &res)
double degrading_time_
duration how long the outdated nodes will be kept (60s)
~cOctreeStampedPaNode()
default destructor
void publish(const boost::shared_ptr< M > &message) const
virtual void clear(void)
clear local timestamps with octomap
virtual size_t memoryUsage() const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
bool updateTime(const ros::Time &time)
void addPointcloudCallbackSub(const sensor_msgs::PointCloud2ConstPtr &msg)
callback function for receiving a pointcloud
bool loadCallbackSrv(octomap_pa::OctomapPaFileName::Request &req, octomap_pa::OctomapPaFileName::Response &res)
cAddCloudParameter addparams_
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
std::string topic_out_cloud_free_
octomap_msgs::OctomapPtr getOctomap(void) const
function for getting the binary octomap
int count_laser_
number of inserted laser scans
void checkDegrading(void)
helper function for automatic degrading
int count_cloud_
number of inserted pointclouds
ros::Publisher pub_octomap_
puplisher for the octomap (binary data)
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
bool loadTopic(const std::string name, std::string &value, const bool print_default=true) const
bool load(const std::string name, bool &value, const bool print_default=true) const
ROSCPP_DECL void spin(Spinner &spinner)
static bool replaceFindpack(std::string &path)
int main(int argc, char **argv)
double map_prob_hit_
octomap parameter: probability for a "hit"
bool addCloud(const sensor_msgs::PointCloud2ConstPtr &cloud, const cAddCloudParameter ¶ms, const tf::Transform transform=tf::Transform::getIdentity())
cOctreeStampedPaNode()
default constructor
int count_cloud_old_
number of inserted pointclouds (old format)
bool pcd_voxel_active_
pointcloud insertion parameter: use voxel-filter (speeds up)
ros::Subscriber sub_cloud_old_
subscriber for a pointcloud (old format)
bool getSizeCallbackSrv(octomap_pa::OctomapPaGetSize::Request &req, octomap_pa::OctomapPaGetSize::Response &res)
bool pcd_explicit_transform_
ros::NodeHandle nh_
node handler for topic subscription and advertising
double auto_degrading_intervall_
intervall for automatic degrading (2.0s)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
cOctreeBasePaRosParameter rosparams_base_
parameters
static std::string resolveRessourcename(const std::string name)
std::string topic_out_octomap_
name of the topic for publishing the octomap ("~out_octomap")
sensor_msgs::PointCloud2Ptr getOctomapPcd(const int tree_depth=0, const bool expand=false) const
function for getting the pointcloud equivalent of the octomap
void addLaserCallbackSub(const sensor_msgs::LaserScanConstPtr &msg)
callback function for receiving a laserscan
ros::Subscriber sub_laser_
subscriber for a laserscan
uint32_t getNumSubscribers() const
ros::Subscriber sub_cloud_
subscriber for a pointcloud
#define ROS_INFO_STREAM(args)
std::string topic_in_laser_
name of the topic for subscribing a laserscan ("~in_laser")
ros::ServiceServer srv_save_
service for saving the octomap
std::string topic_in_cloud_old_
bool auto_degrading_
turns on automatic degrading (true)
bool readFull(const std::string &filename)
trying to read the given file into the current OcTree
cOctreeBasePaNodeParameter nodeparams_
parameters
void publishOctomap(void)
function for publishing the octomap
ros::Publisher pub_cloud_occupied_
puplisher for occupied voxels as pointcloud
std::string topic_in_cloud_
ros::Publisher pub_octomap_full_
puplisher for the octomap (full data)
ros::ServiceServer srv_getsize_
service for receiving the size of the octomap
tf::TransformListener tf_listener_
transformation of different frames
double pcd_voxel_explicit_relative_resolution_
pointcloud insertion parameter: relative resolution of pcl-filter
virtual size_t size() const
ros::ServiceServer srv_clear_
service for clearing the octomap