-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
creat a new branch for plcopen motion control
- Loading branch information
qianyi
committed
Sep 18, 2021
0 parents
commit cda4492
Showing
86 changed files
with
17,464 additions
and
0 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,96 @@ | ||
# BSD 3-Clause License | ||
# | ||
# Copyright (c) 2008-2013, Willow Garage, Inc. | ||
# All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# | ||
# * Redistributions of source code must retain the above copyright notice, this | ||
# list of conditions and the following disclaimer. | ||
# | ||
# * Redistributions in binary form must reproduce the above copyright notice, | ||
# this list of conditions and the following disclaimer in the documentation | ||
# and/or other materials provided with the distribution. | ||
# | ||
# * Neither the name of the copyright holder nor the names of its | ||
# contributors may be used to endorse or promote products derived from | ||
# this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
--- | ||
BasedOnStyle: Google | ||
AccessModifierOffset: -2 | ||
ConstructorInitializerIndentWidth: 2 | ||
AlignEscapedNewlinesLeft: false | ||
AlignTrailingComments: true | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: None | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakTemplateDeclarations: true | ||
AlwaysBreakBeforeMultilineStrings: false | ||
BreakBeforeBinaryOperators: false | ||
BreakBeforeTernaryOperators: false | ||
BreakConstructorInitializersBeforeComma: true | ||
BinPackParameters: true | ||
ColumnLimit: 80 | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
DerivePointerBinding: false | ||
PointerBindsToType: true | ||
ExperimentalAutoDetectBinPacking: false | ||
IndentCaseLabels: true | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCSpaceBeforeProtocolList: true | ||
PenaltyBreakBeforeFirstCallParameter: 19 | ||
PenaltyBreakComment: 60 | ||
PenaltyBreakString: 100 | ||
PenaltyBreakFirstLessLess: 1000 | ||
PenaltyExcessCharacter: 1000 | ||
PenaltyReturnTypeOnItsOwnLine: 70 | ||
SpacesBeforeTrailingComments: 2 | ||
Cpp11BracedListStyle: false | ||
Standard: Auto | ||
IndentWidth: 2 | ||
TabWidth: 2 | ||
UseTab: Never | ||
IndentFunctionDeclarationAfterType: false | ||
SpacesInParentheses: false | ||
SpacesInAngles: false | ||
SpaceInEmptyParentheses: false | ||
SpacesInCStyleCastParentheses: false | ||
SpaceAfterControlStatementKeyword: true | ||
SpaceBeforeAssignmentOperators: true | ||
ContinuationIndentWidth: 4 | ||
SortIncludes: false | ||
SpaceAfterCStyleCast: false | ||
|
||
# Configure each individual brace in BraceWrapping | ||
BreakBeforeBraces: Custom | ||
|
||
# Control of individual brace wrapping cases | ||
BraceWrapping: { | ||
AfterClass: 'true' | ||
AfterControlStatement: 'true' | ||
AfterEnum : 'true' | ||
AfterFunction : 'true' | ||
AfterNamespace : 'true' | ||
AfterStruct : 'true' | ||
AfterUnion : 'true' | ||
BeforeCatch : 'true' | ||
BeforeElse : 'true' | ||
IndentBraces : 'false' | ||
} | ||
... |
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,14 @@ | ||
# VScode files | ||
.vscode | ||
|
||
# Build files | ||
build | ||
|
||
# Image files | ||
*.png | ||
|
||
# Generated documentation files | ||
doc | ||
|
||
# Eigen files | ||
*Eigen |
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,103 @@ | ||
stages: | ||
- build | ||
- deploy | ||
- cleanup | ||
|
||
before_script: | ||
- PLC_HEAD=$(git rev-parse HEAD) | ||
- echo "$PLC_HEAD" | ||
- PLC_URL=$(git remote get-url origin) | ||
- echo $PLC_URL > url.txt | ||
- sed -i "s/gitlab-ci-token/git/1" url.txt | ||
- sed -i "s/git.*@/git@/g" url.txt | ||
- sed -i "s/https/git/1" url.txt | ||
- sed -i "s/com/com:29418/1" url.txt | ||
- PLC_URL=$(cat url.txt) | ||
- echo $PLC_URL | ||
- mkdir -p ${HOME}/.ssh | ||
- eval $(ssh-agent -s) | ||
- ssh-add <(echo "$SSH_PRIVATE_KEY") | ||
- rm -rf ${HOME}/.ssh/known_hosts && touch ${HOME}/.ssh/known_hosts | ||
- ssh-keyscan -p 29418 -t ed25519 'gitlab.devtools.intel.com' >> ${HOME}/.ssh/known_hosts | ||
- cat ${HOME}/.ssh/known_hosts | ||
|
||
# Build environment already set up at /home/gitlab-runner/tgr-build-setup | ||
build-bare-metal: | ||
stage: build | ||
script: | ||
# Pull leatest ECS build setup `tgr-build-setup` | ||
- cd ${HOME}/tgr-build-setup | ||
- git reset --hard | ||
- git pull origin master | ||
# Clear last time change to `meta-plcopen` | ||
- cd ./build/ecs-base-poky/layers/meta-plcopen | ||
- git reset --hard | ||
- cd ./recipes-plcopen/plcopen-motion-control | ||
# Change git source of `plcopen_motion_control` | ||
- number=`sed -n '/SRC_URI/=' ./plcopen-motion-control_internal.inc` | ||
- echo $number | ||
- sed -i "${number}a SRC_URI = \"$PLC_URL;protocol=ssh;destsuffix=git/plcopen_motion_control\"" ./plcopen-motion-control_internal.inc | ||
- sed -i "${number}d" ./plcopen-motion-control_internal.inc | ||
# Change git commit id of `plcopen_motion_control` | ||
- number=`sed -n '/SRCREV/=' ./plcopen-motion-control_internal.inc` | ||
- echo $number | ||
- sed -i "${number}a SRCREV = \"$PLC_HEAD\"" ./plcopen-motion-control_internal.inc | ||
- sed -i "${number}d" ./plcopen-motion-control_internal.inc | ||
# Build image `tgr-image-bare-metal` | ||
- cd ${HOME}/tgr-build-setup/build/ecs-base-poky/poky/ | ||
- source oe-init-build-env ../build/ | ||
- bitbake ecs-image-base-poky | ||
only: | ||
refs: | ||
- master | ||
|
||
# Build environment already set up at /home/gitlab-runner/tgr-build-setup | ||
build-bare-metal-xenomai: | ||
stage: build | ||
script: | ||
# Pull leatest ECS build setup `tgr-build-setup` | ||
- cd ${HOME}/tgr-build-setup | ||
- git reset --hard | ||
- git pull origin master | ||
# Clear last time change to `meta-plcopen` | ||
- cd ./build/ecs-xenomai-poky/layers/meta-plcopen | ||
- git reset --hard | ||
- cd ./recipes-plcopen/plcopen-motion-control | ||
# Change git source of `plcopen_motion_control` | ||
- number=`sed -n '/SRC_URI/=' ./plcopen-motion-control_internal.inc` | ||
- echo $number | ||
- sed -i "${number}a SRC_URI = \"$PLC_URL;protocol=ssh;destsuffix=git/plcopen_motion_control\"" ./plcopen-motion-control_internal.inc | ||
- sed -i "${number}d" ./plcopen-motion-control_internal.inc | ||
# Change git commit id of `plcopen_motion_control` | ||
- number=`sed -n '/SRCREV/=' ./plcopen-motion-control_internal.inc` | ||
- echo $number | ||
- sed -i "${number}a SRCREV = \"$PLC_HEAD\"" ./plcopen-motion-control_internal.inc | ||
- sed -i "${number}d" ./plcopen-motion-control_internal.inc | ||
# Build image `tgr-image-bare-metal-xenomai` | ||
- cd ${HOME}/tgr-build-setup/build/ecs-xenomai-poky/poky/ | ||
- source oe-init-build-env ../build/ | ||
- bitbake ecs-image-xenomai-poky | ||
only: | ||
refs: | ||
- master | ||
|
||
pages: | ||
stage: deploy | ||
before_script: | ||
- sudo apt-get update -qq | ||
- sudo apt-get -qq install doxygen | ||
- sudo apt-get -qq install graphviz | ||
- sudo apt-get -qq install libeigen3-dev | ||
script: | ||
- pwd | ||
- doxygen ./Doxyfile 2>&1 >/dev/null | ||
- mkdir .public | ||
- cp -r build/html/. .public | ||
- mv .public public | ||
- ls public/ | ||
artifacts: | ||
paths: | ||
- public | ||
only: | ||
refs: | ||
- master |
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,57 @@ | ||
sudo: required | ||
dist: bionic | ||
services: | ||
- docker | ||
language: cpp | ||
compiler: gcc | ||
|
||
notifications: | ||
email: | ||
recipients: | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- doxygen | ||
|
||
before_install: | ||
- sudo apt-get update -qq | ||
- sudo apt-get -qq install graphviz | ||
- sudo apt-get -qq install libeigen3-dev | ||
- sudo apt-get -qq install python-matplotlib python-numpy python2.7-dev python-tk | ||
- python -c 'import matplotlib.pyplot' | ||
|
||
before_script: | ||
- export CXXFLAGS="-std=c++11" | ||
- cd ~ && git clone https://github.com/google/googletest.git | ||
- cd googletest && mkdir build | ||
- cd build | ||
- cmake .. -DBUILD_SHARED_LIBS=ON | ||
- sudo make install | ||
- echo $PWD | ||
|
||
script: | ||
- cd $TRAVIS_BUILD_DIR | ||
- mkdir build | ||
- cd build | ||
- cmake .. -DTEST=ON | ||
- make | ||
- ./function_block_test | ||
- ./online_scurve_test | ||
- ./offline_scurve_test | ||
- ./planner_test | ||
- cd .. | ||
- rm -rf build | ||
- doxygen ./Doxyfile | ||
|
||
after_success: | ||
- touch build/html/.nojekyll | ||
|
||
deploy: | ||
# Deploy to gh-pages branch | ||
provider: pages | ||
skip-cleanup: true | ||
github-token: $GITHUB_TOKEN | ||
local_dir: ./build/html | ||
on: | ||
branch: master |
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,93 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(RTmotion VERSION 0.1.0 LANGUAGES CXX) | ||
|
||
# Default to C++14 | ||
if(NOT CMAKE_CXX_STANDARD) | ||
set(CMAKE_CXX_STANDARD 14) | ||
endif() | ||
|
||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
add_compile_options(-Wall -Wextra -Wpedantic -Wno-unused-parameter -Wno-unused-function -Wno-unused-but-set-variable) | ||
endif() | ||
|
||
# Default options | ||
option(COBALT "Enable compiling with Xenomai" OFF) | ||
option(TEST "Enable unit test" OFF) | ||
option(PLOT "Enable matplotlib c++" OFF) | ||
option(URANUS "Enable test on Uranus code" OFF) | ||
option(TIME "Record time stamps" OFF) | ||
option(DEBUG "Enable debug print" OFF) | ||
|
||
# Default file directory path | ||
set(URANUS_DIR "/usr/local/Uranus" CACHE PATH "Root directory of Uranus.") | ||
set(XENOMAI_DIR "/usr/xenomai" CACHE PATH "Root directory of Xenomai.") | ||
set(XENO_BINDIR "${XENOMAI_DIR}/bin" CACHE PATH "Root directory of Xenomai.") | ||
set(SYSTEM_ROOT "/usr" CACHE PATH "System root directory used to find Python") | ||
|
||
if(TIME) | ||
add_definitions(-DTIME) | ||
add_executable(rdtsc_test test/rdtsc_test.cpp) | ||
add_executable(get_clock_time_test test/get_clock_time_test.cpp) | ||
endif(TIME) | ||
|
||
if(DEBUG) | ||
add_definitions(-DDEBUG) | ||
endif(DEBUG) | ||
|
||
# Set C C++ flags | ||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -fPIC -ggdb3") | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -std=c++14") | ||
|
||
# Set default install directories | ||
SET(CMAKE_INSTALL_INCLUDEDIR include) | ||
SET(CMAKE_INSTALL_LIBDIR lib) | ||
SET(CMAKE_INSTALL_BINDIR bin) | ||
|
||
# INSTALL_BINDIR is used at command line to define executable output directory | ||
if(NOT INSTALL_BINDIR) | ||
set(INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR}) | ||
endif() | ||
|
||
# Find Eigen3 | ||
find_package(Eigen3 REQUIRED) | ||
include_directories( | ||
include | ||
${EIGEN3_INCLUDE_DIRS} | ||
) | ||
|
||
find_package(ruckig REQUIRED) | ||
|
||
# Enable matplotlib | ||
if(PLOT) | ||
add_definitions(-DPLOT) | ||
add_definitions(-DWITHOUT_NUMPY) | ||
|
||
find_package(PythonLibs REQUIRED) | ||
message(STATUS "PYTHON_INCLUDE_DIRS: ${PYTHON_INCLUDE_DIRS}") | ||
message(STATUS "PYTHON_LIBRARIES: ${PYTHON_LIBRARIES}") | ||
endif(PLOT) | ||
|
||
# Add Xenomai compile flags | ||
if (COBALT) | ||
execute_process(COMMAND ${XENO_BINDIR}/xeno-config --skin posix --cc OUTPUT_VARIABLE XENO_CC OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
execute_process(COMMAND ${XENO_BINDIR}/xeno-config --skin posix --cflags OUTPUT_VARIABLE XENO_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
execute_process(COMMAND ${XENO_BINDIR}/xeno-config --skin posix --auto-init-solib --ldflags OUTPUT_VARIABLE XENO_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
set(CMAKE_CC "${CMAKE_CC} ${XENO_CC}") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${XENO_CFLAGS}") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${XENO_LDFLAGS}") | ||
|
||
message(STATUS "XENO_CC: ${XENO_CC}") | ||
message(STATUS "XENO_CFLAGS: ${XENO_CFLAGS}") | ||
message(STATUS "XENO_LDFLAGS: ${XENO_LDFLAGS}") | ||
endif(COBALT) | ||
|
||
add_subdirectory(src) | ||
|
||
if (TEST) | ||
add_subdirectory(test) | ||
endif(TEST) | ||
|
||
install( | ||
DIRECTORY include/${PROJECT_NAME} | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
) |
Oops, something went wrong.