1.ImportError: dynamic module does not define module export function (PyInit__tf2)
ImportError: dynamic module does not define module export function (PyInit__tf2),报这个错的原因是因为不适配python3,需要安装一些需求后用python3编译。
sudo apt update
sudo apt install python3-catkin-pkg-modules python3-rospkg-modules python3-empy
cd /catkin_ws/src
wstool init
wstool set -y src/geometry2 --git https://github.com/ros/geometry2 -v 0.6.5
wstool up
rosdep install --from-paths src --ignore-src -y -r
用python3编译
catkin_make --cmake-args \
-DCMAKE_BUILD_TYPE=Release \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
-DPYTHON_INCLUDE_DIR=/usr/include/python3.6m \
-DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so
source之后才能应用刚才的设置
source ./devel/setup.bash
2.undefined reference to `GeographicLib::UTMUPS::Forward’
使用Geographiclib后编译报错undefined reference to `GeographicLib::UTMUPS::Forward’,需要修改CMakeList,参考robot_localization包之后,在CMakeList添加如下:
# Geographiclib installs FindGeographicLib.cmake to this non-standard location
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/usr/share/cmake/geographiclib/")
find_package(GeographicLib REQUIRED)
add_executable(get_goal_pts src/get_goal_pts.cpp)
target_link_libraries(get_goal_pts ${catkin_LIBRARIES} ${GeographicLib_LIBRARIES})
3.Exception thrown when deserializing message of length [75] from [/get_goal_pts]: Buffer Overrun
消息订阅的话题的消息类型与发布这一话题的消息类型不一致,导致消息的解码失败,需要检查发布和订阅的消息类型是否一致。比如这一次发布了一个名叫/utm_xy的话题类型是nav_msgs::odometry,订阅了这个话题但是消息类型确是geometry_msgs::posestamped.
4.[FATAL] [1634612888.704684537]: You must call ros::init() before creating the first NodeHandle
主函数中已经存在
ros::init(argc, argv, "simple_p2p");
依然报这个错误。
可能存在全局变量或者初始化的语句顺序不对。