ROS2에서 GAZEBO
22 Mar 2021 | ROS2
Overview
Gazebo is a stand-alone application which can be used independently of ROS or ROS 2. The integration of Gazebo with either ROS version is done through a set of packages called gazebo_ros_pkgs. These packages provide a bridge between Gazebo’s C++ API and transport system, and ROS 2 messages and services.
Not all functionality from ROS 1 has been ported to ROS 2 yet. You can check the progress on this issue.
If you're interested in porting official or your own custom plugins, check out the ROS2 migration contribution guide.
The ROS 2 package gazebo_ros_pkgs is a metapackage which contains the following packages:
- gazebo_dev: Provides a cmake configuration for the default version of Gazebo for the ROS distribution. So downstream packages can just depend on gazebo_dev instead of needing to find Gazebo by themselves.
- gazebo_msgs: Message and service data structures for interacting with Gazebo from ROS 2.
- gazebo_ros: Provides convenient C++ classes and functions which can be used by other plugins, such as gazebo_ros::Node, conversion and testing utilities. It also provides some generally useful plugins.
- gazebo_plugins: A series of Gazebo plugins exposing sensors and other features to ROS 2. For example, gazebo_ros_camera publishes ROS 2 images, and gazebo_ros_diff_drive provides an interface for controlling and instrospecting differential drive robots through ROS 2.
Differences from ROS 1
Several changes and refactoring were done to gazebo_ros_pkgs when migrating from ROS 1 to ROS 2.
Some goals of the refactoring were:
- take advantage of new ROS 2 features, such as masterless discovery.
- Remove code which duplicates functionality already present in Gazebo.
- Reduce duplication by standardizing common functionality, such as how to set ROS namespaces, parameters and topic remapping.
- Modernize the codebase, making use of the latest SDFormat, Gazebo and Ignition APIs, as well as ROS 2’s style guidelines and linters
- Add tests and demos for all ported functionality.
INT
The ROS 1 integration required that Gazebo be launched with the gazebo_ros_api_plugin system plugin, which would initialize ROS.
There’s no such requirement with ROS 2. Gazebo can be started without any plugins and ROS-2-enabled plugins can be added at runtime.
Node
in ROS 1, each plugin typically had one or more ros::NodeHandle instances to interact with ROS.
In ROS 2, plugins use gazebo_ros::Node instead, which allows each plugin to exist as its own node in the ROS graph, with its own parameters, namespace, loggers, etc. Plugins also don’t need to worry about spinning the node or keeping callback queues - gazebo_ros handles all that internally.
SDF parsing
There are several configurations which Gazebo ROS plugins commonly want to set through SDF, and in the ROS 1 implementation, there was a lot of duplicate code on plugins parsing the same things, sometimes following loose conventions.
In ROS 2, common configurations like namespace, ROS parameters and topic remapping rules are parsed by gazebo_ros::Node, so there’s no need for plugins to reimplement them every time.
사용방법
ROS1과 같다. terminal에서 바로 런치할 수 있고, 런치파일을 통해 GAZEBO_PACKAGE를 노드로 삼아 environment spawn하고 robot을 spawn을 하여서 사용할 수 있다. 다만 ros2의 launch 방식이 파이썬으로 바껴서 이것을 배워야한다.
Summarry
즉, 주로 중복된 코드와 파라미터 변수들을 줄였고, SDF에 있는 중복된 파라미터 및 변수를 줄였다. 즉 중복되는 변수와 파라미터들을 줄여 시스템 collision을 줄였다.
Overview
Gazebo is a stand-alone application which can be used independently of ROS or ROS 2. The integration of Gazebo with either ROS version is done through a set of packages called gazebo_ros_pkgs. These packages provide a bridge between Gazebo’s C++ API and transport system, and ROS 2 messages and services.
Not all functionality from ROS 1 has been ported to ROS 2 yet. You can check the progress on this issue.
If you're interested in porting official or your own custom plugins, check out the ROS2 migration contribution guide.
The ROS 2 package gazebo_ros_pkgs is a metapackage which contains the following packages:
- gazebo_dev: Provides a cmake configuration for the default version of Gazebo for the ROS distribution. So downstream packages can just depend on gazebo_dev instead of needing to find Gazebo by themselves.
- gazebo_msgs: Message and service data structures for interacting with Gazebo from ROS 2.
- gazebo_ros: Provides convenient C++ classes and functions which can be used by other plugins, such as gazebo_ros::Node, conversion and testing utilities. It also provides some generally useful plugins.
- gazebo_plugins: A series of Gazebo plugins exposing sensors and other features to ROS 2. For example, gazebo_ros_camera publishes ROS 2 images, and gazebo_ros_diff_drive provides an interface for controlling and instrospecting differential drive robots through ROS 2.
Differences from ROS 1
Several changes and refactoring were done to gazebo_ros_pkgs when migrating from ROS 1 to ROS 2.
Some goals of the refactoring were:
- take advantage of new ROS 2 features, such as masterless discovery.
- Remove code which duplicates functionality already present in Gazebo.
- Reduce duplication by standardizing common functionality, such as how to set ROS namespaces, parameters and topic remapping.
- Modernize the codebase, making use of the latest SDFormat, Gazebo and Ignition APIs, as well as ROS 2’s style guidelines and linters
- Add tests and demos for all ported functionality.
INT
The ROS 1 integration required that Gazebo be launched with the gazebo_ros_api_plugin system plugin, which would initialize ROS.
There’s no such requirement with ROS 2. Gazebo can be started without any plugins and ROS-2-enabled plugins can be added at runtime.
Node
in ROS 1, each plugin typically had one or more ros::NodeHandle instances to interact with ROS.
In ROS 2, plugins use gazebo_ros::Node instead, which allows each plugin to exist as its own node in the ROS graph, with its own parameters, namespace, loggers, etc. Plugins also don’t need to worry about spinning the node or keeping callback queues - gazebo_ros handles all that internally.
SDF parsing
There are several configurations which Gazebo ROS plugins commonly want to set through SDF, and in the ROS 1 implementation, there was a lot of duplicate code on plugins parsing the same things, sometimes following loose conventions.
In ROS 2, common configurations like namespace, ROS parameters and topic remapping rules are parsed by gazebo_ros::Node, so there’s no need for plugins to reimplement them every time.
사용방법
ROS1과 같다. terminal에서 바로 런치할 수 있고, 런치파일을 통해 GAZEBO_PACKAGE를 노드로 삼아 environment spawn하고 robot을 spawn을 하여서 사용할 수 있다. 다만 ros2의 launch 방식이 파이썬으로 바껴서 이것을 배워야한다.
Summarry
즉, 주로 중복된 코드와 파라미터 변수들을 줄였고, SDF에 있는 중복된 파라미터 및 변수를 줄였다. 즉 중복되는 변수와 파라미터들을 줄여 시스템 collision을 줄였다.
Comments