/dynamic_world_service plugin

Hey ROS-Team,

In the catkin_ws the given domain randomization works fine just by calling the “/dynamic_world_service” Service with an Empty Request. Couldnt be easier!

But how do i even set up/install the plugin to a new Workspace??

and how do i change the configuration of the randomization? (What to randomize and how)

An Example of this would make the things ive learned during this course way more useful.

Greetings and thank you

Hi,

So basically you have to download this GIT Dynamic World.
Then compile it in a catkin_ws as any other rospackage.

And then you have to include the generated plugin in any world that you want to randomize the position and colours and lighting . For example:

Example World 2 Objects

In this world we have two objects we want to move around: demo_spam1 and suzzane:

<include>
  <uri>model://demo_spam</uri>
  <name>demo_spam1</name>
  <pose>-0.2 0.2 0.7 0 0 0</pose>
</include>

<include>
  <uri>model://suzanne</uri>
  <name>suzanne1</name>
  <pose>-0.1 0.0 0.9 0 0 0</pose>
</include>

The rest f the objects in the scene have to be ignred and not moved or changed in any way.

So his plgin will change position and colours of the objects that arent set to be ignored and register the position of the objectyou want to track. It will also change the lights positions and colours if set.

<plugin name="dynamic_world_plugin" filename="libdynamic_world_plugin.so">
  <update_frequency>1.0</update_frequency>
  <x_max>0.5</x_max>
  <x_min>0.3</x_min>
  <y_max>0.5</y_max>
  <y_min>0.1</y_min>
  <z_max>0.64</z_max>
  <z_min>0.64</z_min>
  
  
  <model_to_track_name>demo_spam1</model_to_track_name>
  
  <model_to_ignore_randcolours>fetch,rgb_cam</model_to_ignore_randcolours>
  <model_to_ignore_movement>fetch,rgb_cam,demo_table1,ground_plane,rubbish_bin1</model_to_ignore_movement>
  
  
  <x_max_distractors>0.5</x_max_distractors>
  <x_min_distractors>0.3</x_min_distractors>
  <y_max_distractors>0.5</y_max_distractors>
  <y_min_distractors>0.1</y_min_distractors>
  <z_max_distractors>0.64</z_max_distractors>
  <z_min_distractors>0.64</z_min_distractors>

  <z_increment_percentage>0.1</z_increment_percentage>

  
  <roll_max>0.0</roll_max>
  <roll_min>0.0</roll_min>
  <pitch_max>0.0</pitch_max>
  <pitch_min>0.0</pitch_min>
  <yaw_max>0.0</yaw_max>
  <yaw_min>0.0</yaw_min>

  <light_x_max>0.3</light_x_max>
  <light_x_min>0.3</light_x_min>
  <light_y_max>0.3</light_y_max>
  <light_y_min>0.3</light_y_min>
  <light_z_max>2.0</light_z_max>
  <light_z_min>2.0</light_z_min>

  <light_roll_max>0.0</light_roll_max>
  <light_roll_min>0.0</light_roll_min>
  <light_pitch_max>0.0</light_pitch_max>
  <light_pitch_min>0.0</light_pitch_min>
  <light_yaw_max>0.0</light_yaw_max>
  <light_yaw_min>0.0</light_yaw_min>


  <cam_x_max>-0.215121</cam_x_max>
  <cam_x_min>-0.215121</cam_x_min>
  <cam_y_max>0.3</cam_y_max>
  <cam_y_min>0.3</cam_y_min>
  <cam_z_max>1.092078</cam_z_max>
  <cam_z_min>1.092078</cam_z_min>

  <cam_roll_max>0.0</cam_roll_max>
  <cam_roll_min>0.0</cam_roll_min>
  <cam_pitch_max>0.6991</cam_pitch_max>
  <cam_pitch_min>0.6991</cam_pitch_min>
  <cam_yaw_max>0.0</cam_yaw_max>
  <cam_yaw_min>0.0</cam_yaw_min>
  
  <alpha>0.5</alpha>
  <beta>0.5</beta>
  <random_distribution_type>beta_distribution</random_distribution_type>
  
  <colour_randomiser_active>no</colour_randomiser_active>

</plugin>

As you can see here we can set the following:

  1. x_max, min, y_max… All these are the ranges of position change of the object to be tracked ( demos_spam1 in this case.
  2. x_max_distractors… These are for the other objects that arent in the ignore list
    3)z_increment_percentage is that we change the z of each objects to avoid that two objects appear inside one another
  3. All the ligh_xxx is for changing the lights obviously. Note that aloof these ranges if we put the same value in the max and min , that value will be constant.
  4. Same thing with the Camera.
  5. The alpha and beta are related to the distribution of the random values of the positions of the objects. Thsi si because we might want more data generated in the extreme positions close the max min ranges because the deep learning system needs more data there because its more difficult calculate there the distance for example.
  6. An finally the color randomiser, if yes, then the colours of the objects are changed.
  7. As for the lists for model_to_ignore, we can set who we don’t want to move and not change colour, we will set it in the appropriate lists.

And that’s quite it. Hope this helps to understand the plugin better and I would love to see this used in there environments and applications ;).

thanks for the fast reply!

So the dynamic_objects/worlds folder in the git repo is full of examples like the one you described, which are launched in different Units of this course.
Did i get this right??

Exactly, all theworlds launche din the units are there I think

1 Like

I stumbled upon this topic when I was searching for just the same as lwidowski. I was searching for the the plugin that created the dynamic_world_service in the deep learning with domain randomization course because I’m currently working on a project where the computervision and deep learning could be very usefull. I tried to clone the domain_randomization_dynamic_objects into my workspace but it seems like the gazebo has updated a whole lot in the meantime. I get a lot of errors from the “dynamic_world_plugin.cpp” script that looks like it is caused by the fact that gazebo has changed some of the function and variable names.

Is there an updated version of the domain_randomization_dynamic_objects package that works with the new gazebo 11?

Or how do I have to chose another route to work around the errors?

Thank you very much.