ROS错误:/opt/ros/indigo/include/ros/parameter_adapter.h

版权声明:本文为博主原创文章,未经博主允许不得转载 https://blog.csdn.net/qit1314/article/details/83034062
错误消息为:

In file included from /opt/ros/indigo/include/ros/subscription_callback_helper.h:35:0,
from /opt/ros/indigo/include/ros/subscriber.h:33,
from /opt/ros/indigo/include/ros/node_handle.h:33,
from /opt/ros/indigo/include/ros/ros.h:45,
from
/opt/ros/indigo/include/ros/parameter_adapter.h: In instantiation of ‘static ros::ParameterAdapter::Parameter ros::ParameterAdapter::getParameter(const Event&) [with M = std_msgs::Int32MultiArray_<std::allocator >&; ros::ParameterAdapter::Parameter = std_msgs::Int32MultiArray_<std::allocator >&; ros::ParameterAdapter::Event = ros::MessageEvent<const std_msgs::Int32MultiArray_<std::allocator > >; typename boost::remove_reference<typename boost::remove_const::type>::type = std_msgs::Int32MultiArray_<std::allocator >]’:
/opt/ros/indigo/include/ros/subscription_callback_helper.h:144:54: required from ‘void ros::SubscriptionCallbackHelperT<P, Enabled>::call(ros::SubscriptionCallbackHelperCallParams&) [with P = std_msgs::Int32MultiArray_<std::allocator >&; Enabled = void]’
/opt/ros/indigo/include/ros/parameter_adapter.h:78:30: error: invalid initialization of reference of type ‘ros::ParameterAdapter<std_msgs::Int32MultiArray_<std::allocator >&>::Parameter {aka std_msgs::Int32MultiArray_<std::allocator >&}’ from expression of type ‘const std_msgs::Int32MultiArray_<std::allocator >’
return *event.getMessage();
^

问题原因:

订阅的消息没有加const限定符

解决办法:

在回调函数中加上const限定符

猜你喜欢

转载自blog.csdn.net/qit1314/article/details/83034062
ROS
今日推荐