环境配置:Ubuntu18.04 + Ros melodic + Gazebo9  ||  下载编译无误后进行以下操作

目录

1 开启Gazebo仿真

2 开启LIO-SAM算法

3 开启键盘控制节点

4 致谢


1 开启Gazebo仿真

roslaunch scout_gazebo scout_gazebo.launch

错误1:(版本问题)

Error [Converter.cc:151] Unable to convert from SDF version 1.7 to 1.6

解决方案:

将.world文件中第一行的<sdf version = '1.7'>改为<sdf version = '1.6'>即可

gazebo运行报错:Unable to convert from SDF version 1.7 to 1.6_AI Chen的博客-CSDN博客_unable to convert from sdf version 1.7 to 1.6

 错误2:(中文注释问题,模型不在Gazebo中显示)

[joint_state_publisher-2] process has died [pid 29537, exit code 1, cmd /opt/ros/melodic/lib/joint_state_publisher_gui/joint_state_publisher_gui __name:=joint_state_publisher __log:=/home/zhaopujun/.ros/log/d9ea941e-a3d7-11ed-9808-e0d045eabdf7/joint_state_publisher-2.log].
log file: /home/zhaopujun/.ros/log/d9ea941e-a3d7-11ed-9808-e0d045eabdf7/joint_state_publisher-2*.log
[model-6] process has died [pid 29553, exit code 1, cmd /opt/ros/melodic/lib/gazebo_ros/spawn_model -urdf -model scout -param robot_description __name:=model __log:=/home/zhaopujun/.ros/log/d9ea941e-a3d7-11ed-9808-e0d045eabdf7/model-6.log].
log file: /home/zhaopujun/.ros/log/d9ea941e-a3d7-11ed-9808-e0d045eabdf7/model-6*.log

解决方案:

删掉.urdf文件中所有的中文注释

[joint_state_publisher-2] process has died问题解决_我就叫这个名字的博客-CSDN博客

错误3:(不影响,暂时未解决)

[ WARN] [1675438522.663673922, 0.346000000]: GazeboRosSkidSteerDrive Plugin (ns = //) missing <commandTopic>, defaults to "cmd_vel"
[ WARN] [1675438522.663706715, 0.346000000]: GazeboRosSkidSteerDrive Plugin (ns = //) missing <odometryTopic>, defaults to "odom"
[ WARN] [1675438522.663715677, 0.346000000]: GazeboRosSkidSteerDrive Plugin (ns = //) missing <odometryFrame>, defaults to "odom"
[ WARN] [1675438522.663728973, 0.346000000]: GazeboRosSkidSteerDrive Plugin (ns = //) missing <covariance_x>, defaults to 0.000100
[ WARN] [1675438522.663737480, 0.346000000]: GazeboRosSkidSteerDrive Plugin (ns = //) missing <covariance_y>, defaults to 0.000100
[ WARN] [1675438522.663745393, 0.346000000]: GazeboRosSkidSteerDrive Plugin (ns = //) missing <covariance_yaw>, defaults to 0.010000

解决方案:

暂无

无误后显示:

2 开启LIO-SAM算法

roslaunch lio_sam run.launch

 错误1:(在Gazebo终端下显示)

[gazebo-4] process has died [pid 30226, exit code 139, cmd /opt/ros/melodic/lib/gazebo_ros/gzserver -e ode /home/zhaopujun/catkin_ws_Gazebo_LIO-SAM/src/robot_gazebo-main/scout_gazebo/worlds/lab.world __name:=gazebo __log:=/home/zhaopujun/.ros/log/5d56ab76-a3d8-11ed-9808-e0d045eabdf7/gazebo-4.log].
log file: /home/zhaopujun/.ros/log/5d56ab76-a3d8-11ed-9808-e0d045eabdf7/gazebo-4*.log

解决方案:

a.把LIO-SAM功能包放到src目录下(相当于从子目录剪切到了父目录下,后来觉得这步可能有点多余)

b.升级Gazebo版本(我的系统是ubuntu18.04,所以我的gazebo 9.0.0更新到9.19.0版本)

#使用下列代码可将gazebo升级为该版本的最新版,适用于gazebo7与gazebo9
#添加源
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/gazebo-stable.list'
#添加密钥
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D2486D2DD83DB69272AFE98867170598AF249743
#更新与升级
sudo apt update
sudo apt upgrade
#查看版本
gazebo -v

教程 | ROS中Gazebo版本升级更新以及环境太暗解决方案_天之博特TIANBOT的博客-CSDN博客_gazebo升级

 c.重新编译一下,并且source(不然系统总是默认去roslaunch别的工作空间下的LIO-SAM包)

无误后显示: 

3 开启键盘控制节点

rosrun teleop_twist_keyboard teleop_twist_keyboard.py 

通过键盘控制小车

无误后显示: 

  错误1:(在LIO-SAM终端下显示)

[ WARN] [1675442922.853591025, 138.358000000]: Large velocity, reset IMU-preintegration!
[ WARN] [1675442922.853591025, 138.358000000]: Large velocity, reset IMU-preintegration!

解决方案:

(LIO-SAM用于室内建图时会发生漂移这很正常,笔者用实验室小车做实验时也发现这种情况)

可以适当降低LIO-SAM配置文件下的体素网格大小

或者重新建立一个室外场景world

4 致谢:

感谢linzs.online的博客_CSDN博客-SLAM,环境配置,Linux 入门笔记领域博主大佬资源分享的资源和知识

gazebo中给机器人添加16线激光雷达跑LIO-SAM_linzs.online的博客-CSDN博客_gazebo 激光雷达

GitHub – linzs-online/robot_gazebo: A scout2 robot carrying RS16 lidar/IMU/D435 sensors,running LIO-SAM in a room!


版权声明:本文为weixin_68647501原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/weixin_68647501/article/details/128877397