7 async_web_server_cpp::HttpConnectionPtr connection,
ros::NodeHandle& nh) :
20 std::string compressed_topic =
topic_ +
"/compressed";
38 std::string content_type;
39 if(msg->format.find(
"jpeg") != std::string::npos) {
40 content_type =
"image/jpeg";
42 else if(msg->format.find(
"png") != std::string::npos) {
43 content_type =
"image/png";
46 ROS_WARN_STREAM(
"Unknown ROS compressed image format: " << msg->format);
50 stream_.
sendPart(time, content_type, boost::asio::buffer(msg->data), msg);
52 catch (boost::system::system_error &e)
55 ROS_DEBUG(
"system_error exception: %s", e.what());
59 catch (std::exception &e)
83 async_web_server_cpp::HttpConnectionPtr connection,
92 ss <<
"<img src=\"/stream?";
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
boost::shared_ptr< ImageStreamer > create_streamer(const async_web_server_cpp::HttpRequest &request, async_web_server_cpp::HttpConnectionPtr connection, ros::NodeHandle &nh)
virtual void restreamFrame(double max_age)
#define ROS_ERROR_THROTTLE(rate,...)
void sendPart(const ros::Time &time, const std::string &type, const boost::asio::const_buffer &buffer, async_web_server_cpp::HttpConnection::ResourcePtr resource)
std::string create_viewer(const async_web_server_cpp::HttpRequest &request)
#define ROS_WARN_STREAM(args)
virtual void sendImage(const sensor_msgs::CompressedImageConstPtr &msg, const ros::Time &time)
sensor_msgs::CompressedImageConstPtr last_msg
RosCompressedStreamer(const async_web_server_cpp::HttpRequest &request, async_web_server_cpp::HttpConnectionPtr connection, ros::NodeHandle &nh)
void imageCallback(const sensor_msgs::CompressedImageConstPtr &msg)
ros::Subscriber image_sub_