报错static ros::ParameterAdapter<M>::Parameter ros::ParameterAdapter<M>::getParameter(const Event&)

在ROS环境下,由于在定义话题订阅的回调函数时,参数未添加const关键字,导致了类型不匹配的错误。具体错误出现在尝试将ros::ParameterAdapter的实例绑定到非const对象上时,编译器报错丢弃了qualifiers。这个问题影响了源文件getscale_node.cpp的编译过程,引发了多个makefile目标构建失败。
摘要由CSDN通过智能技术生成

In file included from /opt/ros/melodic/include/ros/subscription_callback_helper.h:35:0,
                 from /opt/ros/melodic/include/ros/subscriber.h:33,
                 from /opt/ros/melodic/include/ros/node_handle.h:33,
                 from /opt/ros/melodic/include/ros/ros.h:45,
                 from /home/szx/uwb-vio-fusion-slam/src/uwb-vio-fusion-slam-master/getscale/src/getscale_node.cpp:1:
/opt/ros/melodic/include/ros/parameter_adapter.h: In instantiation of ‘static ros::ParameterAdapter<M>::Parameter ros::ParameterAdapter<M>::getParameter(const Event&) [with M = nlink_parser::LinktrackAnchorframe0_<std::allocator<void> >&; ros::ParameterAdapter<M>::Parameter = nlink_parser::LinktrackAnchorframe0_<std::allocator<void> >&; ros::ParameterAdapter<M>::Event = ros::MessageEvent<const nlink_parser::LinktrackAnchorframe0_<std::allocator<void> > >; typename boost::remove_reference<typename boost::remove_const<M>::type>::type = nlink_parser::LinktrackAnchorframe0_<std::allocator<void> >]’:
/opt/ros/melodic/include/ros/subscription_callback_helper.h:144:48:   required from ‘void ros::SubscriptionCallbackHelperT<P, Enabled>::call(ros::SubscriptionCallbackHelperCallParams&) [with P = nlink_parser::LinktrackAnchorframe0_<std::allocator<void> >&; Enabled = void]’
/home/szx/uwb-vio-fusion-slam/src/uwb-vio-fusion-slam-master/getscale/src/getscale_node.cpp:472:1:   required from here
/opt/ros/melodic/include/ros/parameter_adapter.h:78:30: error: binding reference of type ‘ros::ParameterAdapter<nlink_parser::LinktrackAnchorframe0_<std::allocator<void> >&>::Parameter {aka nlink_parser::LinktrackAnchorframe0_<std::allocator<void> >&}’ to ‘const nlink_parser::LinktrackAnchorframe0_<std::allocator<void> >’ discards qualifiers
     return *event.getMessage();
                              ^
uwb-vio-fusion-slam-master/getscale/CMakeFiles/getscale.dir/build.make:75: recipe for target 'uwb-vio-fusion-slam-master/getscale/CMakeFiles/getscale.dir/src/getscale_node.cpp.o' failed
make[2]: *** [uwb-vio-fusion-slam-master/getscale/CMakeFiles/getscale.dir/src/getscale_node.cpp.o] Error 1
CMakeFiles/Makefile2:2865: recipe for target 'uwb-vio-fusion-slam-master/getscale/CMakeFiles/getscale.dir/all' failed
make[1]: *** [uwb-vio-fusion-slam-master/getscale/CMakeFiles/getscale.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j16 -l16" failed

定义话题订阅subscribe函数中的回调函数时,参数没有加上const 关键字

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值