gazebo_ ros_pkgs 功能包实现了ROS和Gazebo集成。它提供了消息、服务、动态参数配置等功能接口,可以用来在Gazebo 中进行机器人的仿真。
- 支持独立的系统,本身并不是ROS系统组件
- 用catkin编译
- 识别URDF和SDF文件
- 减少代码的重复
- 用ros_control 提供对控制器的支持
- 有效地集成了实时控制器
概述
功能包的接口如下:
Launch
pkg=”gazebo_ros”
CMakeLists.txt
配置CMake文件
cmake_minimum_required(VERSION 2.8.3)
project(YOURROBOT_gazebo_plugins)
find_package(catkin REQUIRED COMPONENTS
gazebo_ros
)
# Depend on system install of Gazebo
find_package(gazebo REQUIRED)
include_directories(include ${catkin_INCLUDE_DIRS} ${GAZEBO_INCLUDE_DIRS} ${SDFormat_INCLUDE_DIRS})
# Build whatever you need here
add_library(...) # TODO
catkin_package(
DEPENDS
gazebo_ros
CATKIN_DEPENDS
INCLUDE_DIRS
LIBRARIES
)
package.xml
在包中添加依赖项:
<build_depend>gazebo_ros</build_depend>
<run_depend>gazebo_ros</run_depend>
Running Gazebo
rosrun gazebo_ros gazebo 打开服务器和GUI
rosrun gazebo_ros gzclient打开GUI
rosrun gazebo_ros gzserver 打开服务器
rosrun gazebo_ros debug 打开服务器
roslaunch gazebo_ros empty_world.launch
安装
完整安装时已经安装好(ros-kinetic-desktop-full, ros-jade-desktop-fullor ros-indigo-desktop-full)
- ROS Kinetic:
sudo apt-get install ros-kinetic-gazebo-ros-pkgs ros-kinetic-gazebo-ros-control
- ROS Jade:
sudo apt-get install ros-jade-gazebo-ros-pkgs
- ROS Indigo:
sudo apt-get install ros-indigo-gazebo-ros-pkgs ros-indigo-gazebo-ros-control
安装好后,可运行下列命令检测:
1、rosrun gazebo_ros gazebo
将显示空的界面
2、rostopic list
将显示下列主题:
3、rosservice list
将显示下列服务:
参考:
来源:CSDN
作者:飘零过客
链接:https://blog.csdn.net/xuehuafeiwu123/article/details/70884627