Skip to content

wltjr/gz_random_objects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GZ Random Objects

License Build Status Code Quality

Gazebo Random Objects is a plugin for Gazebo that will randomly place objects in mesh files on a 2D plane.

Download

Download and unpack or clone this repositories contents into your ros2 workspace; ex ~/ros2_ws/src/gz_random_objects.

Build

The plugin is built using the standard ROS 2 build process. Building is done using colcon which will invoke cmake and run the necessary commands. Run the following command in your ros2 workspace; ex ~/ros2_ws/.

colcon build --symlink-install --packages-select  gz_random_objects

Source install

Make sure to run the following command after install and login. Run the following command in your ros2 workspace; ex ~/ros2_ws/.

source install/setup.bash

You may want to have your development user environment do this on login via ~/.bashrc file; add the following to the end of that file.

source ~/ros2_ws/install/setup.bash

Plugin Usage

In order to use the plugin, it needs to be added to a SDF world, or model to be included in some SDF world, or part of a URDF.

<plugin filename="libgz_random_objects.so" name="gz::sim::systems::GzRandomObjects">
    <!-- Parent ID in SDF -->
    <parent>4</parent>
    <!--Number of Objects, same number as mesh files at this time -->
    <objects>7</objects>
    <!-- x/y min and max, difference becomes range, along with scale -->
    <x_min>-750</x_min>
    <x_max>750</x_max>
    <x_scale>0.5</x_scale>
    <y_min>-2250</y_min>
    <y_max>2250</y_max>
    <y_scale>0.5</y_scale>
    <!-- z scale only at this time -->
    <z_scale>0.5</z_scale>
    <!-- Mesh files to use, can use https:// or file:// -->
    <mesh>file://$(find gz_random_objects)/meshes/rocks/rock1.dae</mesh>
    <mesh>file://$(find gz_random_objects)/meshes/rocks/rock2.dae</mesh>
    <mesh>file://$(find gz_random_objects)/meshes/rocks/rock3.dae</mesh>
    <mesh>file://$(find gz_random_objects)/meshes/rocks/rock4.dae</mesh>
    <mesh>file://$(find gz_random_objects)/meshes/rocks/rock5.dae</mesh>
    <mesh>file://$(find gz_random_objects)/meshes/rocks/rock6.dae</mesh>
    <mesh>file://$(find gz_random_objects)/meshes/rocks/rock7.dae</mesh>
</plugin>

About

Gazebo plugin to add random objects to a 2D plane

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published