Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gencpp bug in Hydro #21

Closed
pbeeson opened this issue Oct 15, 2014 · 18 comments
Closed

Gencpp bug in Hydro #21

pbeeson opened this issue Oct 15, 2014 · 18 comments

Comments

@pbeeson
Copy link

pbeeson commented Oct 15, 2014

I was having an issue with compiling when using the message-filter sync policies with custom messages that all contain std-msgs/Header fields. Poking around further, it became clear that the .h file generated for my custom messages do not have HasHeader templates. Cutting and pasting the HasHeader() template from Sensor-msgs/Image.h and changing the names, my code compiles. Look like this is a bug in gencpp for hydro???

@pbeeson
Copy link
Author

pbeeson commented Oct 15, 2014

I just ran a simple test with a message that ONLY contains a Header and the .h file created by gencpp leaves out the HasHeader template that message filters use.

@pbeeson
Copy link
Author

pbeeson commented Oct 15, 2014

Actually, looking further this may be a bug in genmsg.

@dirk-thomas
Copy link
Member

Can you please describe in more detail what you are trying to do, what the current result/behavior is and what you are expecting instead? At best with an easy to reproduce example.

@pbeeson
Copy link
Author

pbeeson commented Oct 15, 2014

Easy to see the issue:

  1. make a new ros "package" directory.
  2. Change CMake file to generate messages
  3. make a msg/ directory
  4. Add Test.msg that just has one line: "std_msgs/Header header"
  5. build
  6. Look at the package/Test.h file generated by gencpp.
  7. There is no template for HasHeader in ros::message_traits namespace.

ros message_filter policies like ExactTime and ApproximateTime use HasHeader() to determine whether or not the message has a header field that can be synched to another message. Without the HasHeader template (which is in sensors_msgs/Image.h for example) these policies will not compile. So any non-standard ros message that includes a header field is no longer usable with the message_filter synchronization. This used to not be the case (don't know how long ago, but at some point in the past)

@dirk-thomas
Copy link
Member

When I build the following message which has a header field:

https://github.com/ros/common_msgs/blob/13b7cc2e81ea2e8e68e7f081f352eee50bb5f78a/geometry_msgs/msg/PointStamped.msg

the generated code contains the HasHeader template specializations for me:

template <class ContainerAllocator>
struct HasHeader< ::geometry_msgs::PointStamped_<ContainerAllocator> >
  : TrueType
  { };
template <class ContainerAllocator>
struct HasHeader< ::geometry_msgs::PointStamped_<ContainerAllocator> const>
  : TrueType
  { };

So do the currently generated Debian packages: e.g. the file opt/ros/hydro/include/geometry_msgs/PointStamped.h in http://packages.ros.org/ros/ubuntu/pool/main/r/ros-hydro-geometry-msgs/ros-hydro-geometry-msgs_1.10.6-0precise-20140819-2041-+0000_amd64.deb

@pbeeson
Copy link
Author

pbeeson commented Oct 15, 2014

Well I'm just using ros-hydro-desktop-full install on precise 12.04, so I
don't know why my setup would be any different. But it is.

On Wednesday, October 15, 2014, Dirk Thomas notifications@github.com
wrote:

When I build the following message which has a header field:

https://github.com/ros/common_msgs/blob/13b7cc2e81ea2e8e68e7f081f352eee50bb5f78a/geometry_msgs/msg/PointStamped.msg

the generated code contains the HasHeader template specializations for me:

template
struct HasHeader< ::geometry_msgs::PointStamped_ >
: TrueType
{ };
template
struct HasHeader< ::geometry_msgs::PointStamped_ const>
: TrueType
{ };

So do the currently generated Debian packages: e.g.
http://packages.ros.org/ros/ubuntu/pool/main/r/ros-hydro-geometry-msgs/ros-hydro-geometry-msgs_1.10.6-0precise-20140819-2041-+0000_amd64.deb


Reply to this email directly or view it on GitHub
#21 (comment).

@dirk-thomas
Copy link
Member

Please provide a complete sequence of commands you invoke, including all exact sources, which might allow to reproduce the problem you are facing.

@pbeeson
Copy link
Author

pbeeson commented Oct 15, 2014

pbeeson@cyberman:~$ sudo apt-get install ros-hydro-desktop-full
[sudo] password for pbeeson: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ros-hydro-desktop-full is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pbeeson@cyberman:~$ source /opt/ros/hydro/setup.bash 
pbeeson@cyberman:~$ export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/test
pbeeson@cyberman:~$ roscreate-pkg test
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WARNING: current working directory is not on ROS_PACKAGE_PATH!
Please update your ROS_PACKAGE_PATH environment variable.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Created package directory /home/pbeeson/test
Created package file /home/pbeeson/test/Makefile
Created package file /home/pbeeson/test/manifest.xml
Created package file /home/pbeeson/test/CMakeLists.txt
Created package file /home/pbeeson/test/mainpage.dox

Please edit test/manifest.xml and mainpage.dox to finish creating your package
pbeeson@cyberman:~$ cd test
pbeeson@cyberman:~/test$ mkdir msg
pbeeson@cyberman:~/test$ echo std_msgs/Header header > msg/Test.msg
pbeeson@cyberman:~/test$ emacs CMakeLists.txt 
pbeeson@cyberman:~/test$ #uncommented rosbuild_genmsg
pbeeson@cyberman:~/test$ cat CMakeLists.txt
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)

rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#uncomment if you have defined messages
rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()

#common commands for building c++ executables and libraries
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_add_boost_directories()
#rosbuild_link_boost(${PROJECT_NAME} thread)
#rosbuild_add_executable(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})
pbeeson@cyberman:~/test$ make
mkdir -p bin
cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=/opt/ros/hydro/share/ros/core/rosbuild/rostoolchain.cmake  ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/lib/ccache/gcc
-- Check for working C compiler: /usr/lib/ccache/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/lib/ccache/c++
-- Check for working CXX compiler: /usr/lib/ccache/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.3")
[rosbuild] Building package test
[rosbuild] Cached build flags older than manifests; calling rospack to get flags
-- Using CATKIN_DEVEL_PREFIX: /home/pbeeson/test/build/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/hydro
-- This workspace overlays: /opt/ros/hydro
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Python version: 2.7
-- Using Debian Python package layout
-- Using CATKIN_ENABLE_TESTING: ON
-- Skip enable_testing() for dry packages
-- Using CATKIN_TEST_RESULTS_DIR: /home/pbeeson/test/build/test_results
-- Found gtest: gtests will be built
-- catkin 0.5.89
-- Using these message generators: gencpp;genlisp;genpy
[rosbuild] Including /opt/ros/hydro/share/roslisp/rosbuild/roslisp.cmake
[rosbuild] Including /opt/ros/hydro/share/roscpp/rosbuild/roscpp.cmake
[rosbuild] Including /opt/ros/hydro/share/rospy/rosbuild/rospy.cmake
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pbeeson/test/build
cd build && make 
make[1]: Entering directory `/home/pbeeson/test/build'
make[2]: Entering directory `/home/pbeeson/test/build'
make[3]: Entering directory `/home/pbeeson/test/build'
Scanning dependencies of target rosbuild_premsgsrvgen
make[3]: Leaving directory `/home/pbeeson/test/build'
[  0%] Built target rosbuild_premsgsrvgen
make[3]: Entering directory `/home/pbeeson/test/build'
Scanning dependencies of target ROSBUILD_genmsg_lisp
make[3]: Leaving directory `/home/pbeeson/test/build'
make[3]: Entering directory `/home/pbeeson/test/build'
[ 25%] Generating ../msg_gen/lisp/Test.lisp, ../msg_gen/lisp/_package.lisp, ../msg_gen/lisp/_package_Test.lisp
make[3]: Leaving directory `/home/pbeeson/test/build'
[ 25%] Built target ROSBUILD_genmsg_lisp
make[3]: Entering directory `/home/pbeeson/test/build'
Scanning dependencies of target ROSBUILD_genmsg_py
make[3]: Leaving directory `/home/pbeeson/test/build'
make[3]: Entering directory `/home/pbeeson/test/build'
[ 50%] Generating ../src/test/msg/_Test.py
[ 75%] Generating ../src/test/msg/__init__.py
make[3]: Leaving directory `/home/pbeeson/test/build'
[ 75%] Built target ROSBUILD_genmsg_py
make[3]: Entering directory `/home/pbeeson/test/build'
Scanning dependencies of target ROSBUILD_genmsg_cpp
make[3]: Leaving directory `/home/pbeeson/test/build'
make[3]: Entering directory `/home/pbeeson/test/build'
[100%] Generating ../msg_gen/cpp/include/test/Test.h
make[3]: Leaving directory `/home/pbeeson/test/build'
[100%] Built target ROSBUILD_genmsg_cpp
make[3]: Entering directory `/home/pbeeson/test/build'
Scanning dependencies of target rospack_genmsg
make[3]: Leaving directory `/home/pbeeson/test/build'
[100%] Built target rospack_genmsg
make[3]: Entering directory `/home/pbeeson/test/build'
Scanning dependencies of target rospack_genmsg_all
make[3]: Leaving directory `/home/pbeeson/test/build'
[100%] Built target rospack_genmsg_all
make[2]: Leaving directory `/home/pbeeson/test/build'
make[1]: Leaving directory `/home/pbeeson/test/build'
pbeeson@cyberman:~/test$ grep -r HasHeader msg_gen/cpp/include/
pbeeson@cyberman:~/test$ grep -r HasHeader /opt/ros/hydro/include/sensor_msgs/
/opt/ros/hydro/include/sensor_msgs/JoyFeedbackArray.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': False}
/opt/ros/hydro/include/sensor_msgs/JoyFeedbackArray.h:struct HasHeader< ::sensor_msgs::JoyFeedbackArray_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/JoyFeedbackArray.h:struct HasHeader< ::sensor_msgs::JoyFeedbackArray_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/MultiEchoLaserScan.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/MultiEchoLaserScan.h:struct HasHeader< ::sensor_msgs::MultiEchoLaserScan_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/MultiEchoLaserScan.h:struct HasHeader< ::sensor_msgs::MultiEchoLaserScan_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/NavSatStatus.h:// BOOLTRAITS {'IsFixedSize': True, 'IsMessage': True, 'HasHeader': False}
/opt/ros/hydro/include/sensor_msgs/NavSatStatus.h:struct HasHeader< ::sensor_msgs::NavSatStatus_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/NavSatStatus.h:struct HasHeader< ::sensor_msgs::NavSatStatus_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/MagneticField.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/MagneticField.h:struct HasHeader< ::sensor_msgs::MagneticField_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/MagneticField.h:struct HasHeader< ::sensor_msgs::MagneticField_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/Joy.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/Joy.h:struct HasHeader< ::sensor_msgs::Joy_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/Joy.h:struct HasHeader< ::sensor_msgs::Joy_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/LaserEcho.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': False}
/opt/ros/hydro/include/sensor_msgs/LaserEcho.h:struct HasHeader< ::sensor_msgs::LaserEcho_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/LaserEcho.h:struct HasHeader< ::sensor_msgs::LaserEcho_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/RelativeHumidity.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/RelativeHumidity.h:struct HasHeader< ::sensor_msgs::RelativeHumidity_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/RelativeHumidity.h:struct HasHeader< ::sensor_msgs::RelativeHumidity_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/Illuminance.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/Illuminance.h:struct HasHeader< ::sensor_msgs::Illuminance_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/Illuminance.h:struct HasHeader< ::sensor_msgs::Illuminance_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/SetCameraInfoRequest.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': False}
/opt/ros/hydro/include/sensor_msgs/SetCameraInfoRequest.h:struct HasHeader< ::sensor_msgs::SetCameraInfoRequest_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/SetCameraInfoRequest.h:struct HasHeader< ::sensor_msgs::SetCameraInfoRequest_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/SetCameraInfoResponse.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': False}
/opt/ros/hydro/include/sensor_msgs/SetCameraInfoResponse.h:struct HasHeader< ::sensor_msgs::SetCameraInfoResponse_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/SetCameraInfoResponse.h:struct HasHeader< ::sensor_msgs::SetCameraInfoResponse_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/MultiDOFJointState.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/MultiDOFJointState.h:struct HasHeader< ::sensor_msgs::MultiDOFJointState_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/MultiDOFJointState.h:struct HasHeader< ::sensor_msgs::MultiDOFJointState_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/FluidPressure.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/FluidPressure.h:struct HasHeader< ::sensor_msgs::FluidPressure_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/FluidPressure.h:struct HasHeader< ::sensor_msgs::FluidPressure_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/CompressedImage.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/CompressedImage.h:struct HasHeader< ::sensor_msgs::CompressedImage_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/CompressedImage.h:struct HasHeader< ::sensor_msgs::CompressedImage_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/LaserScan.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/LaserScan.h:struct HasHeader< ::sensor_msgs::LaserScan_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/LaserScan.h:struct HasHeader< ::sensor_msgs::LaserScan_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/Range.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/Range.h:struct HasHeader< ::sensor_msgs::Range_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/Range.h:struct HasHeader< ::sensor_msgs::Range_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/PointField.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': False}
/opt/ros/hydro/include/sensor_msgs/PointField.h:struct HasHeader< ::sensor_msgs::PointField_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/PointField.h:struct HasHeader< ::sensor_msgs::PointField_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/NavSatFix.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/NavSatFix.h:struct HasHeader< ::sensor_msgs::NavSatFix_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/NavSatFix.h:struct HasHeader< ::sensor_msgs::NavSatFix_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/PointCloud.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/PointCloud.h:struct HasHeader< ::sensor_msgs::PointCloud_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/PointCloud.h:struct HasHeader< ::sensor_msgs::PointCloud_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/JointState.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/JointState.h:struct HasHeader< ::sensor_msgs::JointState_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/JointState.h:struct HasHeader< ::sensor_msgs::JointState_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/RegionOfInterest.h:// BOOLTRAITS {'IsFixedSize': True, 'IsMessage': True, 'HasHeader': False}
/opt/ros/hydro/include/sensor_msgs/RegionOfInterest.h:struct HasHeader< ::sensor_msgs::RegionOfInterest_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/RegionOfInterest.h:struct HasHeader< ::sensor_msgs::RegionOfInterest_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/ChannelFloat32.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': False}
/opt/ros/hydro/include/sensor_msgs/ChannelFloat32.h:struct HasHeader< ::sensor_msgs::ChannelFloat32_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/ChannelFloat32.h:struct HasHeader< ::sensor_msgs::ChannelFloat32_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/TimeReference.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/TimeReference.h:struct HasHeader< ::sensor_msgs::TimeReference_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/TimeReference.h:struct HasHeader< ::sensor_msgs::TimeReference_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/CameraInfo.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/CameraInfo.h:struct HasHeader< ::sensor_msgs::CameraInfo_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/CameraInfo.h:struct HasHeader< ::sensor_msgs::CameraInfo_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/Imu.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/Imu.h:struct HasHeader< ::sensor_msgs::Imu_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/Imu.h:struct HasHeader< ::sensor_msgs::Imu_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/Image.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/Image.h:struct HasHeader< ::sensor_msgs::Image_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/Image.h:struct HasHeader< ::sensor_msgs::Image_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/JoyFeedback.h:// BOOLTRAITS {'IsFixedSize': True, 'IsMessage': True, 'HasHeader': False}
/opt/ros/hydro/include/sensor_msgs/JoyFeedback.h:struct HasHeader< ::sensor_msgs::JoyFeedback_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/JoyFeedback.h:struct HasHeader< ::sensor_msgs::JoyFeedback_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/Temperature.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/Temperature.h:struct HasHeader< ::sensor_msgs::Temperature_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/Temperature.h:struct HasHeader< ::sensor_msgs::Temperature_<ContainerAllocator> const>
/opt/ros/hydro/include/sensor_msgs/PointCloud2.h:// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True}
/opt/ros/hydro/include/sensor_msgs/PointCloud2.h:struct HasHeader< ::sensor_msgs::PointCloud2_<ContainerAllocator> >
/opt/ros/hydro/include/sensor_msgs/PointCloud2.h:struct HasHeader< ::sensor_msgs::PointCloud2_<ContainerAllocator> const>
pbeeson@cyberman:~/test$  rosmsg show test/Test 
std_msgs/Header header
  uint32 seq
  time stamp
  string frame_id
pbeeson@cyberman:~/test$ 

@wjwwood
Copy link
Member

wjwwood commented Oct 15, 2014

@pbeeson Please use a gist.github.com or format your code into a code block when posting something like this. For example, I have tried to reproduce what you were talking about myself:

https://gist.github.com/wjwwood/489ffcc4ecca797b54b3

However, I was using catkin and not rosbuild as you appear to be (these are the kinds of details we need to know in order to help out). I think @dirk-thomas is going to try and reproduce your issue with rosbuild.

@pbeeson
Copy link
Author

pbeeson commented Oct 15, 2014

pbeeson@cyberman:~/test$ dpkg -l | grep ros-hydro-gen
ii  ros-hydro-gencpp                           0.4.17-0precise-20140617-0316-+0000                  C++ ROS message and service generators.
ii  ros-hydro-genlisp                          0.4.14-0precise-20140617-0316-+0000                  Common-Lisp ROS message and service generators.
ii  ros-hydro-genmsg                           0.4.25-0precise-20140617-0313-+0000                  Standalone Python library for generating ROS message and service data structures for various languages.
ii  ros-hydro-genpy                            0.4.17-0precise-20140617-0316-+0000                  Python ROS message and service generators.

@pbeeson
Copy link
Author

pbeeson commented Oct 15, 2014

I can also verify that this behavior DOES NOT happen when using catkin. It only occurs when using rosbuild. But lots of people still use rosbuild for various reasons.

@dirk-thomas
Copy link
Member

With rosbuild I can confirm to see exactly the same behavior as @pbeeson.

Anyway this is definitely not a gencpp bug then since rosbuild uses it's own generator for backward compatibility reasons which can be found here: https://github.com/ros/ros_comm/tree/indigo-devel/clients/roscpp/rosbuild

As far as I am aware the rosbuild-based message code never contained anything HasHeader related. This is a feature introduced with gencpp in Fuerte. What makes you think that previously rosbuild based messages had that template?

May be you could describe in detail what you actually want to do with the message_filters and how exactly it fails?

@pbeeson
Copy link
Author

pbeeson commented Oct 15, 2014

Look up the Time Synchorinzer examples. Plug in that Test.msg to any example instead of Image and PointCloud. When using rosbuild, essentially you get the EXACT same compile error as if you tried to set up a Time Synchronizer for a pair of messages that had no header at all.

http://answers.ros.org/question/84456/trying-to-write-test-pgm-for-timesync/

But I DO have a header.

This used to work, so maybe message_filters have changed significantly in either groovy or hydro to use HasHeader without any thought as to how it might affect rosbuild users? But it looks like ros_comm has msg_gen.py that tries to add a HasHeader block in it.

This is a pretty big problem in my opinion. Essentially, I can only use custom messages with the message filter synchronizers if I use catkin (or go in and manually add these HasHeader template lines to headers), which is impractical for many of my projects (controlled by large governmental agencies or third parties) that still use rosbuild.

BTW, I CAN actually get this working by adding the two HasHeader templates to my node's header, but that's SUPER inconvient when tools like rosbuild exist and worked (at least in Fuerte).

Maybe move over to an issue with message_filters or ros_comm?

@pbeeson
Copy link
Author

pbeeson commented Oct 15, 2014

Also, I'm on travel in Sweden, so I will soon be out of contact for the night, as I'm 9 hours ahead of you guys at OSRF. Hopefully you have enough info to look into this further. I'll just assume this will be fixed and in the repo by the time I wake up ;) Thanks!!

@pbeeson
Copy link
Author

pbeeson commented Oct 15, 2014

GOT IT!!!!

When using rosbuild, it works if the message has this line:
Header header
but not this line:
std_msgs/Header header

It's a parsing error.

(I knew I had used this before.)

@dirk-thomas
Copy link
Member

When I try this example (http://wiki.ros.org/message_filters#Example_.28C.2B-.2B-.29-1) it fails to compile with the following error:

/opt/ros/indigo/include/message_filters/sync_policies/exact_time.h:127:101: error: ‘value’ is not a member of ‘ros::message_traits::TimeStamp<test::Test_<std::allocator<void> >, void>’

Do you have a custom definition of the template specialization for your message type?

Btw message_filters haven't changes for several years: https://github.com/ros/ros_comm/commits/indigo-devel/utilities/message_filters

@pbeeson
Copy link
Author

pbeeson commented Oct 15, 2014

Yep that's the error. If you use the Test.msg from above (that had only std_msgs/Header header) you'd see the same thing. Remove the std_msgs/ string and it compiles no problem. The rosbuild msg gen does not see that the message has a header if the std_msgs/ string is prefixed on the the Header type in a message.

I wonder if this fragile parse has been in rosbuild forever? Usually I leave off std_msgs/, but on my current project, I'm working with newbiews to ROS, so I had typed out the full path to the Header message type in my custom message.

That one std_msg/ string caused me HOURS of issues, and no one has ever seen this before? Please document this somewhere, as ROS Answers and Google were no help in solving this.

@dirk-thomas
Copy link
Member

That is indeed the reason. I have never seen any example using std_msgs/Header header - every example code in the wiki shows the "correct" way (Header header) - but I can see the confusion. I filled a ticket against the rosbuild-specific message parser to accept both: ros/ros#67

Since you can easily work around it by using:

Header header

instead of:

    std_msgs/Header header

I won't do a new release of the package in question but schedule it only for the next patch release.

I will close this ticket. Thank you for the help looking into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants