Machine-Jonte/vive_ros

catkin_make error

cllAnn opened this issue · 3 comments

Hello, your package is very useful, but I have a problem.When I catkin_make, I report an error below. Do you know why?

error:
In file included from /opt/ros/melodic/include/ros/serialization.h:37:0,
from /opt/ros/melodic/include/geometry_msgs/PoseStamped.h:14,
from /home/cll-pc/catkin_ws/src/vive_ros/src/vive_pose.h:5,
from /home/cll-pc/catkin_ws/src/vive_ros/src/vive_pose.cpp:5:
/opt/ros/melodic/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::MD5Sum::value(const M&) [with M = float]’:
/opt/ros/melodic/include/ros/message_traits.h:254:102: required from ‘const char* ros::message_traits::md5sum(const M&) [with M = float]’
/opt/ros/melodic/include/ros/publisher.h:116:38: required from ‘void ros::Publisher::publish(const M&) const [with M = float]’
/home/cll-pc/catkin_ws/src/vive_ros/src/vive_pose.cpp:209:97: required from here
/opt/ros/melodic/include/ros/message_traits.h:125:14: error: request for member ‘__getMD5Sum’ in ‘m’, which is of non-class type ‘const float’
return m.__getMD5Sum().c_str();
~~^~~~~~~~~~~
/opt/ros/melodic/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::DataType::value(const M&) [with M = float]’:
/opt/ros/melodic/include/ros/message_traits.h:263:104: required from ‘const char* ros::message_traits::datatype(const M&) [with M = float]’
/opt/ros/melodic/include/ros/publisher.h:118:11: required from ‘void ros::Publisher::publish(const M&) const [with M = float]’
/home/cll-pc/catkin_ws/src/vive_ros/src/vive_pose.cpp:209:97: required from here
/opt/ros/melodic/include/ros/message_traits.h:142:14: error: request for member ‘__getDataType’ in ‘m’, which is of non-class type ‘const float’
return m.__getDataType().c_str();
~~^~~~~~~~~~~~~
/opt/ros/melodic/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::MD5Sum::value(const M&) [with M = int]’:
/opt/ros/melodic/include/ros/message_traits.h:254:102: required from ‘const char* ros::message_traits::md5sum(const M&) [with M = int]’
/opt/ros/melodic/include/ros/publisher.h:116:38: required from ‘void ros::Publisher::publish(const M&) const [with M = int]’
/home/cll-pc/catkin_ws/src/vive_ros/src/vive_pose.cpp:210:91: required from here
/opt/ros/melodic/include/ros/message_traits.h:125:14: error: request for member ‘__getMD5Sum’ in ‘m’, which is of non-class type ‘const int’
return m.__getMD5Sum().c_str();
~~^~~~~~~~~~~
/opt/ros/melodic/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::DataType::value(const M&) [with M = int]’:
/opt/ros/melodic/include/ros/message_traits.h:263:104: required from ‘const char* ros::message_traits::datatype(const M&) [with M = int]’
/opt/ros/melodic/include/ros/publisher.h:118:11: required from ‘void ros::Publisher::publish(const M&) const [with M = int]’
/home/cll-pc/catkin_ws/src/vive_ros/src/vive_pose.cpp:210:91: required from here
/opt/ros/melodic/include/ros/message_traits.h:142:14: error: request for member ‘__getDataType’ in ‘m’, which is of non-class type ‘const int’
return m.__getDataType().c_str();

Sorry to trouble you, but I really can't solve it

@cllAnn If you remember the solution, please post it here! Best thanks :))

Hi, it should be a problem of the initialization of the messages sent to the topics in the main function of the vive_pose node from line 205. Replacing it with the following code worked for me:

geometry_msgs::PoseStamped pose_msg;
pose_msg = controlHandler.pController[i]->pose.msg;
pub_controller_pose[i].publish(pose_msg);
std_msgs::Float32 trigger_msg;
trigger_msg.data = controlHandler.pController[i]->buttons.trigger;
pub_controller_trigger[i].publish(trigger_msg);
std_msgs::Int32 menu_msg;
menu_msg.data = controlHandler.pController[i]->buttons.menu;
pub_controller_menu[i].publish(menu_msg);
std_msgs::Int32 grip_msg;
grip_msg.data = controlHandler.pController[i]->buttons.grip;
pub_controller_grip[i].publish(grip_msg);
std_msgs::Float32MultiArray touchpad_msg;
touchpad_msg.data = controlHandler.pController[i]->buttons.touchpad;
pub_controller_touchpad[i].publish(touchpad_msg);

@reichlin Big thanks!
You can add a PR, would be greatly appreciated!