Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/rx7 #9

Merged
merged 54 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
b67e87f
Apply CARMA dockerization config
kjrush Feb 4, 2019
648e658
update with driver status and alert
aswath1 Feb 5, 2019
c5f68a4
updates and fix .h
aswath1 Feb 6, 2019
58c91e2
fix
aswath1 Feb 6, 2019
9afce43
version 1
aswath1 Feb 7, 2019
1cf0f59
Add sonarcloud and circle ci support to repo
Feb 8, 2019
748ebeb
add build dependencies
qswawrq Feb 8, 2019
3af78db
Update Dockerfile
qswawrq Feb 8, 2019
420f63b
Merge pull request #3 from usdot-fhwa-stol/feature/update-docker-depe…
Feb 8, 2019
b75b6dc
Updated image
Feb 8, 2019
6d47ef6
version 2
aswath1 Feb 8, 2019
5076f35
debug
Feb 8, 2019
03dc050
change arge order
Feb 8, 2019
8661b4c
Try memory limit
Feb 8, 2019
6653a26
Force cmake
Feb 8, 2019
f570746
undo changes
Feb 8, 2019
85b5941
Try -j arg
Feb 11, 2019
d9ccd6a
Fix branch name
Feb 11, 2019
c43a0fd
Fix bug in properties file
Feb 11, 2019
b71ea04
debug print
Feb 11, 2019
4eb4f23
Change print location
Feb 11, 2019
b5fed02
List remote branches
Feb 11, 2019
5ea24b4
More prints
Feb 11, 2019
1019a8c
Debug print
Feb 11, 2019
164f0f5
Remove arg
Feb 11, 2019
1dd4ea0
Hard code base
Feb 11, 2019
18cac1b
Try again
Feb 11, 2019
1cde6d1
Trying another change
Feb 11, 2019
bdaa04e
updated with status_camera class
aswath1 Feb 11, 2019
7f3a3df
update based on comments
aswath1 Feb 12, 2019
6972cd2
try colon
Feb 12, 2019
64919c7
Undo changes to config
Feb 12, 2019
5e7a21f
Merge pull request #4 from usdot-fhwa-stol/feature/sonarcloud_ci
Feb 12, 2019
e70f711
Merge branch 'develop' into feature/pub_sub_dis_alert
qswawrq Feb 12, 2019
80ad168
fix comment
Feb 12, 2019
c899157
Merge pull request #5 from usdot-fhwa-stol/feature/sonarcloud_ci
qswawrq Feb 13, 2019
476a232
new updates
aswath1 Feb 13, 2019
046a13a
final version
aswath1 Feb 13, 2019
4f2ea32
version 3
aswath1 Feb 15, 2019
0b8ab61
Merge branch 'feature/pub_sub_dis_alert' of https://github.com/usdot-…
aswath1 Feb 15, 2019
67f730e
version 4
aswath1 Feb 15, 2019
0bc4fd9
final version 0 sonarsmell
aswath1 Feb 15, 2019
e580f5a
test1
aswath1 Feb 15, 2019
4e53374
update on commit 4fe
aswath1 Feb 15, 2019
33a0431
Mako Driver
aswath1 Feb 15, 2019
0b8ada9
Merge pull request #2 from usdot-fhwa-stol/feature/pub_sub_dis_alert
qswawrq Feb 15, 2019
5dde73b
Merge branch 'develop' into feature/dockerization
kjrush Apr 12, 2019
0c4ffed
Merge pull request #1 from usdot-fhwa-stol/feature/dockerization
Apr 12, 2019
469c28b
Add code coverage to sonar cloud ci
May 8, 2019
a8b902b
Merge pull request #7 from usdot-fhwa-stol/feature/code_coverage
kjrush May 8, 2019
b631f7b
Add new docker version detection scripts
kjrush Jun 17, 2019
61c727f
Update build-image.sh to match main repo
kjrush Jun 17, 2019
d9da51c
Update with newest repo-agnostic docker tagging
kjrush Jun 17, 2019
a9dc407
Merge pull request #8 from usdot-fhwa-stol/feature/docker-refactor
kjrush Jun 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
version: 2

# Copyright (C) 2018-2019 LEIDOS.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#

# Configuration file for Circle CI
# CI will report failure if any executed command returns and error status
# Operations performed are as follows
# Build source code
# Run unit tests for C++ and Java
# Run static code analyzer for SourceCloud
# Upload test results
# Every run command should start with source ${INIT_ENV} to ensure all default dependancies are available
jobs:
build:
# Pull docker image from docker hub
# XTERM used for better catkin_make output
docker:
- image: usdotfhwastol/carma-base-ci:2.8.4
user: carma
environment:
TERM: xterm
INIT_ENV: /home/carma/.base-image/init-env.sh
# Set working directory
working_directory: "/opt/carma/"
# Pull code and execute tests
# Name of each run command defines purpose use
steps:
- run:
name: Create src folder
command: |
source ${INIT_ENV}
mkdir src
cd src
mkdir CARMAAvtVimbaDriver
mkdir CARMAMsgs
# Checkout PR branch
- checkout:
path: src/CARMAAvtVimbaDriver
- run:
name: Pull CARMAMsgs
command: |
source ${INIT_ENV}
git clone -b develop --depth 1 git@github.com:usdot-fhwa-stol/CARMAMsgs.git src/CARMAMsgs
- run:
name: Build Driver
command: |
source ${INIT_ENV}
build-wrapper-linux-x86-64 --out-dir /opt/carma/bw-output bash make_with_coverage.bash -m -e /opt/carma/ -o ./coverage_reports/gcov
- run:
name: Run C++ Tests
command: |
source ${INIT_ENV}
bash make_with_coverage.bash -t -e /opt/carma/ -o ./coverage_reports/gcov
# Run SonarCloud analysis
# PR Branchs and number extracted from Circle variables and github api
# Circle CI seems to make a change to the base branch, so we must fetch --force to ensure correct git file change stats
# SONAR_SCANNER_TOKEN MUST be secured as an environment variable in Circle CI NOT in this file.
# The following sonar settings MUST be set in SonarCloud UI NOT in this file
# sonar.pullrequest.provider
# sonar.pullrequest.github.endpoint
# sonar.pullrequest.github.token.secured
# sonar.pullrequest.github.repository
# Use -X on sonar-scanner to enable debug output
- run:
name: Run Sonar Scanner
command: |
source ${INIT_ENV}
if [ -z "${CIRCLE_PULL_REQUEST}" ]; then
echo "Non-PR Build Detected. Running analysis on ${CIRCLE_BRANCH}"
cd src/CARMAAvtVimbaDriver
sonar-scanner -Dproject.settings=.sonarqube/sonar-scanner.properties -Dsonar.login=${SONAR_SCANNER_TOKEN}
exit 0;
fi
echo "PR branch ${CIRCLE_BRANCH}"
echo "Repo name ${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}"
echo "URL ${CIRCLE_PULL_REQUEST}"
export PR_NUM=`echo ${CIRCLE_PULL_REQUEST} | cut -d'/' -f7`
echo "PR number ${PR_NUM}"
export BASE_BRANCH_URL="https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls/${PR_NUM}"
export TARGET_BRANCH=$(curl "$BASE_BRANCH_URL" | jq '.base.ref' | tr -d '"')
echo "Target Branch = ${TARGET_BRANCH}"
cd src/CARMAAvtVimbaDriver
git fetch --force origin ${TARGET_BRANCH}:${TARGET_BRANCH}
sonar-scanner -Dproject.settings=.sonarqube/sonar-scanner.properties -Dsonar.login=${SONAR_SCANNER_TOKEN} -Dsonar.pullrequest.base=${TARGET_BRANCH} -Dsonar.pullrequest.branch=${CIRCLE_BRANCH} -Dsonar.pullrequest.key=${PR_NUM}
27 changes: 27 additions & 0 deletions .sonarqube/sonar-scanner.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (C) 2018-2019 LEIDOS.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# Configuration file for Sonar Scanner used for CI

sonar.projectKey=usdot-fhwa-stol_CARMAAvtVimbaDriver
sonar.organization=usdot-fhwa-stol
sonar.cfamily.build-wrapper-output=/opt/carma/bw-output
sonar.host.url=https://sonarcloud.io
sonar.sources=src/
sonar.cfamily.gcov.reportsPath=/opt/carma/coverage_reports/gcov
sonar.tests=test/
# Set Git as SCM sensor
sonar.scm.disabled=false
sonar.scm.enabled=true
sonar.scm.provider=git
25 changes: 20 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project(avt_vimba_camera)

find_package(catkin REQUIRED COMPONENTS
#libvimba
cav_msgs
camera_info_manager
diagnostic_updater
dynamic_reconfigure
Expand All @@ -28,8 +29,9 @@ generate_dynamic_reconfigure_options(
)

catkin_package(
#LIBRARIES ${PROJECT_NAME}
INCLUDE_DIRS include
CATKIN_DEPENDS camera_info_manager diagnostic_updater dynamic_reconfigure image_geometry image_transport roscpp sensor_msgs std_msgs polled_camera
CATKIN_DEPENDS camera_info_manager diagnostic_updater dynamic_reconfigure image_geometry image_transport roscpp sensor_msgs std_msgs polled_camera cav_msgs
)

###########
Expand Down Expand Up @@ -58,6 +60,7 @@ function(add_dependencies_and_linkings arg)
add_dependencies(${arg}
${PROJECT_NAME}_gencfg
#${libvimba_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
)

if("${ARCH}" STREQUAL i386)
Expand Down Expand Up @@ -94,7 +97,8 @@ add_executable(mono_camera_node
src/mono_camera.cpp
src/avt_vimba_camera.cpp
src/frame_observer.cpp
)
src/status_camera.cpp
)

add_dependencies_and_linkings(mono_camera_node)

Expand All @@ -103,23 +107,29 @@ add_executable(stereo_camera_node
src/stereo_camera.cpp
src/avt_vimba_camera.cpp
src/frame_observer.cpp
)
)

add_dependencies_and_linkings(stereo_camera_node)

add_executable(sync_node
src/nodes/sync_node.cpp
src/sync.cpp
)
)

add_dependencies_and_linkings(sync_node)

add_library(avt_vimba_camera_lib
src/status_camera.cpp
)
add_dependencies(avt_vimba_camera_lib ${catkin_EXPORTED_TARGETS})

add_library(avt_camera_nodelets
src/nodes/mono_camera_nodelet.cpp
src/nodes/stereo_camera_nodelet.cpp
src/stereo_camera.cpp
src/avt_vimba_camera.cpp
src/frame_observer.cpp)

add_dependencies_and_linkings(avt_camera_nodelets)

#############
Expand All @@ -143,7 +153,7 @@ install(DIRECTORY include
## Mark other files for installation (e.g. launch and bag files, etc.)
install(FILES
plugins.xml
launch/mono_camera.launch
#launch/mono_camera.launch
launch/mono_camera_nodelet.launch
launch/stereo_camera_one_node.launch
launch/stereo_camera_two_nodes.launch
Expand Down Expand Up @@ -179,3 +189,8 @@ elseif("${ARCH}" STREQUAL armv8)
DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
endif()
#Test
## gtest C++ Framework
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
catkin_add_gtest(${PROJECT_NAME}-test test/status_mako_camera_test.cpp)
target_link_libraries(${PROJECT_NAME}-test avt_vimba_camera_lib ${catkin_LIBRARIES})
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (C) 2018-2019 LEIDOS.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

FROM usdotfhwastol/carma-base:2.8.3 as setup

RUN mkdir ~/src
COPY --chown=carma . /home/carma/src/
RUN ~/src/docker/checkout.sh
RUN ~/src/docker/install.sh

FROM usdotfhwastol/carma-base:2.8.3

ARG BUILD_DATE="NULL"
ARG VERSION="NULL"
ARG VCS_REF="NULL"

LABEL org.label-schema.schema-version="1.0"
LABEL org.label-schema.name="carma-avt-vimba-driver"
LABEL org.label-schema.description="AVT VIMBA vision driver + driver wrapper for the CARMA Platform"
LABEL org.label-schema.vendor="Leidos"
LABEL org.label-schema.version=${VERSION}
LABEL org.label-schema.url="https://highways.dot.gov/research/research-programs/operations/CARMA"
LABEL org.label-schema.vcs-url="https://github.com/usdot-fhwa-stol/CARMAAvtVimbaDriver/"
LABEL org.label-schema.vcs-ref=${VCS_REF}
LABEL org.label-schema.build-date=${BUILD_DATE}

COPY --from=setup /home/carma/install /opt/carma/app/bin
RUN sudo chmod -R +x /opt/carma/app/bin

CMD [ "wait-for-it.sh", "localhost:11311", "--", "roslaunch", "avt_vimba_camera", "mono_camera.launch", "remap_ns:=/saxton_cav/drivers" ]
80 changes: 80 additions & 0 deletions docker/build-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/bash

# Copyright (C) 2018-2019 LEIDOS.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

USERNAME=usdotfhwastol

cd "$(dirname "$0")"
IMAGE=$(./get-package-name.sh | tr '[:upper:]' '[:lower:]')

echo ""
echo "##### $IMAGE Docker Image Build Script #####"
echo ""

while [[ $# -gt 0 ]]; do
arg="$1"
case $arg in
-v|--version)
COMPONENT_VERSION_STRING="$2"
shift
shift
;;
--system-release)
SYSTEM_RELEASE=true
shift
;;
-p|--push)
PUSH=true
shift
;;
esac
done

if [[ -z "$COMPONENT_VERSION_STRING" ]]; then
COMPONENT_VERSION_STRING=$("./get-component-version.sh")
fi

echo "Building docker image for $IMAGE version: $COMPONENT_VERSION_STRING"
echo "Final image name: $USERNAME/$IMAGE:$COMPONENT_VERSION_STRING"

cd ..
docker build --no-cache -t $USERNAME/$IMAGE:$COMPONENT_VERSION_STRING \
--build-arg VERSION="$COMPONENT_VERSION_STRING" \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` .

TAGS=()
TAGS+=("$USERNAME/$IMAGE:$COMPONENT_VERSION_STRING")

docker tag $USERNAME/$IMAGE:$COMPONENT_VERSION_STRING $USERNAME/$IMAGE:latest
TAGS+=("$USERNAME/$IMAGE:latest")

echo "Tagged $USERNAME/$IMAGE:$COMPONENT_VERSION_STRING as $USERNAME/$IMAGE:latest"

if [ "$SYSTEM_RELEASE" = true ]; then
SYSTEM_VERSION_STRING=$("./get-system-version.sh")
docker tag $USERNAME/$IMAGE:$COMPONENT_VERSION_STRING $USERNAME/$IMAGE:$SYSTEM_VERSION_STRING
echo "Tagged $USERNAME/$IMAGE:$COMPONENT_VERSION_STRING as $USERNAME/$IMAGE:$SYSTEM_VERSION_STRING"
TAGS+=("$USERNAME/$IMAGE:$SYSTEM_VERSION_STRING")
fi

if [ "$PUSH" = true ]; then
for tag in $TAGS; do
docker push "${tag}"
done
fi

echo ""
echo "##### $IMAGE Docker Image Build Done! #####"
21 changes: 21 additions & 0 deletions docker/checkout.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Copyright (C) 2018-2019 LEIDOS.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# CARMA packages checkout script

set -ex

git clone https://github.com/usdot-fhwa-stol/CARMAMsgs.git ~/src/CARMAMsgs
21 changes: 21 additions & 0 deletions docker/get-component-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Copyright (C) 2018-2019 LEIDOS.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

cd "$(dirname "$0")"
cd ..
COMPONENT_TAG_PREFIX="${PWD##*/}"
git describe --all --match="$COMPONENT_TAG_PREFIX*" --always --dirty="-SNAPSHOT" | awk -F "/" '{print $NF}' | sed "s/$COMPONENT_TAG_PREFIX\_//"

Loading