RobotWebTools / web_video_server

HTTP Streaming of ROS Image Topics in Multiple Formats
http://ros.org/wiki/web_video_server
Other
269 stars 187 forks source link

ROS2 foxy build fails #105

Open nplan opened 4 years ago

nplan commented 4 years ago

Building for ros2 foxy (branch ros2) fails with error:

/home/pi/dev_ws/src/web_video_server/src/ros_compressed_streamer.cpp:22:103: error: no matching function for call to ‘rclcpp::Node::create_subscription<sensor_msgs::msg::CompressedImage>(std::__cxx11::string&, std::_Bind_helper<false, void (web_video_server::RosCompressedStreamer::*)(std::shared_ptr<const sensor_msgs::msg::CompressedImage_<std::allocator<void> > >), web_video_server::RosCompressedStreamer*, const std::_Placeholder<1>&>::type, int)’
     compressed_topic, std::bind(&RosCompressedStreamer::imageCallback, this, std::placeholders::_1), 1);
                                                                                                       ^
In file included from /home/pi/ros2_foxy/install/rclcpp/include/rclcpp/executors/single_threaded_executor.hpp:28,
                 from /home/pi/ros2_foxy/install/rclcpp/include/rclcpp/executors.hpp:22,
                 from /home/pi/ros2_foxy/install/rclcpp/include/rclcpp/rclcpp.hpp:146,
                 from /home/pi/dev_ws/src/web_video_server/include/web_video_server/image_streamer.h:4,
                 from /home/pi/dev_ws/src/web_video_server/include/web_video_server/ros_compressed_streamer.h:5,
                 from /home/pi/dev_ws/src/web_video_server/src/ros_compressed_streamer.cpp:1:
/home/pi/ros2_foxy/install/rclcpp/include/rclcpp/node.hpp:211:3: note: candidate: ‘template<class MessageT, class CallbackT, class AllocatorT, class CallbackMessageT, class SubscriptionT, class MessageMemoryStrategyT> std::shared_ptr<SubscriptionT> rclcpp::Node::create_subscription(const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr)’
   create_subscription(
   ^~~~~~~~~~~~~~~~~~~
/home/pi/ros2_foxy/install/rclcpp/include/rclcpp/node.hpp:211:3: note:   template argument deduction/substitution failed:
/home/pi/dev_ws/src/web_video_server/src/ros_compressed_streamer.cpp:22:32: note:   cannot convert ‘std::bind(_Func&&, _BoundArgs&& ...) [with _Func = void (web_video_server::RosCompressedStreamer::*)(std::shared_ptr<const sensor_msgs::msg::CompressedImage_<std::allocator<void> > >); _BoundArgs = {web_video_server::RosCompressedStreamer*, const std::_Placeholder<1>&}; typename std::_Bind_helper<std::__is_socketlike<_Func>::value, _Func, _BoundArgs ...>::type = std::_Bind<void (web_video_server::RosCompressedStreamer::*(web_video_server::RosCompressedStreamer*, std::_Placeholder<1>))(std::shared_ptr<const sensor_msgs::msg::CompressedImage_<std::allocator<void> > >)>](((web_video_server::RosCompressedStreamer*)this), std::placeholders::_1)’ (type ‘std::_Bind_helper<false, void (web_video_server::RosCompressedStreamer::*)(std::shared_ptr<const sensor_msgs::msg::CompressedImage_<std::allocator<void> > >), web_video_server::RosCompressedStreamer*, const std::_Placeholder<1>&>::type’ {aka ‘std::_Bind<void (web_video_server::RosCompressedStreamer::*(web_video_server::RosCompressedStreamer*, std::_Placeholder<1>))(std::shared_ptr<const sensor_msgs::msg::CompressedImage_<std::allocator<void> > >)>’}) to type ‘const rclcpp::QoS&’
     compressed_topic, std::bind(&RosCompressedStreamer::imageCallback, this, std::placeholders::_1), 1);

Platform: Rasbperry Pi 4 with Raspbian Buster

AviKenz commented 4 years ago

i have the same issue. any solution or tip ? i checkout the ros2 branch and build with async_web_server my configuration:

Thanks in advance.

nplan commented 4 years ago

I opened a pull request #107 that fixes the build. There are still some issues though:

DomenicP commented 3 years ago

I tried #107 a few days ago and while that solved some of the build issues under Foxy, new ones seem to have popped up in the meantime. I opened #111 with the full set of changes I needed to get the package to work under Foxy. I also fixed some deprecation warnings along the way. I confirmed that at least the mjpeg and ros_compressed stream types are working.

jgvictores commented 1 year ago

Currently able to compile (minimal warnings) from source (sorry if the issue looks stale, but Foxy itself is not so old ^^).

Compiled via (use sudo for apt commands as applicable, not my case because in a docker with root; also adapt your workspace (*_ws) path):

apt update
apt install ros-foxy-async-web-server-cpp ros-foxy-cv-bridge ros-foxy-image-transport
cd /demo_ws/src
git clone --branch ros2 https://github.com/RobotWebTools/web_video_server
cd /demo_ws
colcon build --packages-select web_video_server

The above was done with:

Run via (again, also adapt your workspace (*_ws) path):

source /demo_ws/install/setup.sh
ros2 run web_video_server web_video_server

PS: This is just some minimal documentation of working versions. Thanks a lot to all the effort of the developers @DomenicP and a long "et al" at https://github.com/RobotWebTools/web_video_server/pull/111