Skip to content

Commit

Permalink
added example tmux
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Jan 26, 2024
1 parent df68545 commit 8a9d81b
Show file tree
Hide file tree
Showing 7 changed files with 345 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tmux/config/custom_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
mrs_uav_managers:

estimation_manager:

# loaded state estimator plugins
# available in mrs_uav_state_estimators: gps_garmin, gps_baro, rtk, aloam, ground_truth, dummy
state_estimators: [
"gps_garmin",
"gps_baro",
# "rtk",
# "aloam",
# "ground_truth",
# "dummy"
]

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)

control_manager:

obstacle_bumper:

enabled: true

switch_tracker: true
tracker: "MpcTracker"

switch_controller: true
controller: "Se3Controller"

horizontal:
threshold_distance: 2.5 # [m]

vertical:
threshold_distance: 1.5 # [m]

uav_manager:

takeoff:
after_takeoff:
controller: Se3Controller

constraint_manager:

default_constraints:
gps_garmin: "slow"
gps_baro: "slow"
62 changes: 62 additions & 0 deletions tmux/config/m690.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
uav_mass: 4.65

motor_params:
n_motors: 4
a: 0.18452
b: -0.15

# these model parameters can be used when
# - 'control group', and/or
# - 'actuator control'
# are accepted by the HW API.
model_params:

arm_length: 0.345 # [m]
body_height: 0.20 # [m]

propulsion:

# force [N] = force_constant * rpm^2
force_constant: 0.0000010312

# torque [Nm] = torque_constant * force [N]
torque_constant: 0.07

prop_radius: 0.2286 # [m]

# allocation motors -> torques

# quadrotor X configuration
# [roll torque, [ [RPM_1^2,
# pitch torque, = Alloc * RPM_2^2,
# yaw torque, Matrix ...
# thrust force] ] RPM_n_motors^2]
allocation_matrix: [
-0.707, 0.707, 0.707, -0.707, # *= force_constant*arm_length
-0.707, 0.707, -0.707, 0.707, # *= force_constant*arm_length
-1, -1, 1, 1, # *= torque_constant*force_constant
1, 1, 1, 1, # *= force_constant
]

# The UAV's inertia is approximated as a cilinder using the parameters above
# Alternatively, you can provide inertia matrix directly using the following parameter:
# inertia_matrix: []

rpm:
min: 801.55 # [revolutions/minute]
max: 5337.0 # [revolutions/minute]

mrs_uav_managers:

constraint_manager:

default_constraints:
gps_garmin: "medium"
gps_baro: "medium"
rtk: "medium"
aloam: "slow"
hector_garmin: "slow"
vio: "slow"
optflow: "slow"
other: "slow"
ground_truth: "medium"
17 changes: 17 additions & 0 deletions tmux/config/network_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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,

]
34 changes: 34 additions & 0 deletions tmux/config/world_config.yaml
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: 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
105 changes: 105 additions & 0 deletions tmux/layout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
[
{
"border": "normal",
"floating": "auto_off",
"fullscreen_mode": 0,
"layout": "splitv",
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "normal",
"floating": "auto_off",
"layout": "splith",
"percent": 0.74,
"type": "con",
"nodes": [
{
"border": "normal",
"floating": "auto_off",
"layout": "splith",
"percent": 1,
"type": "con",
"nodes": [
{
"border": "normal",
"floating": "auto_off",
"layout": "splitv",
"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": "uav1.rviz* - RViz",
"percent": 1,
"swallows": [
{
"instance": "^rviz$"
}
],
"type": "con"
}
]
},
{
"border": "normal",
"floating": "auto_off",
"layout": "splitv",
"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": 1,
"swallows": [
{
"instance": "^gazebo$"
}
],
"type": "con"
}
]
}
]
}
]
},
{
"border": "pixel",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 460,
"width": 724,
"x": 0,
"y": 0
},
"name": "./start.sh",
"percent": 0.26,
"swallows": [
{
"instance": "^urxvt$"
}
],
"type": "con"
}
]
}
]
53 changes: 53 additions & 0 deletions tmux/session.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# do not modify these
aoot: ./
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=m690
startup_window: control
windows:
- roscore:
layout: tiled
panes:
- roscore
- gazebo:
layout: tiled
panes:
- waitForRos; roslaunch mrs_uav_gazebo_simulation simulation.launch gui:=true world_name:=forest
- waitForTime; roslaunch mrs_uav_px4_api api.launch
- rviz:
layout: tiled
panes:
- waitForHw; roslaunch mrs_uav_core rviz.launch
- waitForHw; roslaunch mrs_rviz_plugins load_robot.launch
- waitForHw; roslaunch mrs_rviz_plugins rviz_interface.launch
- spawn:
layout: tiled
panes:
- waitForGazebo; rosservice call /mrs_drone_spawner/spawn "1 $UAV_TYPE --enable-rangefinder --enable-ouster --use-gpu-ray"
# - waitForGazebo; rosservice call /mrs_drone_spawner/spawn "1 $UAV_TYPE --enable-rangefinder --enable-rplidar"
- takeoff:
layout: tiled
panes:
- waitForTime; roslaunch mrs_uav_autostart automatic_start.launch
- 'waitForControl; rosservice call /$UAV_NAME/hw_api/arming 1; sleep 2.0; rosservice call /$UAV_NAME/hw_api/offboard'
- status:
layout: tiled
panes:
- waitForHw; roslaunch mrs_uav_status status.launch
- bumper:
layout: tiled
panes:
- waitForHw; roslaunch mrs_bumper bumper.launch
- control:
layout: tiled
panes:
# - waitForTime; 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
- waitForTime; roslaunch mrs_uav_core core.launch platform_config:=./config/m690.yaml custom_config:=./config/custom_config.yaml world_config:=./config/world_config.yaml network_config:=./config/network_config.yaml
- gazebo_camera_follow:
layout: tiled
panes:
- waitForHw; gz camera -c gzclient_camera -f uav1; history -s gz camera -c gzclient_camera -f uav1
- waitForControl; ~/.i3/layout_manager.sh layout.json
27 changes: 27 additions & 0 deletions tmux/start.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8a9d81b

Please sign in to comment.