Skip to content

Commit

Permalink
added more collision avoidance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Feb 20, 2024
1 parent 102bc25 commit c2d70f6
Show file tree
Hide file tree
Showing 28 changed files with 723 additions and 3 deletions.
4 changes: 4 additions & 0 deletions test/mpc_tracker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ add_subdirectory(mpc_goto)
add_subdirectory(mpc_avoidance_two_should_avoid)

add_subdirectory(mpc_avoidance_two_should_crash)

add_subdirectory(mpc_avoidance_two_uav1_passive)

add_subdirectory(mpc_avoidance_two_uav2_passive)
14 changes: 13 additions & 1 deletion test/mpc_tracker/mpc_avoidance_two_should_avoid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,16 @@ add_dependencies(test_${TEST_NAME}
${catkin_EXPORTED_TARGETS}
)

add_rostest(${TEST_NAME}.test)
set(MODALITIES
attitude_rate
velocity_hdg
)

foreach(MODALITY ${MODALITIES})

add_rostest(${TEST_NAME}.test
ARGS
modality:=${MODALITY}
)

endforeach()
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
input_mode:
actuators: false
control_group: false
attitude_rate: true
attitude: false
acceleration_hdg_rate: false
acceleration_hdg: false
velocity_hdg_rate: false
velocity_hdg: false
position: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
input_mode:
actuators: false
control_group: false
attitude_rate: false
attitude: false
acceleration_hdg_rate: false
acceleration_hdg: false
velocity_hdg_rate: false
velocity_hdg: true
position: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 1. This list is used by NimbroNetwork for mutual communication of the UAVs
# The names of the robots have to match hostnames described in /etc/hosts.
#
# 2. This list is used by MpcTracker for mutual collision avoidance of the UAVs.
# The names should match the true "UAV_NAMES" (the topic prefixes).
#
# network_config:=~/config/network_config.yaml
#
# to the core.launch and nimbro.launch.

network:

robot_names: [
uav1,
uav2,
]
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,28 @@
<arg name="package_eval" default="eval(arg('import_eval') + '(\'rospkg\')').get_package_name(arg('this_path'))" />
<arg name="package" default="$(eval eval(arg('package_eval')))" />

<arg name="modality" default="velocity_hdg" />

<include file="$(find mrs_uav_testing)/launch/mrs_simulator.launch">
<arg name="mrs_simulator_config" default="$(dirname)/config/mrs_simulator.yaml" />
</include>

<include file="$(find mrs_multirotor_simulator)/launch/hw_api.launch">
<arg name="UAV_NAME" default="uav1" />
<arg name="custom_config" default="$(dirname)/config/hw_api.yaml" />
<arg name="custom_config" default="$(dirname)/config/hw_api_$(arg modality).yaml" />
</include>

<include file="$(find mrs_multirotor_simulator)/launch/hw_api.launch">
<arg name="UAV_NAME" default="uav2" />
<arg name="custom_config" default="$(dirname)/config/hw_api.yaml" />
<arg name="custom_config" default="$(dirname)/config/hw_api_$(arg modality).yaml" />
</include>

<include file="$(find mrs_uav_testing)/launch/mrs_uav_system.launch">
<arg name="automatic_start" default="false" />
<arg name="platform_config" default="$(find mrs_multirotor_simulator)/config/mrs_uav_system/$(arg UAV_TYPE).yaml" />
<arg name="custom_config" default="$(dirname)/config/custom_config.yaml" />
<arg name="world_config" default="$(dirname)/config/world_config.yaml" />
<arg name="network_config" default="$(dirname)/config/network_config.yaml" />
<arg name="UAV_NAME" default="uav1" />
</include>

Expand All @@ -39,6 +42,7 @@
<arg name="platform_config" default="$(find mrs_multirotor_simulator)/config/mrs_uav_system/$(arg UAV_TYPE).yaml" />
<arg name="custom_config" default="$(dirname)/config/custom_config.yaml" />
<arg name="world_config" default="$(dirname)/config/world_config.yaml" />
<arg name="network_config" default="$(dirname)/config/network_config.yaml" />
<arg name="UAV_NAME" default="uav2" />
</include>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 1. This list is used by NimbroNetwork for mutual communication of the UAVs
# The names of the robots have to match hostnames described in /etc/hosts.
#
# 2. This list is used by MpcTracker for mutual collision avoidance of the UAVs.
# The names should match the true "UAV_NAMES" (the topic prefixes).
#
# network_config:=~/config/network_config.yaml
#
# to the core.launch and nimbro.launch.

network:

robot_names: [
uav1,
uav2,
]
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<arg name="platform_config" default="$(find mrs_multirotor_simulator)/config/mrs_uav_system/$(arg UAV_TYPE).yaml" />
<arg name="custom_config" default="$(dirname)/config/custom_config.yaml" />
<arg name="world_config" default="$(dirname)/config/world_config.yaml" />
<arg name="network_config" default="$(dirname)/config/network_config.yaml" />
<arg name="UAV_NAME" default="uav1" />
</include>

Expand All @@ -39,6 +40,7 @@
<arg name="platform_config" default="$(find mrs_multirotor_simulator)/config/mrs_uav_system/$(arg UAV_TYPE).yaml" />
<arg name="custom_config" default="$(dirname)/config/custom_config.yaml" />
<arg name="world_config" default="$(dirname)/config/world_config.yaml" />
<arg name="network_config" default="$(dirname)/config/network_config.yaml" />
<arg name="UAV_NAME" default="uav2" />
</include>

Expand Down
16 changes: 16 additions & 0 deletions test/mpc_tracker/mpc_avoidance_two_uav1_passive/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
get_filename_component(TEST_NAME "${CMAKE_CURRENT_SOURCE_DIR}" NAME)

catkin_add_executable_with_gtest(test_${TEST_NAME}
test.cpp
)

target_link_libraries(test_${TEST_NAME}
${catkin_LIBRARIES}
)

add_dependencies(test_${TEST_NAME}
${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
)

add_rostest(${TEST_NAME}.test)
4 changes: 4 additions & 0 deletions test/mpc_tracker/mpc_avoidance_two_uav1_passive/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* UAV1's avoidance is ON
* UAV2's avoidance is OFF

UAV1 should avoid despite its higher priority
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# GET ALL PARAMETERS USABLE FOR CUSTOM CONFIG BY RUNNING:
## --------------------------------------------------------------
## | rosrun mrs_uav_core get_public_params.py #
## --------------------------------------------------------------

mrs_uav_managers:

estimation_manager:

# loaded state estimator plugins
state_estimators: [
"gps_baro",
]

initial_state_estimator: "gps_baro" # will be used as the first state estimator
agl_height_estimator: "" # only slightly filtered height for checking min height (not used in control feedback)

uav_manager:

midair_activation:

after_activation:
controller: "Se3Controller"
tracker: "MpcTracker"

mrs_uav_trackers:

mpc_tracker:

collision_avoidance:

enabled: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# GET ALL PARAMETERS USABLE FOR CUSTOM CONFIG BY RUNNING:
## --------------------------------------------------------------
## | rosrun mrs_uav_core get_public_params.py #
## --------------------------------------------------------------

mrs_uav_managers:

estimation_manager:

# loaded state estimator plugins
state_estimators: [
"gps_baro",
]

initial_state_estimator: "gps_baro" # will be used as the first state estimator
agl_height_estimator: "" # only slightly filtered height for checking min height (not used in control feedback)

uav_manager:

midair_activation:

after_activation:
controller: "Se3Controller"
tracker: "MpcTracker"

mrs_uav_trackers:

mpc_tracker:

collision_avoidance:

enabled: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
collisions:
enabled: false
crash: true

individual_takeoff_platform:
enabled: true

uav_names: [
"uav1",
"uav2",
]

uav1:
type: "x500"
spawn:
x: 0.0
y: 0.0
z: 5.0
heading: 0.0

uav2:
type: "x500"
spawn:
x: 5.0
y: 0.0
z: 5.0
heading: 0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 1. This list is used by NimbroNetwork for mutual communication of the UAVs
# The names of the robots have to match hostnames described in /etc/hosts.
#
# 2. This list is used by MpcTracker for mutual collision avoidance of the UAVs.
# The names should match the true "UAV_NAMES" (the topic prefixes).
#
# network_config:=~/config/network_config.yaml
#
# to the core.launch and nimbro.launch.

network:

robot_names: [
uav1,
uav2,
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
world_origin:

units: "LATLON" # {"UTM, "LATLON"}

origin_x: 47.397743
origin_y: 8.545594

safety_area:

enabled: false

horizontal:

# the frame of reference in which the points are expressed
frame_name: "world_origin"

# polygon
#
# x, y [m] for any frame_name except latlon_origin
# x = latitude, y = longitude [deg] for frame_name=="latlon_origin"
points: [
-50, -50,
50, -50,
50, 50,
-50, 50,
]

vertical:

# the frame of reference in which the max&min z is expressed
frame_name: "world_origin"

max_z: 15.0
min_z: -2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<launch>

<arg name="this_path" default="$(dirname)" />

<arg name="UAV_TYPE" default="x500" />

<!-- automatically deduce the test name -->
<arg name="test_name" default="$(eval arg('this_path').split('/')[-1])" />

<!-- automatically deduce the package name -->
<arg name="import_eval" default="eval('_' + '_import_' + '_')"/>
<arg name="package_eval" default="eval(arg('import_eval') + '(\'rospkg\')').get_package_name(arg('this_path'))" />
<arg name="package" default="$(eval eval(arg('package_eval')))" />

<include file="$(find mrs_uav_testing)/launch/mrs_simulator.launch">
<arg name="mrs_simulator_config" default="$(dirname)/config/mrs_simulator.yaml" />
</include>

<include file="$(find mrs_multirotor_simulator)/launch/hw_api.launch">
<arg name="UAV_NAME" default="uav1" />
<arg name="custom_config" default="$(dirname)/config/hw_api.yaml" />
</include>

<include file="$(find mrs_multirotor_simulator)/launch/hw_api.launch">
<arg name="UAV_NAME" default="uav2" />
<arg name="custom_config" default="$(dirname)/config/hw_api.yaml" />
</include>

<include file="$(find mrs_uav_testing)/launch/mrs_uav_system.launch">
<arg name="automatic_start" default="false" />
<arg name="platform_config" default="$(find mrs_multirotor_simulator)/config/mrs_uav_system/$(arg UAV_TYPE).yaml" />
<arg name="custom_config" default="$(dirname)/config/custom_config_uav1.yaml" />
<arg name="world_config" default="$(dirname)/config/world_config.yaml" />
<arg name="network_config" default="$(dirname)/config/network_config.yaml" />
<arg name="UAV_NAME" default="uav1" />
</include>

<include file="$(find mrs_uav_testing)/launch/mrs_uav_system.launch">
<arg name="automatic_start" default="false" />
<arg name="platform_config" default="$(find mrs_multirotor_simulator)/config/mrs_uav_system/$(arg UAV_TYPE).yaml" />
<arg name="custom_config" default="$(dirname)/config/custom_config_uav2.yaml" />
<arg name="world_config" default="$(dirname)/config/world_config.yaml" />
<arg name="network_config" default="$(dirname)/config/network_config.yaml" />
<arg name="UAV_NAME" default="uav2" />
</include>

<test pkg="$(arg package)" type="test_$(arg test_name)" test-name="$(arg test_name)" time-limit="60.0">
<param name="test" value="$(arg test_name)" />
</test>

</launch>
Loading

0 comments on commit c2d70f6

Please sign in to comment.