forked from casper-auto/CasperAuto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_workspace.sh
executable file
·62 lines (54 loc) · 1.55 KB
/
setup_workspace.sh
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
62
#!/bin/bash
echo "Using the default rosinstall file!"
CONFIG_FILE=simulation_workspace.rosinstall
ROSINSTALLFILE=$(cd $(dirname $CONFIG_FILE) && pwd -P)/$CONFIG_FILE
# Install dependencies
echo "Installing dependencies..."
if [ $ROS_PYTHON_VERSION -eq 3 ]
then
sudo apt-get install -y python-is-python3 python3-wstool python3-catkin-tools
else
sudo apt-get install -y python-wstool python-catkin-tools
fi
pip install -r requirements.txt
sudo apt-get install -y libxmlrpc-c++8-dev \
ros-${ROS_DISTRO}-jsk-visualization
# Initialize catkin workspace
echo "Initializing catkin workspace from $ROSINSTALLFILE ... (strg + c to cancel)"
sleep 5
# remove old workspace if exists
if [ -d "catkin_ws" ]
then
echo "Removing old catkin workspace..."
rm -rf catkin_ws
fi
mkdir -p catkin_ws/src
catkin init --workspace catkin_ws
cd catkin_ws
wstool init src $ROSINSTALLFILE
cd ..
# apply git patch in ros-bridge
cp scripts/update_ros_bridge.patch catkin_ws/src/carla-ros-bridge/
cd catkin_ws/src/carla-ros-bridge && git apply update_ros_bridge.patch
cd ../../..
# Create simbolic link of the packages in src
echo "Creating simbolic link of the packages..."
cd src
ln -s ../../src casper-auto-stack
cd ..
# Install required ros-dependencies with rosdep
rosdep update
rosdep install --from-paths src --ignore-src -r -y
# Build
echo "Building packages..."
catkin build
return_value=$?
if [ ${return_value} -eq 1 ]
then
echo "Build failed"
exit 1
fi
echo
echo "Remember to source the build files!"
echo "Please run:"
echo " source catkin_ws/devel/setup.bash"