报错:
error: invalid initialization of reference of type ‘const boost::shared_ptr<const
sensor_driver_msgs::GpswithHeading_<std::allocator<void> > >&’ from expression of type
‘const boost::shared_ptr<const sensor_msgs::NavSatFix_<std::allocator<void> > >’
报错原因:
使用const sensor_msgs::NavSatFix类型来初始化sensor_driver_msgs::GpswithHeading类型数据,这是改代码时马虎造成的。
教训:
(1)有些看起来像c++、python等语言语法报错的,可能只是自己代码写/改错了,不要急着去找语法错误,先硬着头皮看报错
(2)在ros中使用message_filters进行多个话题同步时,需要注意以下三个位置数据类型一致(这次报错就是下面图片中第四行的数据类型没有改为新的)