当前位置:   article > 正文

编译robot_gazebo和locailzation遇到的问题与解决方法_make[2]: *** [ar_challenge_gazebo/cmakefiles/irisc

make[2]: *** [ar_challenge_gazebo/cmakefiles/iriscontrol.dir/src/iris_contro

robot_gazebo文件夹内容:

launch文件中需要urdf/base.xacro:
在这里插入图片描述
下载github上的源代码

git clone https://github.com/linzs-online/robot_gazebo.git
  • 1

将github里的scout_gazebo和realsense_ros_gazebo文件夹复制到乐学里的robot_gazebo文件夹里(scout_gazebo文件覆盖掉原来的)


编译robot_gazebo提示缺少配置文件

例如:

CMake Error at
/opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83
(find_package): Could not find a package configuration file provided
by “serial” with any of the following names:
serialConfig.cmake
serial-config.cmake Add the installation prefix of “serial” to CMAKE_PREFIX_PATH or set “serial_DIR” to a directory containing
one of the above files. If “serial” provides a separate development
package or SDK, be sure it has been installed.

这个时候就去安装相应的ros包,例如上述问题就安装serial的包:

sudo apt install ros-noetic-serial
  • 1

安装gtsam:

按照老师文档里发的方法配置就行。


运行launch文件时加载xacro失败:

when processing file:
/home/lin/pointcloud/src/robot_gazebo/scout_gazebo/urdf/base.xacro
RLException: Invalid tag: Cannot load command parameter
[robot_description]: command [[‘/opt/ros/noetic/lib/xacro/xacro’,
‘/home/lin/pointcloud/src/robot_gazebo/scout_gazebo/urdf/base.xacro’]]
returned with code [2].

1、可能是没有安装xacro:

sudo apt-get install ros-noetic-xacro
  • 1

2、也可能是没有安装依赖项:

sudo apt-get install ros-noetic-velodyne-simulator
  • 1

3、也可能是之前的模型文件没有正确放到文件夹里,检测一下scout_gazebo和realsense_ros_gazebo文件夹是否是github版本里的。


locailzation配置方法:

1、安装glog:

sudo apt-get install libgflags-dev
sudo apt install libgoogle-glog-dev
  • 1
  • 2

2、安装g2o:
locailzation文件夹里自带一个g2o安装包,路径:/locailzation/setup_file/g2o.zip
解压到主文件夹后删除掉里面的build文件夹,然后定位到g2o文件夹并安装:

cd g2o
mkdir build
cd build
cmake ..
sudo make install -j8
  • 1
  • 2
  • 3
  • 4
  • 5

如果usr/local/include里有g2o文件夹说明安装成功了

如果出现无法正确连接g2o库的情况就删除掉已安装的g2o库并重新安装:

sudo rm -rf /usr/local/include/g2o /usr/local/lib/cmake/g2o /usr/local/lib/libg2o*
  • 1

然后在.bashrc文件中加上:

export CPLUS_INCLUDE_PATH=:/usr/local/include/g2o
export LIBRARY_PATH=:/usr/local/lib
  • 1
  • 2

locailzation编译时间过长

如果编译时出现很多的Warning,例如:

warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits::type’ {aka ‘__vector(2)
double’} [-Wignored-attributes]

建议在lidar_locailzation/CMakeList.txt文件夹中加上,可以屏蔽掉warning,方便我们查看error报错:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
  • 1

如果出现:

c++: fatal error: 已杀死 signal terminated program cc1plus compilation
terminated. make[2]: ***
[lidar_localization/CMakeFiles/viewer_node.dir/build.make:76:lidar_localization/CMakeFiles/viewer_node.dir/src/apps/viewer_node.cpp.o]
错误 1 make[1]: ***
[CMakeFiles/Makefile2:3412:lidar_localization/CMakeFiles/viewer_node.dir/all]
错误 2

说明编译资源分配不够,根据自己的cpu性能,在catkin_make时,使用-j参数,例如:

catkin_make -j8
  • 1

-j8参数指定了并行编译的任务数量为8,这意味着会使用8个并行的编译任务来加速编译过程。

在ROS中,catkin_make命令用于构建工作空间中的软件包。通过使用-j参数,可以指定同时执行的编译任务数量,从而加速编译过程。通常情况下,选择的任务数量应该与系统CPU核心数量相匹配,或者稍微小于CPU核心数量。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/443970
推荐阅读
相关标签
  

闽ICP备14008679号