Ask Your Question
0

Creating generic subscriber in kinetic (C++11)

asked 2018-08-28 01:03:35 -0600

teshansj gravatar image

updated 2018-08-28 01:04:41 -0600

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 ...
(more)
edit retag flag offensive close merge delete

Comments

#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 ..

gvdhoorn gravatar imagegvdhoorn ( 2018-08-28 03:15:13 -0600 )edit

.. 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.

gvdhoorn gravatar imagegvdhoorn ( 2018-08-28 03:15:36 -0600 )edit

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

teshansj gravatar imageteshansj ( 2018-08-28 03:23:52 -0600 )edit

Example code in ROS Wiki must be updated for kinetic

exactly. So it would be nice if you could report that to the author.

gvdhoorn gravatar imagegvdhoorn ( 2018-08-28 03:24:42 -0600 )edit
1
teshansj gravatar imageteshansj ( 2018-08-28 03:44:52 -0600 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2018-09-09 11:30:52 -0600

Davide Faconti gravatar image

Hi,

I am the author of the library. My bad, the Wiki is very obsolete and the API changed in the following versions.

Please refer to the examples here :

https://github.com/facontidavide/type...

and

https://github.com/facontidavide/type...

And if you have any question, please let me know.

Davide

edit flag offensive delete link more

Comments

Davide: would it make sense to delete the example on the wiki and refer users to the Github repository?

gvdhoorn gravatar imagegvdhoorn ( 2018-09-09 12:20:59 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-08-28 01:03:35 -0600

Seen: 169 times

Last updated: Sep 09 '18