From cdf827b9587b8d31fce7f683e151e7e0484bcd1e Mon Sep 17 00:00:00 2001 From: RPS98 Date: Tue, 23 May 2023 14:34:54 +0200 Subject: [PATCH 1/4] Change utils folder, fix mocap and update authors --- AUTHORS | 3 ++- launch_as2.bash | 19 +++++++++---------- mission.py | 2 ++ real_config/state_estimator_mocap.yaml | 1 + {utils => tmuxinator}/gazebo.yml | 0 {utils => tmuxinator}/keyboard_teleop.yml | 0 {utils => tmuxinator}/mocap.yml | 0 {utils => tmuxinator}/rosbag.yml | 0 {utils => tmuxinator}/session.yml | 0 9 files changed, 14 insertions(+), 11 deletions(-) rename {utils => tmuxinator}/gazebo.yml (100%) rename {utils => tmuxinator}/keyboard_teleop.yml (100%) rename {utils => tmuxinator}/mocap.yml (100%) rename {utils => tmuxinator}/rosbag.yml (100%) rename {utils => tmuxinator}/session.yml (100%) diff --git a/AUTHORS b/AUTHORS index 93939d3..e1e9966 100755 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,5 @@ Rafael Pérez Seguí Miguel Fernández Cortizas Pedro Arias Pérez -David Pérez Saura \ No newline at end of file +David Pérez Saura +Javier Melero Deza \ No newline at end of file diff --git a/launch_as2.bash b/launch_as2.bash index 201ff8a..163cd83 100755 --- a/launch_as2.bash +++ b/launch_as2.bash @@ -72,28 +72,27 @@ done for ns in "${drone_ns[@]}" do - if [[ ${ns} == ${drone_ns[0]} ]]; then - base_launch="true" - else - base_launch="false" - fi - - tmuxinator start -n ${ns} -p utils/session.yml drone_namespace=${ns} gps=${gps} simulation=${simulated} estimator_plugin=${estimator_plugin} & + tmuxinator start -n ${ns} -p tmuxinator/session.yml drone_namespace=${ns} gps=${gps} simulation=${simulated} estimator_plugin=${estimator_plugin} & wait done +if [[ ${estimator_plugin} == "mocap_pose" ]]; then + tmuxinator start -n mocap -p tmuxinator/mocap.yml & + wait +fi + if [[ ${record_rosbag} == "true" ]]; then - tmuxinator start -n rosbag -p utils/rosbag.yml drone_namespace=$(list_to_string "${drone_ns[@]}") & + tmuxinator start -n rosbag -p tmuxinator/rosbag.yml drone_namespace=$(list_to_string "${drone_ns[@]}") & wait fi if [[ ${launch_keyboard_teleop} == "true" ]]; then - tmuxinator start -n keyboard_teleop -p utils/keyboard_teleop.yml simulation=true drone_namespace=$(list_to_string "${drone_ns[@]}") & + tmuxinator start -n keyboard_teleop -p tmuxinator/keyboard_teleop.yml simulation=true drone_namespace=$(list_to_string "${drone_ns[@]}") & wait fi if [[ ${simulated} == "true" ]]; then - tmuxinator start -n gazebo -p utils/gazebo.yml simulation_config=${simulation_config} & + tmuxinator start -n gazebo -p tmuxinator/gazebo.yml simulation_config=${simulation_config} & wait fi diff --git a/mission.py b/mission.py index cd72d45..52a0133 100755 --- a/mission.py +++ b/mission.py @@ -28,8 +28,10 @@ def drone_run(drone_interface: DroneInterface, simulation=False): ##### ARM OFFBOARD ##### if simulation: + print("Arm") drone_interface.offboard() sleep(sleep_time) + print("Offboard") drone_interface.arm() sleep(sleep_time) diff --git a/real_config/state_estimator_mocap.yaml b/real_config/state_estimator_mocap.yaml index a20dbd7..51393b2 100644 --- a/real_config/state_estimator_mocap.yaml +++ b/real_config/state_estimator_mocap.yaml @@ -1,2 +1,3 @@ /**: ros__parameters: + none: false diff --git a/utils/gazebo.yml b/tmuxinator/gazebo.yml similarity index 100% rename from utils/gazebo.yml rename to tmuxinator/gazebo.yml diff --git a/utils/keyboard_teleop.yml b/tmuxinator/keyboard_teleop.yml similarity index 100% rename from utils/keyboard_teleop.yml rename to tmuxinator/keyboard_teleop.yml diff --git a/utils/mocap.yml b/tmuxinator/mocap.yml similarity index 100% rename from utils/mocap.yml rename to tmuxinator/mocap.yml diff --git a/utils/rosbag.yml b/tmuxinator/rosbag.yml similarity index 100% rename from utils/rosbag.yml rename to tmuxinator/rosbag.yml diff --git a/utils/session.yml b/tmuxinator/session.yml similarity index 100% rename from utils/session.yml rename to tmuxinator/session.yml From 89dde19cfea8869541248b29ee99515c0e2d4e14 Mon Sep 17 00:00:00 2001 From: RPS98 Date: Tue, 23 May 2023 15:25:58 +0200 Subject: [PATCH 2/4] Improve stop script --- stop.bash | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/stop.bash b/stop.bash index 1ce49c9..5eadf30 100755 --- a/stop.bash +++ b/stop.bash @@ -2,7 +2,7 @@ # Set default input element if [ $# -eq 0 ]; then - set -- "drone0" + set -- "cf0" fi # Make a tmux list of sessions to be killed @@ -18,8 +18,20 @@ if [[ -n "$TMUX" ]]; then current_session=$(tmux display-message -p '#S') fi -# Kill gazebo -pkill -9 -f "gzclient" < /dev/null +# Send Ctrl+C signal to each window of each session +for session in "${tmux_session_list[@]}"; do + # Check if session exists + if tmux has-session -t "$session" 2>/dev/null; then + # Get the list of windows in the session + windows=($(tmux list-windows -t "$session" -F "#{window_index}")) + # Iterate through each window and send Ctrl+C + for window in "${windows[@]}"; do + # Send Ctrl+C to the window + tmux send-keys -t "$session:$window" C-c + sleep 0.1 # Add a small delay to allow the signal to be processed + done + fi +done # Kill all tmux sessions from the list except for the current one for session in "${tmux_session_list[@]}"; do From faf139a7eaf3811209f39a2b554009d202676165 Mon Sep 17 00:00:00 2001 From: RPS98 Date: Tue, 23 May 2023 15:26:57 +0200 Subject: [PATCH 3/4] Change stop default name --- stop.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stop.bash b/stop.bash index 5eadf30..3ec781e 100755 --- a/stop.bash +++ b/stop.bash @@ -2,7 +2,7 @@ # Set default input element if [ $# -eq 0 ]; then - set -- "cf0" + set -- "drone0" fi # Make a tmux list of sessions to be killed From 98bcc043b9f2c480f06f3278935e08d8c3979f21 Mon Sep 17 00:00:00 2001 From: RPS98 Date: Tue, 23 May 2023 16:56:19 +0200 Subject: [PATCH 4/4] Fix keyboard simulation flag --- launch_as2.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch_as2.bash b/launch_as2.bash index 163cd83..cf62a33 100755 --- a/launch_as2.bash +++ b/launch_as2.bash @@ -87,7 +87,7 @@ if [[ ${record_rosbag} == "true" ]]; then fi if [[ ${launch_keyboard_teleop} == "true" ]]; then - tmuxinator start -n keyboard_teleop -p tmuxinator/keyboard_teleop.yml simulation=true drone_namespace=$(list_to_string "${drone_ns[@]}") & + tmuxinator start -n keyboard_teleop -p tmuxinator/keyboard_teleop.yml simulation=${simulated} drone_namespace=$(list_to_string "${drone_ns[@]}") & wait fi