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

Spawner API #8

Merged
merged 59 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
1f2a9ce
loading params from jinja template dynamically
stibipet Dec 8, 2023
bc1ebec
still using jinja
stibipet Dec 11, 2023
77cbaba
working access to template's internal variables
stibipet Dec 12, 2023
c7209fd
dynamic loading works
stibipet Dec 13, 2023
f7e3dd6
load params as list from template
stibipet Dec 13, 2023
816806d
still needs recursion to load macros from imports
stibipet Dec 13, 2023
8282f2a
update template parsing
stibipet Dec 14, 2023
59062e2
import recursion prevention
stibipet Dec 15, 2023
888a852
enable component args in dict form
stibipet Dec 18, 2023
173dbbe
minor update
stibipet Dec 19, 2023
60ae824
input parsing, refactoring, comments
stibipet Dec 20, 2023
6746326
help handling
stibipet Dec 30, 2023
d7b11db
improve documentation and consistency
stibipet Jan 1, 2024
bbfe34c
add test script for testing purposes
stibipet Jan 1, 2024
f2b0fac
added spawn poses loading from file
stibipet Jan 2, 2024
ba9892d
large update, mavlink/mavros seems happy
stibipet Jan 3, 2024
3a972e5
update input handling, config params, subprocess launching
stibipet Jan 4, 2024
46641e5
make spawn calls asynchronous
stibipet Jan 8, 2024
eaba885
change input dict parsing, run garmin through pixhawk
stibipet Jan 10, 2024
6336039
after dealing with more px4_sitl_gazebo spaghetti
stibipet Jan 11, 2024
7f3dba1
garmin cleanup
stibipet Jan 11, 2024
f3189b3
apify ouster
stibipet Jan 11, 2024
3f900bf
apify realsense and bluefox
stibipet Jan 12, 2024
b7dd608
apify uvdar
stibipet Jan 12, 2024
f96f4a5
fix complex component param parsing
stibipet Jan 12, 2024
621c826
apify uvdar and uwb
stibipet Jan 13, 2024
7f2f1d8
make model selection work without '--'
stibipet Jan 13, 2024
32a5ce3
add workaround option for mutually exclusive elements, remove compone…
stibipet Jan 15, 2024
1720bc1
add input parsing assertion guard
stibipet Jan 15, 2024
90d08be
continued model cleanup
stibipet Jan 15, 2024
25e2172
move remaining generic stuff away from components
stibipet Jan 15, 2024
a2e727b
make debugging of broken templates easier
stibipet Jan 16, 2024
085a7d6
apify propellers, make motor crash parametrizable
stibipet Jan 16, 2024
16096b9
modify help to only display components actually available to the model
stibipet Jan 16, 2024
43e2000
add option for direct garmin connection to pc
stibipet Jan 16, 2024
ab4ee39
apify velodyne, teraranger, scanse sweeper, start cleanup in f450
stibipet Jan 16, 2024
ed3f1b4
update cameras and mounts
stibipet Jan 17, 2024
58519b2
apify mobius camera
stibipet Jan 17, 2024
39d22ef
apify fisheye cameras and vio
stibipet Jan 17, 2024
dad42a9
apify servo camera
stibipet Jan 17, 2024
c205df9
apify teraranger tower, cosmetic updates
stibipet Jan 17, 2024
2f985c4
prevent code headers from rendering
stibipet Jan 17, 2024
a6b826e
fix missing comment endings
stibipet Jan 17, 2024
59fd21f
apify whycon and timepix
stibipet Jan 18, 2024
d37f72e
apify gimballed light and pendulum
stibipet Jan 19, 2024
2b8c094
rewrite t650 core
stibipet Jan 19, 2024
a3af6df
apify thermal cameras
stibipet Jan 21, 2024
8f9e3fc
finish t650 update
stibipet Jan 21, 2024
d2130f0
update f550
stibipet Jan 21, 2024
702ecd8
update f330
stibipet Jan 21, 2024
e10faf2
update m690
stibipet Jan 26, 2024
73c8afb
wip: naki update
stibipet Jan 26, 2024
2fd1bac
apify ultrasound sensors
stibipet Jan 30, 2024
0806d09
cleanup
stibipet Jan 30, 2024
59dc6b9
update example sessions to new spawner
stibipet Jan 31, 2024
0d05da1
code cleanup, external paths config update
stibipet Jan 31, 2024
2f9dd01
update vio example session
stibipet Jan 31, 2024
2cbe45f
Merge branch 'master' into spawner_api
stibipet Jan 31, 2024
bd51f75
manually merge servo camera updates
stibipet Jan 31, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.swp

.gitman
__pycache__
15 changes: 8 additions & 7 deletions ros_packages/mrs_uav_gazebo_simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ project(mrs_uav_gazebo_simulation)

set(CATKIN_DEPENDENCIES
cmake_modules
gazebo_ros
mavlink_sitl_gazebo
mavros_msgs
message_runtime
mrs_gazebo_common_resources
mrs_msgs
mrs_uav_px4_api
px4
rospy
std_msgs
mrs_uav_testing
)

find_package(catkin REQUIRED COMPONENTS
Expand All @@ -18,12 +22,6 @@ find_package(catkin REQUIRED COMPONENTS
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(COVERAGE)
message(WARNING "building with --coverage, the performance might be limited")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
endif()

catkin_package(
CATKIN_DEPENDS ${CATKIN_DEPENDENCIES}
)
Expand All @@ -40,6 +38,9 @@ include_directories(

if(CATKIN_ENABLE_TESTING)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")

add_subdirectory(test)

endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ model_params:
# allocation motors -> torques

# quadrotor X configuration
# hexarotor X configuration
# [roll torque, [ [RPM_1^2,
# pitch torque, = Alloc * RPM_2^2,
# yaw torque, Matrix ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ model_params:
# allocation motors -> torques

# quadrotor X configuration
# hexarotor X configuration
# [roll torque, [ [RPM_1^2,
# pitch torque, = Alloc * RPM_2^2,
# yaw torque, Matrix ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ model_params:

# allocation motors -> torques

# quadrotor X configuration
# hexarotor X configuration
# [roll torque, [ [RPM_1^2,
# pitch torque, = Alloc * RPM_2^2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ model_params:
# allocation motors -> torques

# quadrotor X configuration
# hexarotor X configuration
# [roll torque, [ [RPM_1^2,
# pitch torque, = Alloc * RPM_2^2,
# yaw torque, Matrix ...
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ model_params:
# allocation motors -> torques

# quadrotor X configuration
# hexarotor X configuration
# [roll torque, [ [RPM_1^2,
# pitch torque, = Alloc * RPM_2^2,
# yaw torque, Matrix ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ model_params:
# allocation motors -> torques

# quadrotor X configuration
# hexarotor X configuration
# [roll torque, [ [RPM_1^2,
# pitch torque, = Alloc * RPM_2^2,
# yaw torque, Matrix ...
Expand Down
82 changes: 20 additions & 62 deletions ros_packages/mrs_uav_gazebo_simulation/config/spawner_params.yaml
Original file line number Diff line number Diff line change
@@ -1,62 +1,20 @@
enable_rangefinder: [False, 'Add a laser rangefinder (Garmin) pointing down', [f450, f550, t650, x500, f330, eaglemk2, brus, naki, big_dofec, m690]]
enable_rangefinder_up: [False, 'Add a laser rangefinder (Garmin) pointing up', [f450, f550, t650, naki]]
enable_teraranger: [False, 'Add a laser rangefinder (Teraranger) to the vehicle', [f450, f550, t650]]
enable_ground_truth: [False, 'Enable topic with ground truth odometry', [f450, f550, t650, x500, f330, eaglemk2, brus, naki, big_dofec, a300, m690]]
enable_mobius_camera_front: [False, 'Add mobius camera to the vehicle [1280x720 30hz], pointed to the front', [f450, f550, t650]]
enable_mobius_camera_down: [False, 'Add mobius camera to the vehicle [1280x720 30hz], pointed to the ground', [f450, f550]]
enable_mobius_camera_back_left: [False, 'Add mobius camera to the vehicle [1280x720 30hz], pointed to the back left', [f450, f550]]
enable_mobius_camera_back_right: [False, 'Add mobius camera to the vehicle [1280x720 30hz], pointed to the back right', [f450, f550]]
enable_realsense_front_pitched: [False, 'Add Intel Realsense D435 depth camera to the vehicle [1280x720 30hz], pointed to the front pitched down by 10 up to 45 deg. Depends on the type of vehicle', [f450, f550]]
enable_realsense_down: [False, 'Add Intel Realsense D435 depth camera to the vehicle [1280x720 30hz], pointed down', [f450, f550, t650, x500]]
enable_realsense_top: [False, 'Add Intel Realsense D435 depth camera to the vehicle [1280x720 30hz], pointed forward placed on the aluminum frame', [f550, t650]]
enable_realsense_front: [False, 'Add Intel Realsense D435 depth camera to the vehicle [1280x720 30hz], pointed forward placed on the front holder between the legs', [f330, f450, f550, t650, x500, brus, naki]]
enable_realsense_up: [False, 'Add Intel Realsense D435 depth camera to the vehicle [1280x720 30hz], pointed upwards', [f450, f550, t650, x500]]
use_realistic_realsense: [False, 'Enable a more realistic simulation of the Realsense D435 depth image (only takes effect if some Realsense is enabled)', [f330, f450, f550, t650, x500, brus, naki]]
enable_whycon_box: [False, 'Add a Whycon box for relative localization', [f450, f550]]
enable_bluefox_camera: [False, 'Add bluefox camera to the vehicle [752x480 50hz]', [f450, f550, t650, x500, eaglemk2]]
enable_bluefox_camera_reverse: [False, 'Add bluefox camera to the vehicle [752x480 50hz], rotated by 180 deg', [f450, f550, t650, x500]]
enable_basler_camera_down: [False, 'Add basler dart camera pointing down [1920x1200]', [m690]]
enable_fisheye_camera: [False, 'Add fisheye camera to the vehicle [752x480 180deg 45hz]', [f450]]
enable_magnetic_gripper: [False, 'Add magnetic gripper', [f450, f550, t650]]
enable_scanse_sweep: [False, 'Add Scanse Sweep laser scanner to the vehicle', [f450, f550, t650]]
enable_rplidar: [False, 'Add the RPlidar A3 laser scanner to the vehicle', [f450, f550, t650, x500, naki]]
enable_pendulum: [False, 'Add pendulum to the vehicle', [f450, f550, t650]]
enable_teraranger_evo_tower: [False, 'Add the Teraranger Evo Tower laser scanner to the vehicle', [f450, f550, t650]]
enable_timepix: [False, 'Add Timepix radiation detector to the vehicle', [f450, f550, t650]]
enable_timepix3: [False, 'Add Timepix radiation detector to the vehicle', [f450, t650, x500]]
enable_thermal_camera: [False, 'Add thermal camera to the vehicle', [t650, m690]]
enable_velodyne: [False, 'Add Velodyne PUCK Lite laser scanner to the vehicle', [f450, f550, t650]]
enable_ouster: [False, 'Add Ouster laser scanner to the vehicle', [f450, f550, t650, x500, eaglemk2, naki, big_dofec, m690]]
ouster_model: ['OS1-16', 'Choose the Ouster model. Options: OS0-32, OS0-64, OS0-128, OS1-16, OS1-32G1, OS1-32, OS1-64, OS1-128, OS2-32, OS2-64, OS2-128', [f450, f550, t650, x500, eaglemk2, naki, big_dofec, m690]]
use_gpu_ray: [False, 'Laser ray casting will be handled by GPU shaders', [f330, f450, f550, t650, x500, eaglemk2, naki, big_dofec, m690]]
horizontal_samples: [None, 'Override default number of horizontal samples for LiDARs', [f450, f550, t650, x500, eaglemk2, naki]]
rotation_freq: [None, 'Override default update rate for LiDARs', [f450, f550, t650, x500, eaglemk2, naki]]
enable_light: [False, 'Add light to the vehicle', [f450, f550, t650, x500, naki]]
enable_servo_camera: [False, 'Add camera on virtual servo to the vehicle', [f450, f550, t650, naki, m690]]
enable_water_gun: [False, 'Add water gun for fire fighting', [t650]]
enable_parachute: [False, 'Add parachute for emergency flight termination', [t650]]
wall_challenge: [False, 'Configuration for the MBZIRC wall challenge (T650 with 2x bluefox down, realsense down pitched, rangefinder down)', [t650]]
fire_challenge: [False, 'Configuration for the MBZIRC fire challenge (T650 with bluefox down, realsense forward, rp lidar, 3x thermal camera, water gun)', [t650]]
fire_challenge_blanket: [False, 'Configuration for the MBZIRC fire challenge (blanket dropping) (T650 with bluefox down, realsense forward, rp lidar, 2x thermal camera, maybe blanket dropper)', [t650]]
gps_indoor_jamming: [False, 'Enable GPS jamming when drone is indoors (NOTE: UNUSED PARAMETER!)', [f450, f550, t650]]
enable_uv_leds: [False, 'Add UV LEDs to the vehicle', [f450, f550, x500]]
uvled_s: [None, 'Specify UV LED signal ID set as space-separated numbers', [f450, f550, x500]]
uvled_s_l: [None, 'Specify UV LED signal ID left (for backwards compatibility)', [f450, f550, x500]]
uvled_s_r: [None, 'Specify UV LED signal ID right (for backwards compatibility)', [f450, f550, x500]]
enable_uv_leds_beacon: [False, 'Add UV LED beacon to the top of the vehicle', [f450, x500]]
uvled_beacon_s: [None, 'The signal of blinking of the UV Beacon', [f450, x500]]
enable_downward_uv_camera: [False, 'Add UV camera on the vehicle', [t650]]
enable_dual_uv_cameras: [False, 'Add right and left UV cameras on the vehicle', [f450, f550, x500]]
enable_back_uv_camera: [False, 'Add back UV camera on the vehicle', [f450, x500]]
uvcam_calib_file: [None, 'Specify UV camera calibration different than default one', [f450, f550, t650, x500]]
uvcam_occlusions: [False, 'Enable occlusions for UVDAR simulation (NOTE: THIS REQUIRES A BEEFY COMPUTER)', [f450, f550, t650, x500]]
enable_qorvo_dw1000: [False, 'Add Qorvo DW1000 UWB transceiver', [x500]]
pos_file: [None, 'Load positions and ids from .csv file with format: [id, x, y, z, heading] or .yaml file with format: [uav_name: \n id: (int) \n x: (float) \n y: (float) \n z: (float) \n heading: (float)]', [f330, f450, f550, t650, x500, eaglemk2, brus, naki, big_dofec, m690]]
uwb_id: [0, 'Set id for uwb ranging', [x500]]
pos: [None, 'Specify spawn position of the first vehicle in format [x, y, z, heading]. Additional vehicles will spawn in line with 2m x-offset', [f330, f450, f550, t650, x500, eaglemk2, brus, naki, big_dofec]]
enable_vio: [False, 'Add a forward-looking fisheye camera and a high frequency IMU', [f330, f450]]
enable_vio_down: [False, 'Add a forward-looking fisheye camera and a high frequency IMU', [f330, f450]]
enable_omni_ultrasounds: [False, 'Add omnidirectional ultrasonic sensors (up, down, 4 in horizontal plane)', [naki]]
enable_safety_led: [False, 'Add a safety LED', [naki]]
model_package: ["mrs_uav_gazebo_simulation", 'package name for the UAV models', [f330, f450, f550, t650, x500, eaglemk2, brus, naki, big_dofec, a300, m690]]
disable_motor_crash: [False, 'Disables motor failure after crash with the environment', [f330, f450, f550, t650, x500, eaglemk2, brus, naki, big_dofec, a300]]
mavlink_config:
vehicle_base_port: 14000
mavlink_tcp_base_port: 4560
mavlink_udp_base_port: 14560
qgc_udp_port: 14550
sdk_udp_port: 14540
send_vision_estimation: false
send_odometry: true
enable_lockstep: true
use_tcp: true

gazebo_models:
spacing: 5.0 # for randomized spawn poses
default_robot_name: 'uav'

jinja_templates:
save_rendered_sdf: true
suffix: '.sdf.jinja'

extra_resource_paths: []
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<launch>

<arg name="spawner_config" default="" />

<node name="mrs_drone_spawner" pkg="mrs_uav_gazebo_simulation" type="mrs_drone_spawner.py" output="screen" args="no_help verbose">
<node name="mrs_drone_spawner" pkg="mrs_uav_gazebo_simulation" type="mrs_drone_spawner.py" output="screen" args="verbose">

<rosparam file="$(find mrs_uav_gazebo_simulation)/config/spawner_params.yaml" />
<rosparam if="$(eval not arg('spawner_config') == '')" file="$(arg spawner_config)" />

<remap from="~gazebo_model_states" to="/gazebo/model_states" />
<remap from="~gazebo_spawn_model" to="/gazebo/spawn_sdf_model" />

</node>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,25 @@
<?xml version="1.0"?>
<launch>
<!-- MAVROS posix SITL environment launch script -->
<!-- launches Gazebo environment and 2x: MAVROS, PX4 SITL, and spawns vehicle -->
<!-- <arg name="ID" default="1"/> -->
<arg name="ID"/>
<arg name="vehicle"/>
<arg name="x"/>
<arg name="y"/>
<arg name="z"/>
<arg name="heading"/>

<arg name="roll" default="0"/>
<arg name="pitch" default="0"/>
<arg name="est" default="ekf2"/>
<arg name="PX4_SIM_MODEL"/>
<arg name="PX4_ESTIMATOR" default="ekf2"/>

<!-- PX4 configs -->
<arg name="interactive" default="false"/>
<!-- PX4 SITL -->
<arg unless="$(arg interactive)" name="px4_command_arg1" value="-d"/>
<arg if="$(arg interactive)" name="px4_command_arg1" value=""/>
<arg unless="$(arg interactive)" name="px4_interactive_mode" value="-d"/>
<arg if="$(arg interactive)" name="px4_interactive_mode" value=""/>

<!-- UAV namespace -->
<group ns="uav$(arg ID)">

<!-- PX4 params -->
<env name="PX4_SIM_MODEL" value="$(arg vehicle)" />
<env name="PX4_ESTIMATOR" value="$(arg est)" />
<env name="PX4_SIM_MODEL" value="$(arg PX4_SIM_MODEL)" />
<env name="PX4_ESTIMATOR" value="$(arg PX4_ESTIMATOR)" />

<!-- PX4 SITL -->
<node name="sitl_uav$(arg ID)" pkg="px4" type="px4" output="screen" args="$(find mrs_uav_gazebo_simulation)/ROMFS/px4fmu_common -s etc/init.d-posix/rcS $(arg px4_command_arg1) -i $(arg ID) -w sitl_uav$(arg ID)"/>
<node name="sitl_uav$(arg ID)" pkg="px4" type="px4" output="screen" args="$(find mrs_uav_gazebo_simulation)/ROMFS/px4fmu_common -s etc/init.d-posix/rcS $(arg px4_interactive_mode) -i $(arg ID) -w sitl_uav$(arg ID)"/>

</group>
</launch>
13 changes: 5 additions & 8 deletions ros_packages/mrs_uav_gazebo_simulation/launch/simulation.launch
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<arg name="debug" default="false" />
<arg name="physics" default="ode" />
<arg name="verbose" default="true" />
<arg name="reset" default="true" />
<arg name="spawner_config" default="" />

<arg name="LOGGER_DEBUG" default="$(optenv LOGGER_DEBUG false)" />

Expand Down Expand Up @@ -39,13 +39,10 @@
<arg unless="$(arg debug)" name="script_type" value="gzserver" />
<arg if="$(arg debug)" name="script_type" value="debug" />

<!-- kill previous sessions of mavros, px4 and gazebo -->
<group if="$(arg reset)">
<node pkg="mrs_uav_gazebo_simulation" type="kill_previous_session.sh" name="kill_previous_session" output="screen" />
</group>

<!-- start spawner -->
<include file="$(find mrs_uav_gazebo_simulation)/launch/mrs_drone_spawner.launch" />
<!-- start drone spawner -->
<include file="$(find mrs_uav_gazebo_simulation)/launch/mrs_drone_spawner.launch">
<arg name="spawner_config" value="$(arg spawner_config)"/>
</include>

<!-- start gazebo server-->
<node name="gazebo" pkg="gazebo_ros" type="$(arg script_type)" respawn="false" output="screen"
Expand Down
Loading
Loading