From aed3231b68e16ab09d82c719ce85b333191b2c25 Mon Sep 17 00:00:00 2001 From: Tomas Baca Date: Fri, 3 Nov 2023 14:41:34 +0100 Subject: [PATCH] added 3dlidar example session --- .../config/custom_config.yaml | 26 +++++ .../config/network_config.yaml | 15 +++ .../config/world_config.yaml | 34 ++++++ .../tmux/one_drone_3dlidar/kill.sh | 14 +++ .../tmux/one_drone_3dlidar/layout.json | 105 ++++++++++++++++++ .../tmux/one_drone_3dlidar/session.yml | 59 ++++++++++ .../tmux/one_drone_3dlidar/start.sh | 27 +++++ 7 files changed, 280 insertions(+) create mode 100644 ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/config/custom_config.yaml create mode 100644 ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/config/network_config.yaml create mode 100644 ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/config/world_config.yaml create mode 100755 ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/kill.sh create mode 100644 ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/layout.json create mode 100644 ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/session.yml create mode 100755 ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/start.sh diff --git a/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/config/custom_config.yaml b/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/config/custom_config.yaml new file mode 100644 index 0000000..249e548 --- /dev/null +++ b/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/config/custom_config.yaml @@ -0,0 +1,26 @@ +mrs_uav_managers: + + estimation_manager: + + # loaded state estimator plugins + state_estimators: [ + "gps_garmin", + "gps_baro", + "ground_truth", + ] + + initial_state_estimator: "gps_baro" # will be used as the first state estimator + agl_height_estimator: "garmin_agl" # only slightly filtered height for checking min height (not used in control feedback) + + uav_manager: + + takeoff: + + during_takeoff: + controller: "MpcController" + tracker: "LandoffTracker" + + after_takeoff: + controller: "MpcController" + # controller: "Se3Controller" + tracker: "MpcTracker" diff --git a/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/config/network_config.yaml b/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/config/network_config.yaml new file mode 100644 index 0000000..08f370d --- /dev/null +++ b/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/config/network_config.yaml @@ -0,0 +1,15 @@ +# 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, + ] diff --git a/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/config/world_config.yaml b/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/config/world_config.yaml new file mode 100644 index 0000000..9b55067 --- /dev/null +++ b/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/config/world_config.yaml @@ -0,0 +1,34 @@ +world_origin: + + units: "LATLON" # {"UTM, "LATLON"} + + origin_x: 47.397743 + origin_y: 8.545594 + +safety_area: + + enabled: true + + 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: 0.5 diff --git a/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/kill.sh b/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/kill.sh new file mode 100755 index 0000000..28d50b0 --- /dev/null +++ b/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/kill.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Absolute path to this script. /home/user/bin/foo.sh +SCRIPT=$(readlink -f $0) +# Absolute path this script is in. /home/user/bin +SCRIPTPATH=`dirname $SCRIPT` +cd "$SCRIPTPATH" + +export TMUX_SESSION_NAME=simulation +export TMUX_SOCKET_NAME=mrs + +# just attach to the session +tmux -L $TMUX_SOCKET_NAME split-window -t $TMUX_SESSION_NAME +tmux -L $TMUX_SOCKET_NAME send-keys -t $TMUX_SESSION_NAME "sleep 1; tmux list-panes -s -F \"#{pane_pid} #{pane_current_command}\" | grep -v tmux | cut -d\" \" -f1 | while read in; do killp \$in; done; exit" ENTER diff --git a/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/layout.json b/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/layout.json new file mode 100644 index 0000000..3b10030 --- /dev/null +++ b/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/layout.json @@ -0,0 +1,105 @@ +[ + { + "border": "normal", + "floating": "auto_off", + "fullscreen_mode": 0, + "layout": "splith", + "percent": 0.5, + "type": "con", + "nodes": [ + { + "border": "normal", + "floating": "auto_off", + "layout": "splith", + "percent": 1, + "type": "con", + "nodes": [ + { + "border": "normal", + "floating": "auto_off", + "layout": "splitv", + "percent": 1, + "type": "con", + "nodes": [ + { + "border": "normal", + "floating": "auto_off", + "layout": "splith", + "percent": 0.5, + "type": "con", + "nodes": [ + { + "border": "pixel", + "current_border_width": 3, + "floating": "auto_off", + "geometry": { + "height": 460, + "width": 724, + "x": 0, + "y": 0 + }, + "name": "Gazebo", + "percent": 0.5, + "swallows": [ + { + "instance": "^gazebo$" + } + ], + "type": "con" + }, + { + "border": "pixel", + "current_border_width": 3, + "floating": "auto_off", + "geometry": { + "height": 460, + "width": 724, + "x": 0, + "y": 0 + }, + "name": "default_simulation.rviz* - RViz", + "percent": 0.5, + "swallows": [ + { + "instance": "^rviz$" + } + ], + "type": "con" + } + ] + }, + { + "border": "normal", + "floating": "auto_off", + "layout": "splith", + "percent": 0.5, + "type": "con", + "nodes": [ + { + "border": "pixel", + "current_border_width": 3, + "floating": "auto_off", + "geometry": { + "height": 460, + "width": 724, + "x": 0, + "y": 0 + }, + "name": "./start.sh", + "percent": 1, + "swallows": [ + { + "instance": "^urxvt$" + } + ], + "type": "con" + } + ] + } + ] + } + ] + } + ] + } +] diff --git a/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/session.yml b/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/session.yml new file mode 100644 index 0000000..90b41b7 --- /dev/null +++ b/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/session.yml @@ -0,0 +1,59 @@ +# do not modify these +root: ./ +name: simulation +socket_name: mrs +attach: false +tmux_options: -f /etc/ctu-mrs/tmux.conf +# you can modify these +pre_window: export UAV_NAME=uav1; export RUN_TYPE=simulation; export UAV_TYPE=x500 +startup_window: status +windows: + - roscore: + layout: tiled + panes: + - roscore + - gazebo: + layout: tiled + panes: + - waitForRos; roslaunch mrs_uav_gazebo_simulation simulation.launch world_name:=forest gui:=true + - waitForControl; gz camera -c gzclient_camera -f $UAV_NAME; history -s gz camera -c gzclient_camera -f $UAV_NAME + - status: + layout: tiled + panes: + - waitForHw; roslaunch mrs_uav_status status.launch + - spawn: + layout: tiled + panes: + # the horizontal-samples decreases the base sample rate of 20480 (=2048 points per linescan) to a user-defined value + - waitForGazebo; rosservice call /mrs_drone_spawner/spawn "1 $UAV_TYPE --enable-rangefinder --enable-ground-truth --enable-ouster --ouster-model OS0-128 --use-gpu-ray --horizontal-samples 1280" + - hw_api: + layout: tiled + panes: + - waitForTime; roslaunch mrs_uav_px4_api api.launch + - core: + layout: tiled + panes: + - waitForHw; roslaunch mrs_uav_core core.launch + platform_config:=`rospack find mrs_uav_gazebo_simulation`/config/mrs_uav_system/$UAV_TYPE.yaml + custom_config:=./config/custom_config.yaml + world_config:=./config/world_config.yaml + network_config:=./config/network_config.yaml + - takeoff: + layout: tiled + panes: + - waitForHw; roslaunch mrs_uav_autostart automatic_start.launch + - 'waitForControl; rosservice call /$UAV_NAME/hw_api/arming 1; sleep 2; rosservice call /$UAV_NAME/hw_api/offboard' + - goto: + layout: tiled + panes: + - 'history -s rosservice call /$UAV_NAME/control_manager/goto \"goal: \[0.0, 10.0, 1.5, 0.0\]\"' + - rviz: + layout: tiled + panes: + - waitForControl; roslaunch mrs_uav_core rviz.launch + - waitForControl; roslaunch mrs_rviz_plugins load_robot.launch + - waitForTime; waitForControl; roslaunch mrs_rviz_plugins rviz_interface.launch + - layout: + layout: tiled + panes: + - waitForControl; sleep 3; ~/.i3/layout_manager.sh ./layout.json diff --git a/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/start.sh b/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/start.sh new file mode 100755 index 0000000..5bb2275 --- /dev/null +++ b/ros_packages/mrs_uav_gazebo_simulation/tmux/one_drone_3dlidar/start.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Absolute path to this script. /home/user/bin/foo.sh +SCRIPT=$(readlink -f $0) +# Absolute path this script is in. /home/user/bin +SCRIPTPATH=`dirname $SCRIPT` +cd "$SCRIPTPATH" + +export TMUX_SESSION_NAME=simulation +export TMUX_SOCKET_NAME=mrs + +# start tmuxinator +tmuxinator start -p ./session.yml + +# if we are not in tmux +if [ -z $TMUX ]; then + + # just attach to the session + tmux -L $TMUX_SOCKET_NAME a -t $TMUX_SESSION_NAME + +# if we are in tmux +else + + # switch to the newly-started session + tmux detach-client -E "tmux -L $TMUX_SOCKET_NAME a -t $TMUX_SESSION_NAME" + +fi