Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Ignition to Gazebo #450

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Once done with the editing of the building map with `traffic_editor`, user can n
ros2 run rmf_building_map_tools building_map_generator gazebo \
${building_map_path} ${output_world_path} ${output_model_dir}
```
_switch arg `gazebo` to `ignition` for generating a world file for ignition_
_switch arg `gazebo-classic` to `gazebo` for generating a world file for gazebo_

**Download models used in newly created traffic editor building map.**
```bash
Expand Down
2 changes: 1 addition & 1 deletion rmf_building_map_tools/building_crowdsim/_init_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
description="Generate navmesh.nav, behavior.xml, scene.xml" +
"required for running crowd simulation," +
"and generating the <plugin> tag in .world" +
"for gazebo and ignition-gazebo")
"for gazebo-classic and gazebo")

# parser
parser = argparse.ArgumentParser(add_help=False)
Expand Down
13 changes: 7 additions & 6 deletions rmf_building_map_tools/building_map/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,13 @@ def generate_nav_graphs(self):
def generate_sdf_world(self, options):
""" Return an etree of this Building in SDF starting from a template"""
print(f'generator options: {options}')
if 'gazebo' in options:
if 'gazebo-classic' in options:
template_name = 'gz_classic_world.sdf'
elif 'gazebo' in options:
template_name = 'gz_world.sdf'
elif 'ignition' in options:
template_name = 'ign_world.sdf'
else:
raise RuntimeError("expected either gazebo or ignition in options")
raise RuntimeError(
"expected either gazebo-classic or gazebo in options")

template_path = os.path.join(
get_package_share_directory('rmf_building_map_tools'),
Expand Down Expand Up @@ -469,7 +470,7 @@ def generate_sdf_world(self, options):
else:
camera_pose = f'{c[0]} {c[1]-20} 10 0 0.6 1.57'
# add floor-toggle GUI plugin parameters
if 'gazebo' in options:
if 'gazebo-classic' in options:
camera_pose_ele = gui_ele.find('camera').find('pose')
camera_pose_ele.text = camera_pose

Expand All @@ -484,7 +485,7 @@ def generate_sdf_world(self, options):
'plugin',
{'name': 'toggle_floors', 'filename': 'libtoggle_floors.so'})

elif 'ignition' in options:
elif 'gazebo' in options:
plugin_ele = gui_ele.find('.//plugin[@filename="GzScene3D"]')
camera_pose_ele = plugin_ele.find('camera_pose')
camera_pose_ele.text = camera_pose
Expand Down
8 changes: 4 additions & 4 deletions rmf_building_map_tools/building_map/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def generate_sdf(
f.write(sdf_str)
print(f'{len(sdf_str)} bytes written to {output_filename}')

def generate_gazebo_sdf(
def generate_gazebo_classic_sdf(
self,
input_filename,
output_filename,
Expand All @@ -60,9 +60,9 @@ def generate_gazebo_sdf(
input_filename,
output_filename,
output_models_dir,
options + ['gazebo'])
options + ['gazebo-classic'])

def generate_ignition_sdf(
def generate_gazebo_sdf(
self,
input_filename,
output_filename,
Expand All @@ -73,7 +73,7 @@ def generate_ignition_sdf(
input_filename,
output_filename,
output_models_dir,
options + ['ignition'])
options + ['gazebo'])

def generate_nav(self, input_filename, output_dir):
building = self.parse_editor_yaml(input_filename)
Expand Down
18 changes: 9 additions & 9 deletions rmf_building_map_tools/building_map/lift.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def to_yaml(self):
y['width'] = self.width
return y

def generate_cabin_door(self, lift_model_ele, name):
def generate_cabin_door_gazebo_classic(self, lift_model_ele, name):
door_model_ele = SubElement(lift_model_ele, 'model')
door_model_ele.set('name', name)
door_pose = SubElement(door_model_ele, 'pose')
Expand Down Expand Up @@ -148,10 +148,10 @@ def generate_door_plugin(self, model_ele, name):
door_ele.set('right_joint_name', 'right_joint')
door_ele.set('type', 'DoubleSlidingDoor')

# TODO: remove this function once nesting model is supported in ignition.
def generate_cabin_door_ign(self, lift_model_ele, name):
# This is for cabin door generation for ignition gazebo as it doesn't
# support nested models yet. Once ignition gazebo supports nested
# TODO: remove this function once nesting model is supported in Gazebo.
def generate_cabin_door_gazebo(self, lift_model_ele, name):
# This is for cabin door generation for Gazebo as it doesn't
# support nested models yet. Once Gazebo supports nested
# models, this should be removed.
(x, y) = self.cabin_door_pose
yaw = self.motion_axis_orientation
Expand Down Expand Up @@ -430,14 +430,14 @@ def generate_cabin(self, world_ele, options):

# cabin doors
# TODO: remove the if statement here once nesting model is supported
# in ignition.
if 'ignition' in options:
# in gazebo.
if 'gazebo' in options:
for lift_door in self.doors:
lift_door.generate_cabin_door_ign(
lift_door.generate_cabin_door_gazebo(
lift_model_ele, f'CabinDoor_{self.name}_{lift_door.name}')
else:
for lift_door in self.doors:
lift_door.generate_cabin_door(
lift_door.generate_cabin_door_gazebo_classic(
lift_model_ele, f'CabinDoor_{self.name}_{lift_door.name}')

# lift cabin plugin
Expand Down
21 changes: 21 additions & 0 deletions rmf_building_map_tools/building_map/templates/gz_classic_world.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" ?>
<sdf version="1.7">
<world name="world" xmlns:rmf="rmf">
<scene>
<ambient>0.8 0.8 0.8 1.0</ambient>
<background>0 0 0</background>
<grid>false</grid>
</scene>

<include>
<uri>model://sun</uri>
</include>

<gui>
<camera name="gui_camera">
<pose>10 -20 10 0 0.6 1.57</pose>
</camera>
</gui>

</world>
</sdf>
184 changes: 173 additions & 11 deletions rmf_building_map_tools/building_map/templates/gz_world.sdf
Original file line number Diff line number Diff line change
@@ -1,21 +1,183 @@
<?xml version="1.0" ?>
<sdf version="1.7">
<world name="world" xmlns:rmf="rmf">
<world name="sim_world" xmlns:rmf="rmf">
<physics name="10ms" type="ode">
<max_step_size>0.01</max_step_size>
<real_time_factor>1.0</real_time_factor>
</physics>
<plugin
filename="libgz-sim-physics-system.so"
name="gz::sim::systems::Physics">
</plugin>
<plugin
filename="libgz-sim-user-commands-system.so"
name="gz::sim::systems::UserCommands">
</plugin>
<plugin
filename="libgz-sim-scene-broadcaster-system.so"
name="gz::sim::systems::SceneBroadcaster">
</plugin>

<scene>
<ambient>0.8 0.8 0.8 1.0</ambient>
<background>0 0 0</background>
<ambient>1 1 1</ambient>
<background>0.8 0.8 0.8</background>
<grid>false</grid>
</scene>

<include>
<uri>model://sun</uri>
</include>
<gui fullscreen="0">

<window>
<width>1000</width>
<height>845</height>
<style
material_theme="Light"
material_primary="DeepOrange"
material_accent="LightBlue"
toolbar_color_light="#f3f3f3"
toolbar_text_color_light="#111111"
toolbar_color_dark="#414141"
toolbar_text_color_dark="#f3f3f3"
plugin_toolbar_color_light="#bbdefb"
plugin_toolbar_text_color_light="#111111"
plugin_toolbar_color_dark="#607d8b"
plugin_toolbar_text_color_dark="#eeeeee"
/>
<menus>
<drawer default="false">
</drawer>
</menus>
</window>

<!-- GUI plugins -->

<!-- 3D scene -->
<plugin filename="GzScene3D" name="3D View">
<gz-gui>
<title>3D View</title>
<property type="bool" key="showTitleBar">false</property>
<property type="string" key="state">docked</property>
</gz-gui>

<engine>ogre2</engine>
<scene>scene</scene>
<ambient_light>0.4 0.4 0.4</ambient_light>
<background_color>0.8 0.8 0.8</background_color>
<camera_pose>6 0 6 0 0.5 3.14</camera_pose>
</plugin>

<!-- Play / pause / step -->
<plugin filename="WorldControl" name="World control">
<gz-gui>
<title>World control</title>
<property type="bool" key="showTitleBar">false</property>
<property type="bool" key="resizable">false</property>
<property type="double" key="height">72</property>
<property type="double" key="width">121</property>
<property type="double" key="z">1</property>

<property type="string" key="state">floating</property>
<anchors target="3D View">
<line own="left" target="left"/>
<line own="bottom" target="bottom"/>
</anchors>
</gz-gui>

<play_pause>true</play_pause>
<step>true</step>
<start_paused>true</start_paused>

</plugin>

<!-- Time / RTF -->
<plugin filename="WorldStats" name="World stats">
<gz-gui>
<title>World stats</title>
<property type="bool" key="showTitleBar">false</property>
<property type="bool" key="resizable">false</property>
<property type="double" key="height">110</property>
<property type="double" key="width">290</property>
<property type="double" key="z">1</property>

<property type="string" key="state">floating</property>
<anchors target="3D View">
<line own="right" target="right"/>
<line own="bottom" target="bottom"/>
</anchors>
</gz-gui>

<sim_time>true</sim_time>
<real_time>true</real_time>
<real_time_factor>true</real_time_factor>
<iterations>true</iterations>

</plugin>

<!-- Translate / rotate -->
<plugin filename="TransformControl" name="Transform control">
<gz-gui>
<title>Transform control</title>
<anchors target="3D View">
<line own="left" target="left"/>
<line own="top" target="top"/>
</anchors>
<property key="resizable" type="bool">false</property>
<property key="width" type="double">230</property>
<property key="height" type="double">50</property>
<property key="state" type="string">floating</property>
<property key="showTitleBar" type="bool">false</property>
<property key="cardBackground" type="string">#666666</property>
</gz-gui>
</plugin>

<!-- Insert simple shapes -->
<plugin filename="Shapes" name="Shapes">
<gz-gui>
<anchors target="Transform control">
<line own="left" target="right"/>
<line own="top" target="top"/>
</anchors>
<property key="resizable" type="bool">false</property>
<property key="width" type="double">200</property>
<property key="height" type="double">50</property>
<property key="state" type="string">floating</property>
<property key="showTitleBar" type="bool">false</property>
<property key="cardBackground" type="string">#666666</property>
</gz-gui>
</plugin>

<!-- Inspector -->
<plugin filename="ComponentInspector" name="Component inspector">
<gz-gui>
<property type="bool" key="showTitleBar">false</property>
<property type="string" key="state">docked</property>
</gz-gui>
</plugin>

<!-- Entity tree -->
<plugin filename="EntityTree" name="Entity tree">
<gz-gui>
<property type="bool" key="showTitleBar">false</property>
<property type="string" key="state">docked</property>
</gz-gui>
</plugin>

<!-- Toggle charging traffic editor plugin -->
<plugin filename="toggle_charging" name="toggle_charging"/>
</gui>

<gui>
<camera name="gui_camera">
<pose>10 -20 10 0 0.6 1.57</pose>
</camera>
</gui>
<light type="directional" name="sun">
<cast_shadows>true</cast_shadows>
<pose>0 0 10 0 0 0</pose>
<diffuse>1 1 1 1</diffuse>
<specular>0.2 0.2 0.2 1</specular>
<attenuation>
<range>1000</range>
<constant>0.09</constant>
<linear>0.001</linear>
<quadratic>0.001</quadratic>
</attenuation>
<direction>-0.5 0.1 -0.9</direction>
</light>

</world>
</sdf>
Loading