Skip to content

A simple example demonstrating the use of ros_ign_bridge to enable the exchange of messages between ignition gazebo and ros 2. A camera sensor is included in a world containing a box and its output is shown using rviz.

License

Notifications You must be signed in to change notification settings

arashsm79/ros-ign-gazebo-camera

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ros 2 <-> ign gazebo camera sensor example

A simple example demonstrating the use of ros_ign_bridge to enable the exchange of messages between ignition gazebo and ros 2. A camera sensor is included in a world containing a box and its output is shown using rviz.

Ignition Gazebo has since been renamed back to Gazebo. To see a more complex example of a mobile robot simulated with the new Gazebo and ROS2, you may check out the eddiebot-ros repository.

Components:

setup

In setup.py we have to make sure that our world and models are copied properly to the install location. We do this by specifying them in the data_files array.

    data_files=[
        ...,
        (os.path.join('share', package_name), glob('launch/*.launch.py')),
        (os.path.join('share', package_name, "worlds"), glob('worlds/*.sdf')),
        (os.path.join('share', package_name, "models", "arashcamera"), glob('models/arashcamera/*')),
    ],

Launch File

First using the IGN_GAZEBO_RESOURCE_PATH environment variable we have to specify the path to our models' directory in the install location so that ign gazebo would be able to find our sensor.

Then we create 3 components:

  • A process to launch gazebo
  • A ros node to spin up rviz 2
  • The ros_ign_bridge to connect ign topics to that of ros 2

World and Models

In the worlds directory, there is a simple sdf file that contains a box, a plane, and a sun. We have also included our camera sensor in this file using the <include> tag.

In the models directory lives our camera sensor which is a simple sdf file containing the sensor and its description.

Building and Running

Copy the camera-sensor-example directory in your ros 2 workspace and run:

colcon build

Finally launch the package:

ros2 launch camera-sensor-example arashs_wonderland.launch.py

Screenshots

gazebo

rviz2


See Also

About

A simple example demonstrating the use of ros_ign_bridge to enable the exchange of messages between ignition gazebo and ros 2. A camera sensor is included in a world containing a box and its output is shown using rviz.

Topics

Resources

License

Stars

Watchers

Forks

Languages