ros indigo catkin_make error

asked 2019-03-01 08:54:16 -0600

dara1400 gravatar image

updated 2019-03-01 15:32:06 -0600

gvdhoorn gravatar image

I am trying to catkin_make in ros indigo, and getting this error:

Can you help me?

In file included from /opt/ros/indigo/include/ros/serialization.h:37:0,
                 from /opt/ros/indigo/include/ros/publisher.h:34,
                 from /opt/ros/indigo/include/ros/node_handle.h:32,
                 from /opt/ros/indigo/include/ros/ros.h:45,
                 from /home/arc/catkin_ws/src/arc_ros_stream/src/arc_line_follower.cpp:1:
/opt/ros/indigo/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::MD5Sum<M>::value(const M&) [with M = int]’:
/opt/ros/indigo/include/ros/message_traits.h:255:102:   required from ‘const char* ros::message_traits::md5sum(const M&) [with M = int]’
/opt/ros/indigo/include/ros/publisher.h:112:7:   required from ‘void ros::Publisher::publish(const M&) const [with M = int]’
/home/arc/catkin_ws/src/arc_ros_stream/src/arc_line_follower.cpp:163:29:   required from here
/opt/ros/indigo/include/ros/message_traits.h:126:34: error: request for member ‘__getMD5Sum’ in ‘m’, which is of non-class type ‘const int’
     return m.__getMD5Sum().c_str();

Edit:

void gripper_grip_callback(const std_msgs::Float32::ConstPtr& grip_msg)
{

    gripper_grip_pub.publish(50);

}

the line 163 is "gripper_grip_pub.publish(50); " and all other errors occure when i call publish in this file . and i know this file worked until yesterday but i had to change gui because some reasons and so i reinstalled the ros . and i don't know which package is required for this publishing in cpp codes . also i don't have any problem in publishing data by python . so i don't know what's happening here . thanks for your giude.

edit retag flag offensive close merge delete

Comments

Your problem is here: /home/arc/catkin_ws/src/arc_ros_stream/src/arc_line_follower.cpp:163:29 Can you provide this part of the code and from what it seems, can you paste the definition of the variable that is used in your publisher, it looks like you are using a wrong type

Dyson sphere gravatar image Dyson sphere  ( 2019-03-01 10:58:54 -0600 )edit

Every where in the code, pulish has this error

dara1400 gravatar image dara1400  ( 2019-03-01 11:31:34 -0600 )edit
2

The problem is most likely that your trying to publish an int (ie: the C++ primitive type), instead of a std_msgs/IntX (where x <- [8, 16, 32, 64]).

Can you show how you call publish(..)?

gvdhoorn gravatar image gvdhoorn  ( 2019-03-01 11:47:51 -0600 )edit
1

You cannot publish(..) integers directly. That is the reason for the error.

i know this file worked until yesterday

I'm not saying you're lying, but that would seem strange.

i don't have any problem in publishing data by python

that's because Python will automatically convert ..

gvdhoorn gravatar image gvdhoorn  ( 2019-03-01 15:33:46 -0600 )edit
1

.. the int into a message for you.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-01 15:34:00 -0600 )edit