42 class PublicationServer::Impl
49 std::map<std::string, image_transport::CameraPublisher> client_map_;
56 constructed_(
ros::WallTime::now().toSec())
63 ROS_WARN(
"PublicationServer destroyed immediately after creation. Did you forget to store the handle?");
69 return !unadvertised_;
81 bool requestCallback(polled_camera::GetPolledImage::Request& req,
82 polled_camera::GetPolledImage::Response& rsp)
84 std::string image_topic = req.response_namespace +
"/image_raw";
89 boost::bind(&Impl::disconnectCallback,
this, _1),
96 req.binning_x = std::max(req.binning_x, (uint32_t)1);
97 req.binning_y = std::max(req.binning_y, (uint32_t)1);
100 sensor_msgs::Image image;
101 sensor_msgs::CameraInfo info;
102 driver_cb_(req, rsp, image, info);
105 assert(image.header.stamp == info.header.stamp);
106 rsp.stamp = image.header.stamp;
110 ROS_ERROR(
"Failed to capture requested image, status message: '%s'",
111 rsp.status_message.c_str());
131 :
impl_(new Impl(nh))
133 impl_->driver_cb_ = cb;
134 impl_->tracked_object_ = tracked_object;
145 if (
impl_)
return impl_->srv_server_.getService();
146 return std::string();
149 PublicationServer::operator
void*()
const 151 return (
impl_ &&
impl_->isValid()) ? (
void*)1 : (
void*)0;
void publish(const sensor_msgs::Image &image, const sensor_msgs::CameraInfo &info) const
boost::function< void(const SingleSubscriberPublisher &)> SubscriberStatusCallback
boost::function< void(const SingleSubscriberPublisher &)> SubscriberStatusCallback
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
uint32_t getNumSubscribers() const
CameraPublisher advertiseCamera(const std::string &base_topic, uint32_t queue_size, bool latch=false)
Manage image requests from one or more clients.
std::string getService() const
friend PublicationServer advertise(ros::NodeHandle &, const std::string &, const DriverCallback &, const ros::VoidPtr &)
Advertise a polled image service, version for arbitrary boost::function object.
void shutdown()
Unadvertise the request service and shut down all published topics.
boost::shared_ptr< Impl > impl_
std::string getTopic() const
boost::function< void(polled_camera::GetPolledImage::Request &, polled_camera::GetPolledImage::Response &, sensor_msgs::Image &, sensor_msgs::CameraInfo &)> DriverCallback
std::string getTopic() const