-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge PR #54 (RIP v0.1) from utk-robotics-2017/dev
RIP v0.1 merge. More hardware testing & bugfixes are likely necessary.
- Loading branch information
Showing
440 changed files
with
39,064 additions
and
6,465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build | ||
.travis.yml | ||
.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,18 @@ | |
[submodule "external/serial"] | ||
path = external/serial | ||
url = [email protected]:utk-robotics-2017/serial.git | ||
[submodule "external/eigen"] | ||
path = external/eigen | ||
url = [email protected]:utk-robotics-2017/eigen.git | ||
[submodule "external/g2o"] | ||
path = external/g2o | ||
url = [email protected]:utk-robotics-2017/g2o.git | ||
[submodule "external/suitesparse"] | ||
path = external/suitesparse | ||
url = [email protected]:utk-robotics-2017/suitesparse.git | ||
[submodule "external/optional-lite"] | ||
path = external/optional-lite | ||
url = [email protected]:utk-robotics-2017/optional-lite.git | ||
[submodule "external/args"] | ||
path = external/args | ||
url = [email protected]:utk-robotics-2017/args.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,36 @@ | ||
dist: trusty | ||
|
||
sudo: false | ||
sudo: required | ||
|
||
services: | ||
- docker | ||
|
||
language: cpp | ||
|
||
compiler: | ||
- gcc | ||
- clang | ||
|
||
install: | ||
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi | ||
|
||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
- g++-4.9 | ||
- gcc-4.9 | ||
- clang | ||
- cppcheck | ||
- cmake | ||
- lcov | ||
- libssh2-1-dev | ||
|
||
- docker pull utkrobotics/rip_deps | ||
|
||
before_script: | ||
- ./travis/before_script.sh $TRAVIS_BRANCH $TRAVIS_PULL_REQUEST $TRAVIS_PULL_REQUEST_BRANCH | ||
# get cached images from | ||
- docker build --tag rip_ci . | ||
# - ./travis/before_script.sh $TRAVIS_BRANCH $TRAVIS_PULL_REQUEST $TRAVIS_PULL_REQUEST_BRANCH | ||
# - ./travis/compile_g2o.sh | ||
# start the container persistence: | ||
- ci_env=`bash <(curl -s https://codecov.io/env)` | ||
- docker run --name rip_ci $ci_env -t -d rip_ci zsh -l | ||
# run setup in container: | ||
- docker exec -t rip_ci zsh -c "./travis/before_script.sh $TRAVIS_BRANCH $TRAVIS_PULL_REQUEST $TRAVIS_PULL_REQUEST_BRANCH" | ||
- docker start rip_ci | ||
|
||
script: | ||
- ./travis/script.sh $TRAVIS_BRANCH $TRAVIS_PULL_REQUEST $TRAVIS_PULL_REQUEST_BRANCH | ||
- docker exec -t rip_ci zsh -c "./travis/script.sh $TRAVIS_BRANCH $TRAVIS_PULL_REQUEST $TRAVIS_PULL_REQUEST_BRANCH" | ||
|
||
after_script: | ||
- ./travis/after_script.sh $TRAVIS_BRANCH $TRAVIS_PULL_REQUEST $TRAVIS_PULL_REQUEST_BRANCH | ||
# - ./travis/after_script.sh $TRAVIS_BRANCH $TRAVIS_PULL_REQUEST $TRAVIS_PULL_REQUEST_BRANCH | ||
- docker exec -t rip_ci zsh -c "./travis/after_script.sh $TRAVIS_BRANCH $TRAVIS_PULL_REQUEST $TRAVIS_PULL_REQUEST_BRANCH" | ||
- docker stop rip_ci | ||
- docker rm rip_ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,27 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(rip) | ||
message(building) | ||
# Get the current working branch | ||
execute_process( | ||
COMMAND git rev-parse --abbrev-ref HEAD | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
OUTPUT_VARIABLE GIT_BRANCH | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
|
||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
# Can remove this if found to be not needed - was required on some machines | ||
# to correctly compile the codebase despite this line being in the | ||
# downstream CMake files. | ||
set (CMAKE_CXX_STANDARD 11) | ||
|
||
message("Git branch: ${GIT_BRANCH}") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}-fdiagnostics-color=always") | ||
|
||
LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules) | ||
|
||
option(ENABLE_TESTING "Enable module testing" OFF) | ||
|
||
add_subdirectory(external) | ||
add_subdirectory(core) | ||
add_subdirectory(appendages) | ||
add_subdirectory(arduino_gen) | ||
|
||
if(GIT_BRANCH MATCHES "arduino_gen/.*") | ||
add_subdirectory(core/utilities/exceptions_base) | ||
add_subdirectory(arduino_gen) | ||
add_subdirectory(gui) | ||
else() | ||
add_subdirectory(core) | ||
add_subdirectory(appendages) | ||
add_subdirectory(arduino_gen) | ||
|
||
option(GUI "Build the GUI" OFF) | ||
if(GUI) | ||
message("Building the GUI") | ||
add_subdirectory(gui) | ||
endif() | ||
|
||
#option(ALL "Build everything" OFF) | ||
# | ||
## RIP Modules | ||
#option(RIP "Build all of RIP" OFF) | ||
#option(COMMUNICATION "Build RIP's communication module" OFF) | ||
#option(NAVIGATION "Build RIP's navigation module" OFF) | ||
#option(NAVX "Build RIP's navx submodule" OFF) | ||
#option(PATHFINDER "Build RIP's pathfinder submodule" OFF) | ||
#option(VISION "Build RIP's vision module" OFF) | ||
#option(FSM "Build RIP's fsm and action scheduler modules" OFF) | ||
# | ||
## Other Modules | ||
#option(RIPCOM "Build RIPCOM" OFF) | ||
#option(ARDUINO_GEN "Build ArduinoGen" OFF) | ||
# | ||
## Utilities | ||
#option(ROBOCLAW "Build Roboclaw" OFF) | ||
#option(PATHMAN "Build Pathman" OFF) | ||
#option(CMD_MESENGER "Build CmdMessenger" OFF) | ||
# | ||
## Testing | ||
#option(ENABLE_TESTING "Enable testing of the modules" OFF) | ||
# | ||
#add_subdirectory(external) | ||
# | ||
#if(ALL OR RIP OR CORE OR RIPCOM) | ||
# message("Adding appendages") | ||
# add_subdirectory(appendages) | ||
#endif() | ||
# | ||
#if(ALL OR ARDUINO_GEN) | ||
# message("Adding ArduinoGen") | ||
# add_subdirectory(arduino_gen) | ||
#endif() | ||
# | ||
#if(ALL OR RIP OR COMMUNICATION OR NAVIGATION OR NAVX OR PATHFINDER OR VISION OR FSM) | ||
# message("Adding RIP Core") | ||
# add_subdirectory(core) | ||
#endif() | ||
# | ||
#if(ALL OR RIPCOM) | ||
# message("Adding RIPCOM") | ||
# add_subdirectory(ripcom) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#Macro: make_outputs | ||
#Parameters: rootdir Used for making relative paths | ||
# files Files to be copied | ||
# outdir Destination directory for the files | ||
#Returns: outputs Destination file paths | ||
# | ||
#Use in conjunction with a custom target and add_dependencies to copy files | ||
# when they are changed. | ||
# | ||
#Example usage: | ||
# make_outputs("/home/user/project/data" | ||
# "${data_files}" | ||
# ${CMAKE_CURRENT_BINARY_DIR}/data | ||
# outputs) | ||
# add_executable(my_exe ... ${outputs}) | ||
macro(make_outputs rootdir files outdir outputs) | ||
set(_outputs "") | ||
foreach(file ${files}) | ||
if((NOT (IS_ABSOLUTE ${file})) AND (EXISTS "${rootdir}/${file}")) | ||
set(file "${rootdir}/${file}") #File is not absolute, but is relative to rootdir | ||
elseif((NOT (IS_ABSOLUTE ${file})) AND (NOT (EXISTS "${rootdir}/${file}"))) | ||
message(SEND_ERROR "Filepath '${file}' is not absolute and is not relative to '${rootdir}'") | ||
return() | ||
endif() | ||
file(RELATIVE_PATH file_name ${rootdir} ${file}) | ||
|
||
add_custom_command( | ||
OUTPUT ${outdir}/${file_name} | ||
COMMAND ${CMAKE_COMMAND} -E copy_if_different | ||
${file} | ||
${outdir}/${file_name} | ||
DEPENDS ${file} | ||
COMMENT "Copying ${file_name}" | ||
VERBATIM) | ||
list(APPEND _outputs ${outdir}/${file_name}) | ||
endforeach() | ||
set(${outputs} ${_outputs}) | ||
endmacro() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# RIP and Docker | ||
|
||
How to use Docker to manage building and testing RIP. | ||
|
||
## Installing Docker | ||
|
||
You need to be using a Linux system in order to use Docker, on Ubuntu | ||
|
||
If you're on Ubuntu there are docker packages available in the multiverse, but the CE version from [the official website](https://docs.docker.com/install/linux/docker-ce/ubuntu/) will perform much better and offers newer features. | ||
|
||
On MacOS, docker is available and will automatically run a Linux VM for you. On windows, you *can't* use the subsystem, since Docker depends on Linux kernel namespaces. | ||
|
||
Once installed, be sure to do whatever group management to your account so that you can run docker without the need of sudo. (For CE, this is something like `adduser $USER docker` and then rebooting.) | ||
|
||
## The Dependency Dockerfile | ||
|
||
Right now there are two dockerfiles, one that builds the dependencies (onto an Ubuntu base), and one that copies the source code of RIP. | ||
|
||
The dependency image is sourced from `external/Dockerfile` and is built automatically by dockerhub, as `utkrobotics/rip_deps`. | ||
|
||
To pull the latest deps image: | ||
|
||
```docker pull utkrobotics/rip_deps``` | ||
|
||
This includes g2o, eigen, suitesparse, etc, whatever is needed to build. | ||
|
||
## The building / interactive Dockerfile | ||
|
||
This is the Dockerfile in the root of the repo. | ||
|
||
It's based off the `rip_deps` image so it will have everything needed to build already installed. | ||
|
||
Upon building this container image, it will copy all the source code from your current directory into the container and set up an environment ready to run the build. | ||
|
||
To build the interactive container: | ||
|
||
``` | ||
docker build --tag utkrobotics/rip:$(git symbolic-ref HEAD|cut -d'/' -f3-|sed -e 's;/;_;') . | ||
``` | ||
|
||
This will create an image `utkrobotics/rip:yourbranch` which we can then run and create an instance of: | ||
|
||
``` | ||
# --rm : removes the container when you exit it | ||
# -t -i : creates an interactive container | ||
# zsh -l : the command to run inside the container (use whatever your preferred shell is) | ||
docker run --rm -t -i utkrobotics/rip:$(git symbolic-ref HEAD|cut -d'/' -f3-|sed -e 's;/;_;') zsh -l | ||
``` | ||
|
||
Now that you're inside the container, you can immediately build it, mess around, do whatever, because everything you do inside the container is removed when you exit it, and it never affects the code outside the container. | ||
|
||
Normally, what I do is: | ||
|
||
``` | ||
# build dat stuff | ||
./build-linux.sh | ||
# runs the built unit tests | ||
./travis/script.sh | ||
``` | ||
|
||
While you're in the container, feel free to do whatever you want, `rm -rf *`, or anything. Just remember if you make changes that you want to keep inside the container, you should make those same changes again outside the container on your local git repo. | ||
|
||
If you've made changed to your local git repo, you should run the build command again to update the image with your new changes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM utkrobotics/rip_deps:latest | ||
# $LUSER is user with 901:901 from home image | ||
|
||
# copy in RIP source code | ||
COPY . /home/${LUSER}/code/rip | ||
RUN sudo chown -R 901:901 /home/${LUSER}/code/rip | ||
|
||
WORKDIR /home/${LUSER}/code/rip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.