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

Set up depot map #61

Closed
wants to merge 2 commits into from
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
85 changes: 84 additions & 1 deletion nexus_integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ add_custom_target(generate_zenoh_bridge_configs ALL
COMMAND ros2 run nexus_network_configuration nexus_network_configuration -n ${nexus_network_cfg_path} -o ${zenoh_cfg_output_dir}
)

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

ament_package()

# Modified from rmf_demos_maps
# Get absolute path of the building map
set(building_map "maps/depot/depot.building.yaml")
get_filename_component(building_map_path ${building_map} REALPATH)

# Get the output world name
string(REGEX REPLACE "\\.[^.]*\.[^.]*$" "" no_extension_path ${building_map_path})
string(REGEX MATCH "[^\/]+$" world_name ${no_extension_path})

set(output_world_name ${world_name})
set(output_dir ${CMAKE_CURRENT_BINARY_DIR}/maps/${output_world_name})
set(output_world_path ${output_dir}/${output_world_name}.world)
set(output_model_dir ${output_dir}/models)

##############################################################################
# Generate Gz world and download Models
##############################################################################

message("BUILDING WORLDFILE WITH COMMAND: ros2 run rmf_building_map_tools building_map_generator gazebo ${building_map_path} ${output_world_path} ${output_model_dir}")
if (NO_DOWNLOAD_MODELS)
add_custom_command(
DEPENDS ${building_map_path}
COMMAND ros2 run rmf_building_map_tools building_map_generator gazebo ${building_map_path} ${output_world_path} ${output_model_dir}
OUTPUT ${output_world_path}
)
else()
message("DOWNLOADING MODELS WITH COMMAND: ros2 run rmf_building_map_tools building_map_model_downloader ${building_map_path}")
add_custom_command(
DEPENDS ${building_map_path}
COMMAND ros2 run rmf_building_map_tools building_map_generator gazebo ${building_map_path} ${output_world_path} ${output_model_dir}
COMMAND ros2 run rmf_building_map_tools building_map_model_downloader ${building_map_path} -e ~/.gazebo/models
OUTPUT ${output_world_path}
)
endif()

##############################################################################
# Make changes to generated world file. To be removed after
# rmf_traffic_editor#524 has been released, to use custom template files
##############################################################################

# Insert Depot model
set(inserted_depot_phony ${output_dir}/inserted_depot_phony)
add_custom_command(
DEPENDS ${output_world_path}
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}
OUTPUT ${inserted_depot_phony}
)
add_custom_target(insert_depot_into_${output_world_name} ALL
DEPENDS ${inserted_depot_phony}
)

# Change camera view
set(replace_camera_view_phony ${output_dir}/replace_camera_view_phony)
add_custom_command(
DEPENDS ${output_world_path}
COMMAND sed -i 's|<camera_pose>.*<\/camera_pose>|<camera_pose>1.6679 -8.2494 4.3953 0 0.4919176 0<\/camera_pose>|g' ${output_world_path}
OUTPUT ${replace_camera_view_phony}
)
add_custom_target(replace_camera_pose_in_${output_world_name} ALL
DEPENDS ${replace_camera_view_phony}
)

##############################################################################
# Generate the nav graphs
##############################################################################

set(output_nav_graphs_dir ${output_dir}/nav_graphs/)
set(output_nav_graphs_phony ${output_nav_graphs_dir}/phony)
add_custom_command(
OUTPUT ${output_nav_graphs_phony}
COMMAND ros2 run rmf_building_map_tools building_map_generator nav ${building_map_path} ${output_nav_graphs_dir}
DEPENDS ${building_map_path} ${output_world_path}
)

add_custom_target(generate_${output_world_name}_nav_graphs ALL
DEPENDS ${output_nav_graphs_phony}
)

install(
DIRECTORY ${output_dir}
DESTINATION share/${PROJECT_NAME}/maps
)
46 changes: 46 additions & 0 deletions nexus_integration_tests/config/depot/deliveryRobot_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# FLEET CONFIG =================================================================
# RMF Fleet parameters

rmf_fleet:
name: "deliveryRobot"
limits:
linear: [0.7, 0.75] # velocity, acceleration
angular: [0.6, 2.0] # velocity, acceleration
profile: # Robot profile is modelled as a circle
footprint: 0.6 # radius in m
vicinity: 0.8 # radius in m
reversible: True # whether robots in this fleet can reverse
# TODO Update battery parameters with actual specs
battery_system:
voltage: 24.0 # V
capacity: 40.0 # Ahr
charging_current: 8.8 # A
mechanical_system:
mass: 70.0 # kg
moment_of_inertia: 40.0 #kgm^2
friction_coefficient: 0.22
ambient_system:
power: 20.0 # W
tool_system:
power: 0.0 # W
recharge_threshold: 0.10 # Battery level below which robots in this fleet will not operate
recharge_soc: 1.0 # Battery level to which robots in this fleet should be charged up to during recharging tasks
max_delay: 15.0 # allowed seconds of delay of the current itinerary before it gets interrupted and replanned
publish_fleet_state: 10.0 # Publish frequency for fleet state, ensure that it is same as robot_state_update_frequency
account_for_battery_drain: True
task_capabilities: # Specify the types of RMF Tasks that robots in this fleet are capable of performing
loop: True
delivery: True
finishing_request: "charge" # [park, charge, nothing]
robots:
deliveryRobot1:
charger: "deliveryRobotCharger1"
deliveryRobot2:
charger: "deliveryRobotCharger2"

fleet_manager:
ip: "127.0.0.1"
port: 22012
user: "some_user"
password: "some_password"
robot_state_update_frequency: 10.0
34 changes: 34 additions & 0 deletions nexus_integration_tests/launch/depot.launch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version='1.0' ?>

<launch>
<arg name="headless" default="true"/>
<arg name="use_simulator" default="true"/>
<arg name="sim_update_rate" default='100'/>

<!-- RMF Common launch -->
<include file="$(find-pkg-share rmf_demos)/common.launch.xml">
<arg name="headless" value="$(var headless)" />
<arg name="use_sim_time" value="$(var use_simulator)"/>
<arg name="viz_config_file" value ="$(find-pkg-share nexus_integration_tests)/launch/include/depot/depot.rviz"/>
<arg name="config_file" value="$(find-pkg-share nexus_integration_tests)/maps/depot/depot.building.yaml"/>
</include>

<!-- DeliveryRobot fleet adapter -->
<group>
<include file="$(find-pkg-share rmf_demos_fleet_adapter)/launch/fleet_adapter.launch.xml">
<arg name="use_sim_time" value="$(var use_sim_time)"/>
<arg name="nav_graph_file" value="$(find-pkg-share nexus_integration_tests)/maps/depot/nav_graphs/0.yaml" />
<arg name="config_file" value="$(find-pkg-share nexus_integration_tests)/config/depot/deliveryRobot_config.yaml"/>
</include>
</group>

<!-- Simulator launch -->
<include if="$(var use_simulator)" file="$(find-pkg-share rmf_demos_gz)/simulation.launch.xml">
<arg name="headless" value="$(var headless)" />
<arg name="map_package" value="nexus_integration_tests" />
<arg name="map_name" value="depot" />
<arg name="gazebo_version" value="8" />
<arg name="sim_update_rate" value="$(var sim_update_rate)"/>
</include>

</launch>
Loading
Loading