Ubuntu18.04安装Gazebo并与ROS连接

  • Post author:
  • Post category:其他


Ubuntu18.04安装Gazebo并与ROS连接



Gazebo安装

注意:Ubuntu18.04需要下载Gazebo9这个版本,Gazebo的版本不要弄错

如果已经下载了其他版本的Gazebo,请先执行如下命令进行卸载

sudo apt-get remove gazebo-*


正式安装

STEP1 设置计算机以接受来自package.osrfoundation.org的软件

sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'

STEP2 设定键

wget https://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -

STEP3 安装Gazebo

sudo apt-get update
sudo apt-get install gazebo9
 # For developers that work on top of Gazebo, one extra package
sudo apt-get install libgazebo9-dev



Gazebo与ROS连接

STEP5 安装ROS-Gazebo接口

sudo apt install ros-melodic-gazebo-ros-pkgs  ros-melodic-gazebo-msgs  ros-melodic-gazebo-plugins  ros-melodic-gazebo-ros-control

STEP6 验证是否连接成功

roscore
rosrun gazebo_ros gazebo

STEP7 如果在上一步骤发现Gazebo打开后长时间停留在启动界面,且显示黑屏(没有网格),关掉Gazebo,并依次执行以下语句

 cd ~/.gazebo/
 mkdir -p models
 cd ~/.gazebo/models/
 wget http://file.ncnynl.com/ros/gazebo_models.txt
 wget -i gazebo_models.txt
 ls model.tar.g* | xargs -n1 tar xzvf
 killall gzserver
 killall gzclient

(注:STEP7步骤需要从网络下载,建议打开手机热点)

STEP8 重新验证是否连接成功

rosrun gazebo_ros gazebo
rostopic list

如果Gazebo打开界面如下图所示,且可以看到终端显示下面代码块中的内容,则说明Gazebo与ROS连接成功!

成功的界面

/gazebo/link_states
/gazebo/model_states
/gazebo/parameter_descriptions
/gazebo/parameter_updates
/gazebo/set_link_state
/gazebo/set_model_state


参考网页

[1] https://blog.csdn.net/JIEJINQUANIL/article/details/104055983

[2] https://blog.csdn.net/FLORIDA_tang/article/details/100120185

[3] https://blog.csdn.net/xp1994816/article/details/100711633

[4] https://www.cnblogs.com/tanshengjiang/p/12293024.html

[5] https://github.com/osrf/gazebo_tutorials/blob/master/install_ubuntu/tutorial_9-0.md



版权声明:本文为qq_43855855原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。