Skip to content

Commit 9e4d9ed

Browse files
committed
Basic RMF map, using sed, while still depending on rmf_demos and rmf_demos_gz
Signed-off-by: Aaron Chong <[email protected]>
1 parent 7c6ebf7 commit 9e4d9ed

File tree

7 files changed

+496
-1
lines changed

7 files changed

+496
-1
lines changed

nexus_integration_tests/CMakeLists.txt

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ add_custom_target(generate_zenoh_bridge_configs ALL
115115
COMMAND ros2 run nexus_network_configuration nexus_network_configuration -n ${nexus_network_cfg_path} -o ${zenoh_cfg_output_dir}
116116
)
117117

118-
install(DIRECTORY launch config rviz scripts DESTINATION share/${PROJECT_NAME})
118+
install(DIRECTORY launch config rviz scripts maps DESTINATION share/${PROJECT_NAME})
119119
# Install the zenoh config directory containing generated configs.
120120
message("zenoh_cfg_output_dir: " ${zenoh_cfg_output_dir})
121121
install(DIRECTORY ${zenoh_cfg_output_dir} DESTINATION share/${PROJECT_NAME}/config/)
@@ -177,3 +177,86 @@ if(BUILD_TESTING)
177177
endif()
178178

179179
ament_package()
180+
181+
# Modified from rmf_demos_maps
182+
# Get absolute path of the building map
183+
set(building_map "maps/depot/depot.building.yaml")
184+
get_filename_component(building_map_path ${building_map} REALPATH)
185+
186+
# Get the output world name
187+
string(REGEX REPLACE "\\.[^.]*\.[^.]*$" "" no_extension_path ${building_map_path})
188+
string(REGEX MATCH "[^\/]+$" world_name ${no_extension_path})
189+
190+
set(output_world_name ${world_name})
191+
set(output_dir ${CMAKE_CURRENT_BINARY_DIR}/maps/${output_world_name})
192+
set(output_world_path ${output_dir}/${output_world_name}.world)
193+
set(output_model_dir ${output_dir}/models)
194+
195+
##############################################################################
196+
# Generate Gz world and download Models
197+
##############################################################################
198+
199+
message("BUILDING WORLDFILE WITH COMMAND: ros2 run rmf_building_map_tools building_map_generator gazebo ${building_map_path} ${output_world_path} ${output_model_dir}")
200+
if (NO_DOWNLOAD_MODELS)
201+
add_custom_command(
202+
DEPENDS ${building_map_path}
203+
COMMAND ros2 run rmf_building_map_tools building_map_generator gazebo ${building_map_path} ${output_world_path} ${output_model_dir}
204+
OUTPUT ${output_world_path}
205+
)
206+
else()
207+
message("DOWNLOADING MODELS WITH COMMAND: ros2 run rmf_building_map_tools building_map_model_downloader ${building_map_path}")
208+
add_custom_command(
209+
DEPENDS ${building_map_path}
210+
COMMAND ros2 run rmf_building_map_tools building_map_generator gazebo ${building_map_path} ${output_world_path} ${output_model_dir}
211+
COMMAND ros2 run rmf_building_map_tools building_map_model_downloader ${building_map_path} -e ~/.gazebo/models
212+
OUTPUT ${output_world_path}
213+
)
214+
endif()
215+
216+
##############################################################################
217+
# Make changes to generated world file. To be removed after
218+
# rmf_traffic_editor#524 has been released, to use custom template files
219+
##############################################################################
220+
221+
# Insert Depot model
222+
set(inserted_depot_phony ${output_dir}/inserted_depot_phony)
223+
add_custom_command(
224+
DEPENDS ${output_world_path}
225+
COMMAND sed -i 's|<\/light>|<\/light>\\n<include><uri>https:\/\/fuel.gazebosim.org\/1.0\/OpenRobotics\/models\/Depot<\/uri><pose>15.15 -7.525 0 0 0 0<\/pose><\/include>|g' ${output_world_path}
226+
OUTPUT ${inserted_depot_phony}
227+
)
228+
add_custom_target(insert_depot_into_${output_world_name} ALL
229+
DEPENDS ${inserted_depot_phony}
230+
)
231+
232+
# Change camera view
233+
set(replace_camera_view_phony ${output_dir}/replace_camera_view_phony)
234+
add_custom_command(
235+
DEPENDS ${output_world_path}
236+
COMMAND sed -i 's|<camera_pose>.*<\/camera_pose>|<camera_pose>5.2453 -7.8138 3.8271 0 0.5849817 0.2531771<\/camera_pose>|g' ${output_world_path}
237+
OUTPUT ${replace_camera_view_phony}
238+
)
239+
add_custom_target(replace_camera_pose_in_${output_world_name} ALL
240+
DEPENDS ${replace_camera_view_phony}
241+
)
242+
243+
##############################################################################
244+
# Generate the nav graphs
245+
##############################################################################
246+
247+
set(output_nav_graphs_dir ${output_dir}/nav_graphs/)
248+
set(output_nav_graphs_phony ${output_nav_graphs_dir}/phony)
249+
add_custom_command(
250+
OUTPUT ${output_nav_graphs_phony}
251+
COMMAND ros2 run rmf_building_map_tools building_map_generator nav ${building_map_path} ${output_nav_graphs_dir}
252+
DEPENDS ${building_map_path} ${output_world_path}
253+
)
254+
255+
add_custom_target(generate_${output_world_name}_nav_graphs ALL
256+
DEPENDS ${output_nav_graphs_phony}
257+
)
258+
259+
install(
260+
DIRECTORY ${output_dir}
261+
DESTINATION share/${PROJECT_NAME}/maps
262+
)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# FLEET CONFIG =================================================================
2+
# RMF Fleet parameters
3+
4+
rmf_fleet:
5+
name: "deliveryRobot"
6+
limits:
7+
linear: [0.7, 0.75] # velocity, acceleration
8+
angular: [0.6, 2.0] # velocity, acceleration
9+
profile: # Robot profile is modelled as a circle
10+
footprint: 0.6 # radius in m
11+
vicinity: 0.8 # radius in m
12+
reversible: True # whether robots in this fleet can reverse
13+
# TODO Update battery parameters with actual specs
14+
battery_system:
15+
voltage: 24.0 # V
16+
capacity: 40.0 # Ahr
17+
charging_current: 8.8 # A
18+
mechanical_system:
19+
mass: 70.0 # kg
20+
moment_of_inertia: 40.0 #kgm^2
21+
friction_coefficient: 0.22
22+
ambient_system:
23+
power: 20.0 # W
24+
tool_system:
25+
power: 0.0 # W
26+
recharge_threshold: 0.10 # Battery level below which robots in this fleet will not operate
27+
recharge_soc: 1.0 # Battery level to which robots in this fleet should be charged up to during recharging tasks
28+
max_delay: 15.0 # allowed seconds of delay of the current itinerary before it gets interrupted and replanned
29+
publish_fleet_state: 10.0 # Publish frequency for fleet state, ensure that it is same as robot_state_update_frequency
30+
account_for_battery_drain: True
31+
task_capabilities: # Specify the types of RMF Tasks that robots in this fleet are capable of performing
32+
loop: True
33+
delivery: True
34+
finishing_request: "charge" # [park, charge, nothing]
35+
robots:
36+
deliveryRobot1:
37+
charger: "deliveryRobotCharger1"
38+
deliveryRobot2:
39+
charger: "deliveryRobotCharger2"
40+
41+
fleet_manager:
42+
ip: "127.0.0.1"
43+
port: 22012
44+
user: "some_user"
45+
password: "some_password"
46+
robot_state_update_frequency: 10.0
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version='1.0' ?>
2+
3+
<launch>
4+
<arg name="headless" default="true"/>
5+
<arg name="use_simulator" default="true"/>
6+
<arg name="sim_update_rate" default='100'/>
7+
8+
<!-- RMF Common launch -->
9+
<include file="$(find-pkg-share rmf_demos)/common.launch.xml">
10+
<arg name="headless" value="$(var headless)" />
11+
<arg name="use_sim_time" value="$(var use_simulator)"/>
12+
<arg name="viz_config_file" value ="$(find-pkg-share nexus_integration_tests)/launch/include/depot/depot.rviz"/>
13+
<arg name="config_file" value="$(find-pkg-share nexus_integration_tests)/maps/depot/depot.building.yaml"/>
14+
</include>
15+
16+
<!-- DeliveryRobot fleet adapter -->
17+
<group>
18+
<include file="$(find-pkg-share rmf_demos_fleet_adapter)/launch/fleet_adapter.launch.xml">
19+
<arg name="use_sim_time" value="$(var use_sim_time)"/>
20+
<arg name="nav_graph_file" value="$(find-pkg-share nexus_integration_tests)/maps/depot/nav_graphs/0.yaml" />
21+
<arg name="config_file" value="$(find-pkg-share nexus_integration_tests)/config/depot/deliveryRobot_config.yaml"/>
22+
</include>
23+
</group>
24+
25+
<!-- Simulator launch -->
26+
<include if="$(var use_simulator)" file="$(find-pkg-share rmf_demos_gz)/simulation.launch.xml">
27+
<arg name="headless" value="$(var headless)" />
28+
<arg name="map_package" value="nexus_integration_tests" />
29+
<arg name="map_name" value="depot" />
30+
<arg name="gazebo_version" value="8" />
31+
<arg name="sim_update_rate" value="$(var sim_update_rate)"/>
32+
</include>
33+
34+
</launch>

0 commit comments

Comments
 (0)