diff --git a/CMakeLists.txt b/CMakeLists.txt index 99a10a9..62aa6f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,8 +66,6 @@ target_link_libraries(${PROJECT_NAME} ${swscale_LIBRARIES} ) -ament_package() - ############# ## Install ## ############# @@ -82,7 +80,4 @@ install(DIRECTORY include/${PROJECT_NAME}/ FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" ) -install( - DIRECTORY config launch - DESTINATION share/${PROJECT_NAME} -) +ament_package() \ No newline at end of file diff --git a/include/web_video_server/h264_streamer.h b/include/web_video_server/h264_streamer.h index 1d9fa31..9961389 100644 --- a/include/web_video_server/h264_streamer.h +++ b/include/web_video_server/h264_streamer.h @@ -1,7 +1,7 @@ #ifndef H264_STREAMERS_H_ #define H264_STREAMERS_H_ -#include +#include #include "web_video_server/libav_streamer.h" #include "async_web_server_cpp/http_request.hpp" #include "async_web_server_cpp/http_connection.hpp" diff --git a/include/web_video_server/image_streamer.h b/include/web_video_server/image_streamer.h index c2f5a07..59a1a92 100644 --- a/include/web_video_server/image_streamer.h +++ b/include/web_video_server/image_streamer.h @@ -2,8 +2,8 @@ #define IMAGE_STREAMER_H_ #include -#include -#include +#include +#include #include #include "async_web_server_cpp/http_server.hpp" #include "async_web_server_cpp/http_request.hpp" diff --git a/include/web_video_server/jpeg_streamers.h b/include/web_video_server/jpeg_streamers.h index 30a202b..ad788fa 100644 --- a/include/web_video_server/jpeg_streamers.h +++ b/include/web_video_server/jpeg_streamers.h @@ -1,7 +1,7 @@ #ifndef JPEG_STREAMERS_H_ #define JPEG_STREAMERS_H_ -#include +#include #include "web_video_server/image_streamer.h" #include "async_web_server_cpp/http_request.hpp" #include "async_web_server_cpp/http_connection.hpp" diff --git a/include/web_video_server/libav_streamer.h b/include/web_video_server/libav_streamer.h index 87ef1c7..643e3b3 100644 --- a/include/web_video_server/libav_streamer.h +++ b/include/web_video_server/libav_streamer.h @@ -1,7 +1,7 @@ #ifndef LIBAV_STREAMERS_H_ #define LIBAV_STREAMERS_H_ -#include +#include #include "web_video_server/image_streamer.h" #include "async_web_server_cpp/http_request.hpp" #include "async_web_server_cpp/http_connection.hpp" diff --git a/include/web_video_server/png_streamers.h b/include/web_video_server/png_streamers.h index 197ecc3..a6edabc 100644 --- a/include/web_video_server/png_streamers.h +++ b/include/web_video_server/png_streamers.h @@ -1,7 +1,7 @@ #ifndef PNG_STREAMERS_H_ #define PNG_STREAMERS_H_ -#include +#include #include "web_video_server/image_streamer.h" #include "async_web_server_cpp/http_request.hpp" #include "async_web_server_cpp/http_connection.hpp" diff --git a/include/web_video_server/vp8_streamer.h b/include/web_video_server/vp8_streamer.h index 0f4cd7d..46e8bed 100644 --- a/include/web_video_server/vp8_streamer.h +++ b/include/web_video_server/vp8_streamer.h @@ -37,7 +37,7 @@ #ifndef VP8_STREAMERS_H_ #define VP8_STREAMERS_H_ -#include +#include #include "web_video_server/libav_streamer.h" #include "async_web_server_cpp/http_request.hpp" #include "async_web_server_cpp/http_connection.hpp" diff --git a/include/web_video_server/vp9_streamer.h b/include/web_video_server/vp9_streamer.h index d7f0a2d..06c48f8 100644 --- a/include/web_video_server/vp9_streamer.h +++ b/include/web_video_server/vp9_streamer.h @@ -1,7 +1,7 @@ #ifndef VP9_STREAMERS_H_ #define VP9_STREAMERS_H_ -#include +#include #include "web_video_server/libav_streamer.h" #include "async_web_server_cpp/http_request.hpp" #include "async_web_server_cpp/http_connection.hpp" diff --git a/package.xml b/package.xml index a4989f5..6e3a11c 100644 --- a/package.xml +++ b/package.xml @@ -28,4 +28,8 @@ async_web_server_cpp ffmpeg sensor_msgs + + + ament_cmake + diff --git a/src/ros_compressed_streamer.cpp b/src/ros_compressed_streamer.cpp index 7c130d3..fc837cd 100644 --- a/src/ros_compressed_streamer.cpp +++ b/src/ros_compressed_streamer.cpp @@ -23,7 +23,7 @@ void RosCompressedStreamer::start() { } image_sub_ = nh_->create_subscription( - compressed_topic, std::bind(&RosCompressedStreamer::imageCallback, this, std::placeholders::_1), 1); + compressed_topic, 1, std::bind(&RosCompressedStreamer::imageCallback, this, std::placeholders::_1)); } void RosCompressedStreamer::restreamFrame(double max_age) @@ -81,7 +81,7 @@ void RosCompressedStreamer::sendImage(const sensor_msgs::msg::CompressedImage::C void RosCompressedStreamer::imageCallback(const sensor_msgs::msg::CompressedImage::ConstSharedPtr msg) { boost::mutex::scoped_lock lock(send_mutex_); // protects last_msg and last_frame last_msg = msg; - last_frame = rclcpp::Time(msg->header.stamp.sec, msg->header.stamp.nanosec); + last_frame = rclcpp::Time(msg->header.stamp); sendImage(last_msg, last_frame); } diff --git a/src/web_video_server.cpp b/src/web_video_server.cpp index a83f156..f595223 100644 --- a/src/web_video_server.cpp +++ b/src/web_video_server.cpp @@ -138,7 +138,7 @@ void WebVideoServer::spin() { server_->run(); RCLCPP_INFO(nh_->get_logger(), "Waiting For connections on %s:%d", address_.c_str(), port_); - rclcpp::executors::MultiThreadedExecutor spinner(rclcpp::executor::create_default_executor_arguments(), ros_threads_); + rclcpp::executors::MultiThreadedExecutor spinner(rclcpp::ExecutorOptions(), ros_threads_); spinner.add_node(nh_); if ( publish_rate_ > 0 ) { nh_->create_wall_timer(1s / publish_rate_, [this](){restreamFrames(1.0 / publish_rate_);}); @@ -306,8 +306,9 @@ bool WebVideoServer::handle_list_streams(const async_web_server_cpp::HttpRequest } auto & topic_name = topic_and_types.first; auto & topic_type = topic_and_types.second[0]; // explicitly take the first + // TODO debugging - // fprintf(stderr, "topic_type: %s\n", topic_type.c_str()); + fprintf(stderr, "topic_type: %s\n", topic_type.c_str()); if (topic_type == "sensor_msgs/msg/Image" || topic_type == "sensor_msgs/Image") { image_topics.push_back(topic_name);