-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlaunch.sh
More file actions
61 lines (55 loc) · 1.57 KB
/
launch.sh
File metadata and controls
61 lines (55 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Usage: ./launch.sh [--sim] [--persist] [--ros-distro <ros_distro>] [--venv-path <venv_path>] [--ws <workspace_path>]
# Exit on error
set -e
# Default values
ROS_DISTRO="humble"
WS=~/ros_create3_agent_ws
VENV_PATH=~/ros_create3_agent_venv
USE_SIM="false"
PERSIST="false"
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--ros-distro)
ROS_DISTRO="$2"
shift 2
;;
--venv-path)
VENV_PATH="$2"
shift 2
;;
--ws)
WS="$2"
shift 2
;;
--sim)
USE_SIM="true"
shift
;;
--persist)
PERSIST="true"
shift
;;
*)
shift
;;
esac
done
# Launch the Create 3 Agent (and simulator)
echo ""
if [ "$USE_SIM" == "true" ]; then
echo "Launching Create 3 simulator..."
SIM_CMD="export ROS_DISTRO=$ROS_DISTRO; export VENV_PATH=$VENV_PATH; export WS=$WS; source /opt/ros/$ROS_DISTRO/setup.bash && source $VENV_PATH/bin/activate && source $WS/install/setup.bash && ros2 launch irobot_create_gazebo_bringup create3_gazebo.launch.py"
if [ "$PERSIST" == "true" ]; then
SIM_CMD="$SIM_CMD; exec bash"
fi
gnome-terminal -- bash -c "$SIM_CMD"
sleep 5 # Wait for the simulator to start
fi
echo "Launching Create 3 agent..."
AGENT_CMD="export ROS_DISTRO=$ROS_DISTRO; export VENV_PATH=$VENV_PATH; export WS=$WS; source /opt/ros/$ROS_DISTRO/setup.bash && source $VENV_PATH/bin/activate && source $WS/install/setup.bash && ros2 launch ros_create3_agent agent.launch.py"
if [ "$PERSIST" == "true" ]; then
AGENT_CMD="$AGENT_CMD; exec bash"
fi
gnome-terminal -- bash -c "$AGENT_CMD"