60 lines
1.4 KiB
Bash
Executable File
60 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
DCAITI_PATH=.
|
|
|
|
# Define your windows, working dirs, and commands
|
|
declare -a windows=(
|
|
"performance"
|
|
"robot_control"
|
|
"remote_control"
|
|
"lidar"
|
|
# "slam"
|
|
"nav2"
|
|
)
|
|
declare -a work_dirs=(
|
|
$HOME
|
|
$DCAITI_PATH
|
|
$DCAITI_PATH/src/dcaitirobot/launch
|
|
$DCAITI_PATH
|
|
# $DCAITI_PATH/src/dcaitirobot/launch
|
|
$DCAITI_PATH/src/dcaiti_navigation/launch
|
|
)
|
|
declare -a commands=(
|
|
"htop"
|
|
"ros2 launch ft24_control launch_robot.py"
|
|
"ros2 launch remote_control_launch.py"
|
|
"ros2 launch velodyne velodyne-all-nodes-VLP16-launch.py"
|
|
# "ros2 launch launch_slam.py"
|
|
"ros2 launch start_nav2.py"
|
|
)
|
|
|
|
# Start tmux
|
|
tmux start-server
|
|
|
|
SESSION=dcaiti
|
|
|
|
# Create a new session without attaching yet
|
|
tmux new-session -d -s $SESSION
|
|
|
|
# Iterate over sessions array and create them
|
|
for index in ${!windows[*]}; do
|
|
window=${windows[$index]}
|
|
work_dir=${work_dirs[$index]}
|
|
command=${commands[$index]}
|
|
|
|
# If it's the first window, rename the existing window, otherwise create a new one
|
|
if [ $index -eq 0 ]; then
|
|
tmux rename-window -t $SESSION:0 $window
|
|
else
|
|
tmux new-window -t $SESSION -n $window
|
|
fi
|
|
|
|
# Switch to work_dir and execute the command
|
|
tmux send-keys -t $SESSION:$window "cd $work_dir" C-m
|
|
tmux send-keys -t $SESSION:$window "$command" C-m
|
|
done
|
|
|
|
# Finally attach to the tmux session
|
|
tmux attach-session -t $SESSION
|
|
|