ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

kinect_aux compilation errors

asked 2011-02-24 14:07:38 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I am having some issues getting kinect_aux to compile cleanly under diamondback.

This is the 2nd hour I have logged working with ROS, so forgive me if I've missed the obvious. I get compile errors @ lines 108 and 110 -- publish methods on comm classes I think...

I got rid of the error on line 108 by changing the double cast to float64_t -- but the error on 110 remains -- despite various attempts to cast to class happy types..

Compiler output is at the end -- here is the code localized -- if the two publish method calls are commented out -- all compiles -- but I want to change the tilt -- so thats moot.

// publish tilt angle and status -- ORIGINAL

    if (pub_tilt_angle.getNumSubscribers() > 0)
            pub_tilt_angle.publish(double(tilt_angle) / 2.);
    if (pub_tilt_status.getNumSubscribers() > 0)
            pub_tilt_status.publish(tilt_status);

// publish tilt angle and status -- FIXED 108

    if (pub_tilt_angle.getNumSubscribers() > 0)
            pub_tilt_angle.publish(float64_t(tilt_angle) / 2.);
    if (pub_tilt_status.getNumSubscribers() > 0)
            pub_tilt_status.publish(tilt_status);

Error snippet...

[ rosmake ] Last 40 linesnect_aux: 1.3 sec ] [ kinect_camera: 0.6 sec ]                                                                                                                                                                             [ 2 Active 57/60 Complete ]
{-------------------------------------------------------------------------------
  [  0%] Built target rospack_genmsg_libexe
  make[3]: Entering directory `/home/markc/kinect-devel/kinect/kinect_aux/build'
  make[3]: Leaving directory `/home/markc/kinect-devel/kinect/kinect_aux/build'
  [  0%] Built target rosbuild_precompile
  make[3]: Entering directory `/home/markc/kinect-devel/kinect/kinect_aux/build'
  make[3]: Leaving directory `/home/markc/kinect-devel/kinect/kinect_aux/build'
  make[3]: Entering directory `/home/markc/kinect-devel/kinect/kinect_aux/build'
  [100%] Building CXX object CMakeFiles/kinect_aux_node.dir/src/kinect_aux.o
  In file included from /opt/ros/diamondback/stacks/ros_comm/clients/cpp/roscpp_serialization/include/ros/serialization.h:35,
                   from /opt/ros/diamondback/stacks/ros_comm/clients/cpp/roscpp/include/ros/publisher.h:34,
                   from /opt/ros/diamondback/stacks/ros_comm/clients/cpp/roscpp/include/ros/node_handle.h:32,
                   from /opt/ros/diamondback/stacks/ros_comm/clients/cpp/roscpp/include/ros/ros.h:45,
                   from /home/markc/kinect-devel/kinect/kinect_aux/src/kinect_aux.cpp:2:
  /opt/ros/diamondback/stacks/ros_comm/clients/cpp/roscpp_traits/include/ros/message_traits.h: In static member function ‘static const char* ros::message_traits::MD5Sum<M>::value(const M&) [with M = double]’:
  /opt/ros/diamondback/stacks/ros_comm/clients/cpp/roscpp_traits/include/ros/message_traits.h:250:   instantiated from ‘const char* ros::message_traits::md5sum(const M&) [with M = double]’
  /opt/ros/diamondback/stacks/ros_comm/clients/cpp/roscpp/include/ros/publisher.h:111:   instantiated from ‘void ros::Publisher::publish(const M&) const [with M = double]’
  /home/markc/kinect-devel/kinect/kinect_aux/src/kinect_aux.cpp:108:   instantiated from here
  /opt/ros/diamondback/stacks/ros_comm/clients/cpp/roscpp_traits/include/ros/message_traits.h:121: error: request for member ‘__getMD5Sum’ in ‘m’, which is of non-class type ‘const double’
  /opt/ros/diamondback/stacks/ros_comm/clients/cpp/roscpp_traits/include/ros/message_traits.h: In static member function ‘static const char* ros::message_traits::DataType<M>::value(const M&) [with M = double]’:
  /opt/ros/diamondback/stacks/ros_comm/clients/cpp/roscpp_traits/include/ros/message_traits.h:259:   instantiated from ‘const char* ros::message_traits::datatype(const M&) [with M = double]’
  /opt/ros/diamondback/stacks/ros_comm/clients/cpp/roscpp/include/ros/publisher.h:111:   instantiated from ‘void ros::Publisher ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2011-02-24 16:24:09 -0500

Hmm, I don't see how that ever would have worked. Maybe the author forgot to push a later commit. Anyhow, try changing that block of code to this, which actually compiles and seems to work (at least, data is published--I can't say if it's right or not):

// publish tilt angle and status
if (pub_tilt_angle.getNumSubscribers() > 0)
{
  std_msgs::Float64 angle_msg;
  angle_msg.data = tilt_angle/2;
  pub_tilt_angle.publish(angle_msg);
}

if (pub_tilt_status.getNumSubscribers() > 0)
{
  std_msgs::UInt8 status_msg;
  status_msg.data = tilt_status;
  pub_tilt_status.publish(status_msg);
}
edit flag offensive delete link more
0

answered 2011-02-25 01:03:34 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Patrick,

This works, brilliant ! And thanks, that little bit of code put into context all the headers I read through trying to figure this out.

I was looking at the template types, and the 'C' stype casts -- and I got fumbled.

Great objectness, and well typed -- I think I'm going to enjoy this !

Mark

edit flag offensive delete link more

Comments

NP. I think that the author has also patched the repo so it should work if you update as well. Don't forget to mark your question as 'answered' (click the checkmark next to the answer you like best).
Patrick Bouffard gravatar image Patrick Bouffard  ( 2011-02-25 09:27:57 -0500 )edit

Question Tools

Stats

Asked: 2011-02-24 14:07:38 -0500

Seen: 591 times

Last updated: Feb 25 '11