Skip to content

Commit 44690c0

Browse files
committed
adding shell script for installing dependencies
1 parent ba88f64 commit 44690c0

File tree

5 files changed

+75
-32
lines changed

5 files changed

+75
-32
lines changed

.travis.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,10 @@ env:
2121

2222
################################################################################
2323

24-
# Install system dependencies, namely a very barebones ROS setup.
2524
before_install:
26-
#install lapack
27-
- sudo apt-get update >/dev/null # suppress output
28-
- sudo apt-get install liblapack-dev >/dev/null # suppress output
29-
- sudo apt-get install libeigen3-dev >/dev/null # suppress output
30-
- sudo apt-get install cmake >/dev/null # suppress output
31-
25+
3226
#install gtest
27+
- sudo apt-get update >/dev/null # suppress output
3328
- sudo apt install libgtest-dev >/dev/null # suppress output
3429
- cd /usr/src/gtest/ >/dev/null # suppress output
3530
- sudo mkdir build && cd build >/dev/null # suppress output
@@ -38,9 +33,6 @@ before_install:
3833
- sudo cp *.so /usr/lib >/dev/null # suppress output
3934
- cd ~/ >/dev/null # suppress output
4035

41-
#install IPOPT
42-
- sudo apt-get install coinor-libipopt-dev >/dev/null # suppress output
43-
4436
#install ros kinetic
4537
- sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list' >/dev/null # suppress output
4638
- wget http://packages.ros.org/ros.key -O - | sudo apt-key add - >/dev/null # suppress output
@@ -63,7 +55,13 @@ install:
6355
# Add the package under integration to the workspace using a symlink.
6456
- cd ~/catkin_ws/src
6557
- ln -s $CI_SOURCE_PATH .
58+
59+
#install deb-packaged dependencies
60+
- cd ~/catkin_ws/src/control-toolbox/ct
61+
- ./install_deps >/dev/null # suppress output
62+
6663
#install kindr
64+
- cd ~/catkin_ws/src/
6765
- git clone https://github.com/ANYbotics/kindr.git
6866

6967
# Install all dependencies, using wstool first and rosdep second.

ct/build_ct.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,18 @@ if [ -d "../$1" ]; then
2626
cd ..
2727
echo " === completed " $1 " === "
2828
else
29-
echo "ERROR: you need to start the installer from the control-toolbox/ct directory."
29+
echo "ERROR: an error occurred during building or installing. Try building manually."
3030
exit 1
3131
fi
3232
}
3333

34+
## get current folder and make sure it is *ct*
35+
curr_folder=${PWD##*/}
36+
if [ $curr_folder != "ct" ]; then
37+
echo "ERROR: you need to start the installer from the control-toolbox/ct directory."
38+
exit 1
39+
fi
40+
3441
# check number of user input args
3542
# no args
3643
if [ -z "$1" ]

ct/install_deps.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
sudo apt-get update
4+
5+
## get lapack
6+
sudo apt-get install liblapack-dev
7+
8+
## get eigen3
9+
sudo apt-get install libeigen3-dev
10+
11+
## get cmake
12+
sudo apt-get install cmake
13+
14+
## get IPOPT
15+
sudo apt-get install coinor-libipopt-dev
16+
17+
## get boost
18+
sudo apt-get install libboost-all-dev

ct_doc/doc/installation.dox

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- a compiler with C++14 support, e.g. gcc or clang
1010

1111

12-
\section dep Dependencies and building the library
12+
\section dep Get Required Dependencies
1313
- install <a href="http://eigen.tuxfamily.org/index.php?title=Main_Page">Eigen 3</a> via
1414
\code{.sh}
1515
sudo apt-get update
@@ -19,40 +19,40 @@
1919
\code{.sh}
2020
sudo apt-get install libboost-all-dev
2121
\endcode
22-
- install the <a href="https://github.com/ethz-asl/kindr">kindr</a> library
22+
- clone the <a href="https://github.com/ethz-asl/kindr">kindr</a> library into your workspace
2323
\code{.sh}
24-
cd ~/catkin_ws/src
24+
cd ~/your_workspace/src
2525
git clone https://github.com/ANYbotics/kindr.git
2626
\endcode
27-
- finally, clone the control toolbox and build your workspace
27+
- finally, clone the control toolbox into your workspace
2828
\code{.sh}
29-
cd ~/catkin_ws/src
29+
cd ~/your_workspace/src
3030
git clone https://github.com/ethz-adrl/control-toolbox.git
31-
catkin build -DCMAKE_BUILD_TYPE=Release
3231
\endcode
33-
- VARIANT A, if you are a ROS-user: create a catkin workspace and build the CT using catkin tools
32+
33+
\section build Building the CT
34+
- VARIANT A, if you are a ROS-user: build the CT using catkin tools
3435
\code{.sh}
35-
mkdir -p ~/catkin_ws/src
36-
cd ~/catkin_ws
37-
catkin init
36+
cd ~/your_workspace
3837
catkin build -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=true
3938
\endcode
40-
- VARIANT B, if you prefer plain cmake.
41-
\code{.sh}
42-
todo ...
43-
\endcode
44-
- if you would like to run an example, build the library with
39+
- Now, try to run the examples, e.g. the optimal control and optimal filtering examples:
4540
\code{.sh}
4641
cd ~/catkin_ws/src
4742
catkin build -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=true
48-
\endcode
49-
Now, try to run the examples, e.g. the optimal control and optimal filtering examples:
50-
\code{.sh}
51-
cd ~/catkin_ws/src
52-
catkin build -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=true
5343
rosrun ct_optcon ex_NLOC
5444
rosrun ct_optcon ex_KalmanFiltering
5545
\endcode
46+
- VARIANT B, if you prefer plain cmake.
47+
First, make sure you build and install the kindr-library, see <a href="https://github.com/ANYbotics/kindr#building">kindr</a> here.
48+
Then go to the CT and run the build script:
49+
\code{.sh}
50+
cd ../control-toolbox/ct
51+
chmod 775 build_ct.sh
52+
./build_ct.sh -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=true
53+
\endcode
54+
- This creates a /build subdirectory in every single CT-project, where the examples will be located.
55+
5656

5757

5858
\section opt_dep Optional Dependencies and Bindings

ct_optcon/examples/CMakeLists.txt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,58 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/exampleDir.h.in ${CMAKE_CURRENT_SOURC
33

44
add_executable(ex_ConstraintOutput ConstraintExampleOutput.cpp)
55
target_link_libraries(ex_ConstraintOutput ct_optcon)
6+
list(APPEND optcon_ex_TARGETS ex_ConstraintOutput)
67

78
add_executable(ex_LQR LQR.cpp)
89
target_link_libraries(ex_LQR ct_optcon)
10+
list(APPEND optcon_ex_TARGETS ex_LQR)
911

1012
add_executable(ex_NLOC NLOC.cpp)
1113
target_link_libraries(ex_NLOC ct_optcon)
14+
list(APPEND optcon_ex_TARGETS ex_NLOC)
1215

1316
add_executable(ex_NLOC_MPC NLOC_MPC.cpp)
1417
target_link_libraries(ex_NLOC_MPC ct_optcon)
18+
list(APPEND optcon_ex_TARGETS ex_NLOC_MPC)
1519

1620
add_executable(ex_KalmanFiltering KalmanFiltering.cpp)
1721
target_link_libraries(ex_KalmanFiltering ct_optcon)
22+
list(APPEND optcon_ex_TARGETS ex_KalmanFiltering)
1823

1924
add_executable(ex_KalmanDisturbanceFiltering KalmanDisturbanceFiltering.cpp)
2025
target_link_libraries(ex_KalmanDisturbanceFiltering ct_optcon )
26+
list(APPEND optcon_ex_TARGETS ex_KalmanDisturbanceFiltering)
2127

2228
add_executable(ex_Nlp_2D nlp/Nlp2D.cpp)
2329
target_link_libraries(ex_Nlp_2D ct_optcon)
30+
list(APPEND optcon_ex_TARGETS ex_Nlp_2D)
2431

2532
add_executable(ex_Nlp_3D nlp/Nlp3D.cpp)
2633
target_link_libraries(ex_Nlp_3D ct_optcon)
34+
list(APPEND optcon_ex_TARGETS ex_Nlp_3D)
2735

2836
add_executable(ex_DMS DMS.cpp)
2937
target_link_libraries(ex_DMS ct_optcon)
38+
list(APPEND optcon_ex_TARGETS ex_DMS)
3039

3140
if(HPIPM)
3241
add_executable(ex_NLOC_boxConstrained NLOC_boxConstrained.cpp)
3342
target_link_libraries(ex_NLOC_boxConstrained ct_optcon)
43+
list(APPEND optcon_ex_TARGETS ex_NLOC_boxConstrained)
3444

3545
add_executable(ex_NLOC_generalConstrained NLOC_generalConstrained.cpp)
3646
target_link_libraries(ex_NLOC_generalConstrained ct_optcon)
47+
list(APPEND optcon_ex_TARGETS ex_NLOC_generalConstrained)
3748

3849
add_executable(switched_continuous_optcon_example switched_systems_optcon/switched_continuous_optcon.cpp)
3950
target_link_libraries(switched_continuous_optcon_example ct_optcon)
40-
endif(HPIPM)
51+
list(APPEND optcon_ex_TARGETS switched_continuous_optcon_example)
52+
endif(HPIPM)
53+
54+
55+
## install examples
56+
include(GNUInstallDirs)
57+
install(
58+
TARGETS ${optcon_ex_TARGETS}
59+
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/ct_optcon
60+
)

0 commit comments

Comments
 (0)