forked from mzahana/installRealSenseROS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installRealSenseROS.sh
executable file
·107 lines (99 loc) · 3.25 KB
/
installRealSenseROS.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
# Install Intel realsense-ros on Jetson Developer Kits
# Copyright (c) 2017-2020 Jetsonhacks
# MIT License
# Usage:
# ./installRealSenseROS.sh <catkin workspace>
# If <catkin workspace> is omitted "~/catkin_ws" assumed
# ROS should already be installed, and a catkin workspace created
# Figure out where to install realsense-ros
# Save the directory we're installing from:
INSTALL_DIR=$PWD
# This version uses librealsense v2.31.0
#REALSENSE_ROS_VERSION=2.2.11
# for librealsense 2.48, use 2.3.1
# Ref: https://github.com/IntelRealSense/realsense-ros/tree/2.3.1
REALSENSE_ROS_VERSION=2.3.1
# Now go get ready to install realsense-ros
source /opt/ros/melodic/setup.bash
# In L4T 32.3.1, opencv4 contains the opencv installation
# Make a symbolic link
cd /usr/include
sudo ln -s opencv4 opencv
cd $INSTALL_DIR
DEFAULTDIR=catkin_ws
CLDIR="$1"
if [ ! -z "$CLDIR" ]; then
DEFAULTDIR="$CLDIR"
fi
# Check to see if qualified path already
if [ -d "$DEFAULTDIR" ] ; then
echo "Fully qualified path"
else
# Have to add path qualification
DEFAULTDIR=$HOME/$DEFAULTDIR
fi
echo "DEFAULTDIR: $DEFAULTDIR"
if [ -e "$DEFAULTDIR" ] ; then
echo "$DEFAULTDIR exists"
CATKIN_WORKSPACEHIDDEN=$DEFAULTDIR/.catkin_workspace
CATKIN_BUILD_WORKSPACEHIDDEN=$DEFAULTDIR/.catkin_tools
if [ -e "$CATKIN_WORKSPACEHIDDEN" ] || [ -e "$CATKIN_BUILD_WORKSPACEHIDDEN" ] ; then
# This appears to be a Catkin_Workspace
echo "Found catkin workspace in directory: $DEFAULTDIR"
else
echo "$DEFAULTDIR does not appear to be a Catkin Workspace."
echo "The directory does not contain the hidden file .catkin_workspace or .catkin_tools."
echo "This does not appear to be a proper ROS installation."
echo "Terminating Installation."
exit 1
fi
else
echo "Catkin Workspace named $DEFAULTDIR does not exist"
echo "Please create a Catkin Workspace before installation"
echo "Terminating Installation"
exit 1
fi
if [ "${DEFAULTDIR: -1}" != "/" ] ; then
DEFAULTDIR=$DEFAULTDIR/
fi
INSTALLDIR="$DEFAULTDIR"src
if [ -e "$INSTALLDIR" ] ; then
echo "Installing realsense-ros in: $INSTALLDIR"
else
echo "$INSTALLDIR does not appear to be a source of a Catkin Workspace"
echo "The source directory src does not exist"
echo "Terminating Installation"
exit 1
fi
echo "Starting installation of realsense-ros"
cd $INSTALLDIR
# Update the dependencies database
export LC_ALL='en_US.utf8'
sudo pip3 install rosdepc
sudo rosdepc init
rosdepc update
echo "Cloning Intel ROS realsense package"
# Prerequisite: ddynamic_reconfigure
git clone https://github.com/pal-robotics/ddynamic_reconfigure
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros
git checkout $REALSENSE_ROS_VERSION
# Remove the librealsense2 package requirement in package.xml
patch -p1 < $INSTALL_DIR/patches/package.diff
cd ../..
echo $PWD
echo "Making Intel ROS realsense-ros"
sudo rosdep -y install --from-paths src --ignore-src --rosdistro melodic
if [ -e "$CATKIN_WORKSPACEHIDDEN" ] ; then
echo "catkin_make starts"
catkin_make
echo "realsense-ros Package installed"
elif [ -e "$CATKIN_BUILD_WORKSPACEHIDDEN" ] ; then
echo "catkin_build starts"
catkin build
echo "realsense-ros Package installed"
else
echo "Error: Could not decide to use catkin_make or catkin build"
echo "Aborting..."
fi