rotors编译报错
本博客参考https://blog.csdn.net/qq_41628231/article/details/86534591
在此致谢!
部分错误如下:
catkin_ws/src/rotors_simulator-master/rotors_hil_interface/include/rotors_hil_interface/hil_interface.h:105:3: error: ‘mavlink_hil_gps_t’ does not name a type
mavlink_hil_gps_t hil_gps_msg_;
^
catkin_ws/src/rotors_simulator-master/rotors_hil_interface/include/rotors_hil_interface/hil_interface.h:108:3: error: ‘mavlink_hil_sensor_t’ does not name a type
mavlink_hil_sensor_t hil_sensor_msg_;
^
catkin_ws/src/rotors_simulator-master/rotors_hil_interface/include/rotors_hil_interface/hil_interface.h:130:3: error: ‘mavlink_hil_state_quaternion_t’ does not name a type
mavlink_hil_state_quaternion_t hil_state_qtrn_msg_;
^
catkin_ws/src/rotors_simulator-master/rotors_hil_interface/src/hil_sensor_level_interface.cpp: In member function ‘virtual std::vector<mavros_msgs::Mavlink_<std::allocator > > rotors_hil::HilSensorLevelInterface::CollectData()’:
catkin_ws/src/rotors_simulator-master/rotors_hil_interface/src/hil_sensor_level_interface.cpp:89:3: error: ‘mavlink_message_t’ was not declared in this scope
mavlink_message_t mmsg;
解决方法
- 找到文件hil_interface.h ,我的目录为/catkin_ws/src/rotors_simulator-master/rotors_hil_interface/include/rotors_hil_interface(可酌情改变)
- 在该文件中加入以下代码
#ifndef MAVLINK_H
typedef mavlink::mavlink_message_t mavlink_message_t;
#include <mavlink/v2.0/common/mavlink.h>
#endif
- 保存,再次编译,编译通过!