0
$\begingroup$

Rosanswers logo

I have been following the beginner tutorials since #1 but I have ran into a problem on #11.

http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29

I am using ROS Kinetic Kame on Ubuntu 16.04.

When I run catkin_make after adding the talker and listener .cpp files, and editing the CMakeLists.txt file, I get a massive wall of text with a few red colored words littered throughout. My "talker" executable is created but the "listener" fails and I have no idea how to parse through the text. It is so long that my catkin_make call is lost.

I did notice some inconsistencies in the tutorial itself. It says that my CMakeLists.txt file should look like this before editing:

cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)

## Find catkin and any catkin packages
find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg)

## Declare ROS messages and services
add_message_files(DIRECTORY msg FILES Num.msg)
add_service_files(DIRECTORY srv FILES AddTwoInts.srv)

## Generate added messages and services
generate_messages(DEPENDENCIES std_msgs)

## Declare a catkin package
catkin_package()

but the arguments DIRECTORY, msg, and srv were never added in the prior tutorials. Also, catkin_package() did not have zero arguments.

I tried adding the lines that the tutorial instructs us to add at the end and it did not work. Then I used the CMakeLists.txt file that it provided and it still did not work.

I would post the catkin_make result but it is so massive I don't think it would be any help. Ill post the small chunk that it ends with:

/usr/include/boost/math/special_functions/round.hpp:28:44: required from ‘typename boost::math::tools::promote_args::type boost::math::detail::round(const T&, const Policy&, mpl_::false_) [with T = double; Policy = boost::math::policies::policy<boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy>; typename boost::math::tools::promote_args::type = double; mpl_::false_ = mpl_::bool_]’ /usr/include/boost/math/special_functions/round.hpp:65:24: required from ‘typename boost::math::tools::promote_args::type boost::math::round(const T&, const Policy&) [with T = double; Policy = boost::math::policies::policy<boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy>; typename boost::math::tools::promote_args::type = double]’ /usr/include/boost/math/special_functions/round.hpp:70:16: required from ‘typename boost::math::tools::promote_args::type boost::math::round(const T&) [with T = double; typename boost::math::tools::promote_args::type = double]’ /opt/ros/kinetic/include/ros/time.h:153:89: required from ‘T& ros::TimeBase<T, D>::fromSec(double) [with T = ros::Time; D = ros::Duration]’ /opt/ros/kinetic/include/ros/time.h:180:31: required from here /usr/include/c++/6/ext/alloc_traits.h:61:53: error: no type named ‘size_type’ in ‘struct std::allocator_traits<std::allocator<boost::io::detail::format_item<char, std::char_traits, std::allocator > > >’ typedef typename _Base_type::size_type size_type; ^~~~~~~~~ /usr/include/c++/6/ext/alloc_traits.h:62:53: error: no type named ‘difference_type’ in ‘struct std::allocator_traits<std::allocator<boost::io::detail::format_item<char, std::char_traits, std::allocator > > >’ typedef typename _Base_type::difference_type difference_type; ^~~~~~~~~~~~~~~ /usr/include/c++/6/ext/alloc_traits.h:70:23: error: no members matching ‘__gnu_cxx::__alloc_traits<std::allocator<boost::io::detail::format_item<char, std::char_traits, std::allocator > > >::_Base_type {aka std::allocator_traits<std::allocator<boost::io::detail::format_item<char, std::char_traits, std::allocator > > >}::max_size’ in ‘__gnu_cxx::__alloc_traits<std::allocator<boost::io::detail::format_item<char, std::char_traits, std::allocator > > >::_Base_type {aka struct std::allocator_traits<std::allocator<boost::io::detail::format_item<char, std::char_traits, std::allocator > > >}’ using _Base_type::max_size; ^~~~~~~~ beginner_tutorials/CMakeFiles/listener.dir/build.make:62: recipe for target 'beginner_tutorials/CMakeFiles/listener.dir/src/listener.cpp.o' failed make[2]: *** [beginner_tutorials/CMakeFiles/listener.dir/src/listener.cpp.o] Error 1 CMakeFiles/Makefile2:359: recipe for target 'beginner_tutorials/CMakeFiles/listener.dir/all' failed make[1]: *** [beginner_tutorials/CMakeFiles/listener.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2 Invoking "make -j4 -l4" failed


Originally posted by futz on ROS Answers with karma: 3 on 2016-09-30

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Usually the beginning of the error message is the most important part; later errors are often a result of earlier errors.

In this case, the best I can tell from the piece of the error message that you've posted is that there's some kind of error in your talker code. Unfortunately the error message in this case is so verbose that I don't see any line numbers or other references to the actual location in your talker that might be causing trouble.

If you look through the error messages carefully you should occasionally see lines that reference your talker.cpp ; have a careful look at those lines to make sure they match the tutorial.


Originally posted by ahendrix with karma: 47576 on 2016-09-30

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by futz on 2016-09-30:
yup you were right, I made a mistake when copying into my .cpp file, I have both executables now.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.