Gazebo plugins
Intro
- This is for Gazebo-classic.
- Users of Ubuntu 18.04+ could switch to Gazebo Garden for more advanced functionalities.
Gazebo plugins enables the simulation of models and sensors, such as drivers, cameras, lidars, etc. Aside from some common tags (ex: updateRate
, visualize
), different plugins have different custom parameters that could be configured.
Lists of available plugins could be found at the official Gazebo Tutorial.
Reference
General usage
In robot URDF, insert plugin
inside the gazebo
tag.
List of common plugins
Differential Drive
- plugin filename:
libgazebo_ros_diff_drive.so
- suitable for driving 2-wheel robots
- receive - motion command (geometry_msgs/Twist)
–> <commandTopic>
- topic name, default to 'cmd_vel'
–> could be controlled with teleop mode
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
- publish - transforms for wheel links & odometry, joint states of wheels
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Skid Steering Drive
- plugin filename:
libgazebo_ros_skid_steer_drive.so
- suitable for driving 4-wheel robots
- receive - motion command (geometry_msgs/Twist)
–> <topicName>
default to 'cmd_vel'
- publish - transforms & joint states of wheels
–> <broadcastTF>
- set true/false
Lidar
- plugin filename:
libgazebo_ros_lidar.so
Camera
- plugin filenmae:
libgazebo_ros_camera.so
- In order to transform from the ROS coordinate to the camera frame, it is recommended to define additional frame with a "_optical" suffix. (refer: REP 103)
- The joint between camera_link & camera_optical_link would be configured as
- example - camera.xacro
- In the gazebo section, the camera's parameters, including the fov, width, height, format, far/near clip distance (deciding the shape of the frustrum), noise, could be configured
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
The gazebo reference would still be the camera_link, whereas the plugin frameName tag would be the camera_optical_link.
Depth camera (Microsoft Kinect)
- plugin filename:
libgazebo_ros_openni_kinect.so
- similar to camera, except the sensor type would be "depth"
- publish
- camera/depth/image: depth image
- camera/image: RGB image
- camera/depth/points (sensor_msgs/PointCloud2): the pointcloud that contains the 3d information
- The color format need to be reconfigured in order to show correct color, or else the R & B would be messed up
- This can be done by configuring the
<format>
(within <image>
) from R8G8B8 to B8G8R8
Projector
- plugin filename:
libgazebo_ros_projector.so
- Project static image in world.
- The
<texture>
tag would be the name of the image file.
- The image should be put in folder
/usr/share/gazebo-7/media/materials/textures
. (see this thread). There also exist a couple of textures.
- Replace the
<sensor>
tag with <projector>
tag.
- The projection would be in +Z direction.
- Projector parameters include
- near_clip
- far_clip
- fov
(Other tags seem to have no effect by far…)
(<textureTopicName>
& <projectorTopicName>
not working as well…)