|
| 1 | +<?xml version="1.0"?> |
| 2 | +<!-- Usage: ign launch path/to/example.ign robotName:=<X1> |
| 3 | +
|
| 4 | + Parameters: |
| 5 | + robotName: Name to be assigned to model |
| 6 | +--> |
| 7 | + |
| 8 | +<% |
| 9 | + require_relative 'spawner' |
| 10 | +
|
| 11 | + # Modify these as needed |
| 12 | + $enableGroundTruth = true |
| 13 | + $headless = local_variables.include?(:headless) ? :headless : false |
| 14 | +
|
| 15 | +%> |
| 16 | + |
| 17 | +<% |
| 18 | +
|
| 19 | + unless local_variables.include?(:robotName) |
| 20 | + raise "missing parameters. robotName is a required parameter" |
| 21 | + end |
| 22 | +
|
| 23 | + # This assumes that this launch file is in a directory below the model |
| 24 | + modelURI = File.expand_path("../", File.dirname(__FILE__)) |
| 25 | + $worldName = 'example' |
| 26 | + worldFile = File.join(File.expand_path("../worlds", File.dirname(__FILE__)), "#{$worldName}.sdf") |
| 27 | +
|
| 28 | +%> |
| 29 | + |
| 30 | +<ignition version='1.0'> |
| 31 | + <env> |
| 32 | + <name>IGN_GAZEBO_SYSTEM_PLUGIN_PATH</name> |
| 33 | + <value>$LD_LIBRARY_PATH</value> |
| 34 | + </env> |
| 35 | + |
| 36 | + <!-- Start ROS first. This is a bit hacky for now. --> |
| 37 | + <!-- Make sure to source /opt/ros/melodic/setup.bash --> |
| 38 | + <executable name='ros'> |
| 39 | + <command>roslaunch subt_ros competition_init.launch world_name:=<%=$worldName%> vehicle_topics:=0 enable_ground_truth:=<%=($enableGroundTruth)?"1":"0"%> robot_names:=<%=robotName%></command> |
| 40 | + </executable> |
| 41 | + |
| 42 | + <plugin name="ignition::launch::GazeboServer" |
| 43 | + filename="libignition-launch-gazebo.so"> |
| 44 | + <world_file><%= worldFile %></world_file> |
| 45 | + <run>true</run> |
| 46 | + <levels>false</levels> |
| 47 | + <record> |
| 48 | + <enabled>false</enabled> |
| 49 | + </record> |
| 50 | + |
| 51 | + <plugin entity_name="<%= $worldName %>" |
| 52 | + entity_type="world" |
| 53 | + filename="libignition-gazebo-physics-system.so" |
| 54 | + name="ignition::gazebo::systems::Physics"> |
| 55 | + </plugin> |
| 56 | + |
| 57 | + <plugin entity_name="<%= $worldName %>" |
| 58 | + entity_type="world" |
| 59 | + filename="libignition-gazebo-sensors-system.so" |
| 60 | + name="ignition::gazebo::systems::Sensors"> |
| 61 | + <render_engine>ogre2</render_engine> |
| 62 | + </plugin> |
| 63 | + <plugin entity_name="<%= $worldName %>" |
| 64 | + entity_type="world" |
| 65 | + filename="libignition-gazebo-user-commands-system.so" |
| 66 | + name="ignition::gazebo::systems::UserCommands"> |
| 67 | + </plugin> |
| 68 | + <plugin entity_name="<%= $worldName %>" |
| 69 | + entity_type="world" |
| 70 | + filename="libignition-gazebo-scene-broadcaster-system.so" |
| 71 | + name="ignition::gazebo::systems::SceneBroadcaster"> |
| 72 | + </plugin> |
| 73 | + <plugin entity_name="<%= $worldName %>" |
| 74 | + entity_type="world" |
| 75 | + filename="libignition-gazebo-imu-system.so" |
| 76 | + name="ignition::gazebo::systems::Imu"> |
| 77 | + </plugin> |
| 78 | + |
| 79 | + <plugin entity_name="<%= $worldName %>" |
| 80 | + entity_type="world" |
| 81 | + filename="libignition-gazebo-magnetometer-system.so" |
| 82 | + name="ignition::gazebo::systems::Magnetometer"> |
| 83 | + </plugin> |
| 84 | + |
| 85 | + <plugin entity_name="<%= $worldName %>" |
| 86 | + entity_type="world" |
| 87 | + filename="libignition-gazebo-air-pressure-system.so" |
| 88 | + name="ignition::gazebo::systems::AirPressure"> |
| 89 | + </plugin> |
| 90 | + </plugin> |
| 91 | + |
| 92 | + <%if !$headless %> |
| 93 | + <executable_wrapper> |
| 94 | + <plugin name="ignition::launch::GazeboGui" |
| 95 | + filename="libignition-launch-gazebogui.so"> |
| 96 | + <world_name><%= $worldName %></world_name> |
| 97 | + <window_title>SubT Simulator</window_title> |
| 98 | + <window_icon><%= ENV['SUBT_IMAGES_PATH'] %>/SubT_logo.svg</window_icon> |
| 99 | + <plugin filename="GzScene3D" name="3D View"> |
| 100 | + <ignition-gui> |
| 101 | + <title>3D View</title> |
| 102 | + <property type="bool" key="showTitleBar">false</property> |
| 103 | + <property type="string" key="state">docked</property> |
| 104 | + </ignition-gui> |
| 105 | + |
| 106 | + <engine>ogre2</engine> |
| 107 | + <scene>scene</scene> |
| 108 | + <ambient_light>0.2 0.2 0.1</ambient_light> |
| 109 | + <background_color>0.8 0.8 0.8</background_color> |
| 110 | + <camera_pose>-6.3 -4.2 3.6 0 0.268 0.304</camera_pose> |
| 111 | + <service>/world/<%= $worldName %>/scene/info</service> |
| 112 | + <pose_topic>/world/<%= $worldName %>/pose/info</pose_topic> |
| 113 | + <scene_topic>/world/<%= $worldName %>/scene/info</scene_topic> |
| 114 | + <deletion_topic>/world/<%= $worldName %>/scene/deletion</deletion_topic> |
| 115 | + </plugin> |
| 116 | + <plugin filename="WorldControl" name="World control"> |
| 117 | + <ignition-gui> |
| 118 | + <title>World control</title> |
| 119 | + <property type="bool" key="showTitleBar">false</property> |
| 120 | + <property type="bool" key="resizable">false</property> |
| 121 | + <property type="double" key="height">72</property> |
| 122 | + <property type="double" key="width">121</property> |
| 123 | + <property type="double" key="z">1</property> |
| 124 | + |
| 125 | + <property type="string" key="state">floating</property> |
| 126 | + <anchors target="3D View"> |
| 127 | + <line own="left" target="left"/> |
| 128 | + <line own="bottom" target="bottom"/> |
| 129 | + </anchors> |
| 130 | + </ignition-gui> |
| 131 | + |
| 132 | + <play_pause>true</play_pause> |
| 133 | + <step>true</step> |
| 134 | + <start_paused>true</start_paused> |
| 135 | + <service>/world/<%= $worldName %>/control</service> |
| 136 | + <stats_topic>/world/<%= $worldName %>/stats</stats_topic> |
| 137 | + |
| 138 | + </plugin> |
| 139 | + |
| 140 | + <plugin filename="WorldStats" name="World stats"> |
| 141 | + <ignition-gui> |
| 142 | + <title>World stats</title> |
| 143 | + <property type="bool" key="showTitleBar">false</property> |
| 144 | + <property type="bool" key="resizable">false</property> |
| 145 | + <property type="double" key="height">110</property> |
| 146 | + <property type="double" key="width">290</property> |
| 147 | + <property type="double" key="z">1</property> |
| 148 | + |
| 149 | + <property type="string" key="state">floating</property> |
| 150 | + <anchors target="3D View"> |
| 151 | + <line own="right" target="right"/> |
| 152 | + <line own="bottom" target="bottom"/> |
| 153 | + </anchors> |
| 154 | + </ignition-gui> |
| 155 | + |
| 156 | + <sim_time>true</sim_time> |
| 157 | + <real_time>true</real_time> |
| 158 | + <real_time_factor>true</real_time_factor> |
| 159 | + <iterations>true</iterations> |
| 160 | + <topic>/world/<%= $worldName %>/stats</topic> |
| 161 | + </plugin> |
| 162 | + </plugin> |
| 163 | + </executable_wrapper> |
| 164 | + <%end%> |
| 165 | + |
| 166 | +<%= spawner(robotName, modelURI, $worldName, 0, 0, 0, 0, 0, 0) %> |
| 167 | +<%= rosExecutables(robotName, $worldName) %> |
| 168 | + |
| 169 | +</ignition> |
0 commit comments