ROS錯誤:/opt/ros/indigo/include/ros/parameter_adapter.h
錯誤訊息為:
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限定符