网址:
http://gazebosim.org/tutorials?tut=ros_installing&cat=connect_ros
1.下载ROS
2.下载gezebo
3.测试gazebo是否安装成功,以及路径
Before attempting to install the gazebo_ros_pkgs
, make sure the stand-alone Gazebo works by running in terminal:
gazebo
You should see the GUI open with an empty world. Also, test adding a model by clicking on the "Insert" tab on the left and selecting a model to add (then clicking on the simulation to select where to place the model).
To see where you install Gazebo, and if it is in the correct location, run:
which gzserver
which gzclient
4.安装 gazebo_ros_pkgs(两种方法)
A.
sudo apt-get install ros-indigo-gazebo-ros-pkgs ros-indigo-gazebo-ros-control
B.
从source中安装
1.确保建立了catkin_ws
如果没有,流程如下:
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
cd ~/catkin_ws
catkin_make
一定要记得添加文件夹相应的路径到 ~/.bashrc!!!!!!!(很重要)
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
2.在catkin_ws中克隆github 仓库
3.用rosdep检查是否缺少依赖,如果缺少并补丁
5.在利用相关路径下的包工作时一定要确定source过了相关路径到 ~/.bashrc
Be sure to always source the appropriate ROS setup file, which for Kinetic is done like so:
source /opt/ros/kinetic/setup.bash
You might want to add that line to your ~/.bashrc
.
Assuming your ROS and Gazebo environment have been properly setup and built, you should now be able to run Gazebo through a simple rosrun
command, after launching roscore
if needed:
Source the catkin setup.bash if it's not already in your .bashrc
source ~/catkin_ws/devel/setup.bash
roscore &
rosrun gazebo_ros gazebo
可以直接添加到~/.bshrc文件中,避免每次都要source