Creating generic subscriber in kinetic (C++11)
I am trying go create a generic subscriber as in this wiki example. But when I try catkin_make with the example code, it gives me error: ‘ROSTypeList’ was not declared in this scope
static std::map<std::string,ROSTypeList> registered_type;
I am a noob to ROS. I searched the files of the ros_type_introspection pkg installation for ROSTypeList
in the ros_type_introspection namespace but couldn't find anything similar. However this is typedef'ed in here in parser.hpp but it is for jade as I understand. There is no parser.hpp or a ROSTypeList
in here which is for kinetic. What am I doing wrong?
I did both apt installation and package installation from git in order to install ros_type_introspection. Both gives the same output. Here's the full catkin_make error
[ 97%] Building CXX object loggertest/CMakeFiles/logging_server.dir/src/gen_sub.cpp.o
[ 97%] Built target loggertest_generate_messages
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp: In function ‘void messageCallback(const ConstPtr&, const string&)’:
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp:26:31: error: ‘ROSTypeList’ was not declared in this scope
static std::map<std::string,ROSTypeList> registered_type;
^
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp:26:42: error: template argument 2 is invalid
static std::map<std::string,ROSTypeList> registered_type;
^
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp:26:42: error: template argument 4 is invalid
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp:29:10: error: ‘ROSTypeFlat’ does not name a type
static ROSTypeFlat flat_container;
^
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp:34:23: error: request for member ‘find’ in ‘registered_type’, which is of non-class type ‘int’
if( registered_type.find( datatype ) == registered_type.end() )
^
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp:34:59: error: request for member ‘end’ in ‘registered_type’, which is of non-class type ‘int’
if( registered_type.find( datatype ) == registered_type.end() )
^
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp:36:17: error: expected ‘;’ before ‘typelist’
ROSTypeList typelist = buildROSTypeMapFromDefinition(datatype, definition);
^
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp:37:20: error: no match for ‘operator[]’ (operand types are ‘int’ and ‘const string {aka const std::__cxx11::basic_string<char>}’)
registered_type[datatype] = typelist;
^
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp:37:33: error: ‘typelist’ was not declared in this scope
registered_type[datatype] = typelist;
^
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp:43:22: error: ‘const ConstPtr {aka const class boost::shared_ptr<const topic_tools::ShapeShifter>}’ has no member named ‘size’
buffer.resize( msg.size() );
^
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp:47:21: error: ‘_ros_type_map’ was not declared in this scope
buildRosFlatType( _ros_type_map,
^
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp:51:22: error: ‘flat_container’ was not declared in this scope
&flat_container // the output
^
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp:52:19: error: ‘buildRosFlatType’ was not declared in this scope
);
^
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp: In function ‘int main(int, char**)’:
/home/teshanl/catkin_ws/src/loggertest/src/gen_sub.cpp:70:30: error: ‘DataStreamROS’ has not been declared
callback = boost::bind( &DataStreamROS::topicCallback, this ...
#q301009 also reported problems with the example on the wiki, but the OP of that question never reported it to the author of
ros_type_introspection
. I would encourage you to post this on the issue tracker, as it could .... be that the examples just need to be updated.
If you do post on the issue tracker, please comment here with a link to the issue so we keep things connected.
The example code from facontidavide's this git repo works fine so I ended up using it. The approach there is little different but the code does the same thing. Example code in ROS Wiki must be updated for kinetic
exactly. So it would be nice if you could report that to the author.
I just did