LaserPublisher.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 /*
31  * Author: Chad Rockey
32  */
33 
34 #ifndef IMAGE_PROC_LASER_PUBLISHER_H
35 #define IMAGE_PROC_LASER_PUBLISHER_H
36 
37 #include <ros/ros.h>
38 
39 #include <sensor_msgs/LaserScan.h>
40 #include <sensor_msgs/MultiEchoLaserScan.h>
41 #include <sensor_msgs/LaserEcho.h>
42 
43 #include <laser_proc/LaserProc.h>
44 
45 #include <vector>
46 #include <algorithm>
47 #include <limits.h>
48 #include <stdexcept>
49 #include <sstream>
50 
51 namespace laser_proc
52 {
53 
54  class LaserTransport;
55 
57  {
58  public:
60 
67  uint32_t getNumSubscribers() const;
68 
72  std::vector<std::string> getTopics() const;
73 
77  void publish(const sensor_msgs::MultiEchoLaserScan& msg) const;
78 
82  void publish(const sensor_msgs::MultiEchoLaserScanConstPtr& msg) const;
83 
87  void shutdown();
88 
89  operator void*() const;
90  bool operator< (const LaserPublisher& rhs) const { return impl_ < rhs.impl_; }
91  bool operator!=(const LaserPublisher& rhs) const { return impl_ != rhs.impl_; }
92  bool operator==(const LaserPublisher& rhs) const { return impl_ == rhs.impl_; }
93 
94  private:
95  LaserPublisher(ros::NodeHandle& nh, uint32_t queue_size,
96  const ros::SubscriberStatusCallback& connect_cb,
97  const ros::SubscriberStatusCallback& disconnect_cb,
98  const ros::VoidPtr& tracked_object, bool latch, bool publish_echoes = true);
99 
100  struct Impl;
102  typedef boost::weak_ptr<Impl> ImplWPtr;
103 
104  ImplPtr impl_;
105 
106  friend class LaserTransport;
107  };
108 
109 }; // laser_proc
110 
111 #endif
boost::function< void(const SingleSubscriberPublisher &)> SubscriberStatusCallback
uint32_t getNumSubscribers() const
Returns the number of subscribers that are currently connected to this LaserPublisher.
bool operator==(const LaserPublisher &rhs) const
bool operator!=(const LaserPublisher &rhs) const
std::vector< std::string > getTopics() const
Returns the topics of this LaserPublisher.
Make a static class that creates these
boost::weak_ptr< Impl > ImplWPtr
bool operator<(const LaserPublisher &rhs) const
void shutdown()
Shutdown the advertisements associated with this Publisher.
void publish(const sensor_msgs::MultiEchoLaserScan &msg) const
Publish a MultiEchoLaserScan on the topics associated with this LaserPublisher.
boost::shared_ptr< Impl > ImplPtr


laser_proc
Author(s): Chad Rockey
autogenerated on Thu Jun 6 2019 19:56:23