Skip to content

Commit 5a3a8a3

Browse files
authored
1 parent d638f65 commit 5a3a8a3

24 files changed

+4692
-2
lines changed

.clang-format

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
Language: Proto
3+
BasedOnStyle: Google
4+
---
5+
Language: Cpp
6+
AccessModifierOffset: -4
7+
AlignAfterOpenBracket: false
8+
AlignConsecutiveAssignments: false
9+
AlignConsecutiveDeclarations: false
10+
AlignEscapedNewlinesLeft: false
11+
AlignOperands: true
12+
AlignTrailingComments: true
13+
AllowAllParametersOfDeclarationOnNextLine: false
14+
AllowShortBlocksOnASingleLine: false
15+
AllowShortCaseLabelsOnASingleLine: false
16+
AllowShortFunctionsOnASingleLine: Inline
17+
AllowShortIfStatementsOnASingleLine: false
18+
AllowShortLoopsOnASingleLine: false
19+
AlwaysBreakAfterDefinitionReturnType: None
20+
AlwaysBreakAfterReturnType: None
21+
AlwaysBreakBeforeMultilineStrings: true
22+
AlwaysBreakTemplateDeclarations: true
23+
BasedOnStyle: WebKit
24+
BinPackArguments: true
25+
BinPackParameters: true
26+
BreakBeforeBraces: Mozilla
27+
BreakBeforeTernaryOperators: true
28+
BreakConstructorInitializersBeforeComma: true
29+
ColumnLimit: 100
30+
CommentPragmas: "^ IWYU pragma:"
31+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
32+
ConstructorInitializerIndentWidth: 0
33+
ContinuationIndentWidth: 4
34+
Cpp11BracedListStyle: true
35+
DerivePointerAlignment: false
36+
DisableFormat: false
37+
ExperimentalAutoDetectBinPacking: false
38+
ForEachMacros: [foreach, Q_FOREACH, BOOST_FOREACH]
39+
IndentCaseLabels: true
40+
IndentWidth: 4
41+
IndentWrappedFunctionNames: false
42+
KeepEmptyLinesAtTheStartOfBlocks: true
43+
MacroBlockBegin: ""
44+
MacroBlockEnd: ""
45+
MaxEmptyLinesToKeep: 1
46+
NamespaceIndentation: None
47+
PenaltyBreakBeforeFirstCallParameter: 100
48+
PenaltyBreakComment: 300
49+
PenaltyBreakFirstLessLess: 120
50+
PenaltyBreakString: 1000
51+
PenaltyExcessCharacter: 10000
52+
PointerAlignment: Left
53+
ReflowComments: true
54+
SortIncludes: false
55+
SpaceAfterCStyleCast: false
56+
SpaceBeforeAssignmentOperators: true
57+
SpaceBeforeParens: ControlStatements
58+
SpaceInEmptyParentheses: false
59+
SpacesInContainerLiterals: true
60+
SpacesInCStyleCastParentheses: false
61+
SpacesInParentheses: false
62+
SpacesInSquareBrackets: false
63+
Standard: Cpp11
64+
TabWidth: 4
65+
UseTab: Never
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug to help us improve
4+
title: "[BUG] "
5+
type: Bug
6+
labels: bug
7+
assignees: pzhu-flexiv
8+
9+
---
10+
11+
## Version info
12+
13+
- DRDK: [e.g. v1.0]
14+
- Robot software: [e.g. v3.9]
15+
- OS: [e.g. Ubuntu 22.04, x86_64]
16+
17+
## How urgent is this bug? Have you found any workarounds?
18+
19+
On a scale of 1 to 10.
20+
21+
## Describe the issue and expected behavior
22+
23+
The issue is ...
24+
The correct behavior you expect is ...
25+
26+
## Steps to reproduce
27+
28+
1. '....'
29+
2. '....'
30+
3. '....'
31+
4. See error
32+
33+
## Screenshots
34+
35+
If applicable, add screenshots to help explain your issue.
36+
37+
## Additional context
38+
39+
Add any other context about the issue.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Feature Request
3+
about: Suggest a new feature
4+
title: "[FEATURE] "
5+
type: Feature
6+
labels: enhancement
7+
assignees: pzhu-flexiv
8+
9+
---
10+
11+
## How urgent is this feature?
12+
13+
On a scale of 1 to 10.
14+
15+
## Is this feature request related to a problem?
16+
17+
This new feature is needed so that ... can be solved.
18+
19+
## Describe the solution you'd like
20+
21+
What you want to happen.
22+
23+
## Describe alternatives you've considered
24+
25+
Any alternative solutions or workarounds you've considered.
26+
27+
## Additional context
28+
29+
Add any other context or screenshots about this feature.

.github/ISSUE_TEMPLATE/question.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Question
3+
about: Ask a question related to DRDK
4+
title: "[QUESTION] "
5+
type: Question
6+
labels: help wanted
7+
assignees: pzhu-flexiv
8+
9+
---
10+
11+
## There might already be an answer to your question
12+
13+
Someone might have asked similar questions before, you can search in the [Issues](https://github.com/flexivrobotics/flexiv_drdk/issues?q=type%3AQuestion) tab.
14+
15+
## Not sure how to get started and write a working DRDK program?
16+
17+
The usage of Flexiv DRDK is similar to Flexiv RDK, thus you can take a look at the [C++ examples](https://github.com/flexivrobotics/flexiv_rdk/tree/main/example) or [Python examples](https://github.com/flexivrobotics/flexiv_rdk/tree/main/example_py) from Flexiv RDK to get started.
18+
19+
## Is this related to a specific version of DRDK?
20+
21+
If yes, please specify.
22+
23+
## Please describe your question
24+
25+
Texts, screenshots, links, code blocks ...

.github/workflows/cmake.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CMake
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
env:
11+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
12+
BUILD_TYPE: Release
13+
14+
jobs:
15+
build-ubuntu-22:
16+
# GitHub-hosted Ubuntu 22.04 runner
17+
runs-on: ubuntu-22.04
18+
# Use shared steps
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: ./.github/workflows/shared_steps
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Shared Build Steps"
2+
runs:
3+
using: "composite"
4+
# Note: working directory will be reset to the repo root for each new step
5+
steps:
6+
# Build and install all dependencies to RDK installation directory.
7+
- name: Build and install dependencies
8+
shell: bash
9+
run: |
10+
pwd
11+
cd thirdparty
12+
bash build_and_install_dependencies.sh ~/drdk_install 4
13+
14+
# Configure CMake, then build and install flexiv_rdk library to RDK installation directory.
15+
- name: Build and install library
16+
shell: bash
17+
run: |
18+
pwd
19+
mkdir -p build && cd build
20+
cmake .. -DCMAKE_INSTALL_PREFIX=~/drdk_install
21+
cmake --build . --target install --config Release
22+
23+
# Find and link to flexiv_rdk library, then build all example programs.
24+
- name: Build examples
25+
shell: bash
26+
run: |
27+
pwd
28+
cd example
29+
mkdir -p build && cd build
30+
cmake .. -DCMAKE_PREFIX_PATH=~/drdk_install
31+
cmake --build . --config Release -j 4

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.vscode
2+
.vs
3+
.DS_Store
4+
config.h
5+
build*/
6+
install/
7+
cloned/
8+
html/
9+
__pycache__

CMakeLists.txt

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
cmake_minimum_required(VERSION 3.16.3)
2+
3+
# ===================================================================
4+
# PROJECT SETUP
5+
# ===================================================================
6+
project(flexiv_drdk VERSION 1.0.0)
7+
8+
# Configure build type
9+
if(NOT CMAKE_BUILD_TYPE)
10+
set(CMAKE_BUILD_TYPE Release CACHE STRING "CMake build type" FORCE)
11+
endif()
12+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" "RelWithDebInfo")
13+
14+
# Set static library according to platform
15+
message(STATUS "OS: ${CMAKE_SYSTEM_NAME}")
16+
message(STATUS "Processor: ${CMAKE_SYSTEM_PROCESSOR}")
17+
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
18+
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
19+
set(RDK_STATIC_LIB "libflexiv_drdk.x86_64-linux-gnu.a")
20+
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
21+
set(RDK_STATIC_LIB "libflexiv_drdk.aarch64-linux-gnu.a")
22+
else()
23+
message(FATAL_ERROR "Linux with ${CMAKE_SYSTEM_PROCESSOR} processor is currently not supported.")
24+
endif()
25+
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
26+
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64")
27+
set(RDK_STATIC_LIB "libflexiv_drdk.arm64-darwin.a")
28+
else()
29+
message(FATAL_ERROR "Mac with ${CMAKE_SYSTEM_PROCESSOR} processor is currently not supported.")
30+
endif()
31+
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
32+
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "AMD64")
33+
set(RDK_STATIC_LIB "flexiv_drdk.win_amd64.lib")
34+
else()
35+
message(FATAL_ERROR "Windows with ${CMAKE_SYSTEM_PROCESSOR} processor is currently not supported.")
36+
endif()
37+
endif()
38+
39+
# ===================================================================
40+
# PROJECT DEPENDENCIES
41+
# ===================================================================
42+
# Threads
43+
set(THREADS_PREFER_PTHREAD_FLAG ON)
44+
find_package(Threads REQUIRED)
45+
if(Threads_FOUND)
46+
message(STATUS "Found Threads: HAVE_PTHREAD = ${THREADS_HAVE_PTHREAD_ARG}")
47+
endif()
48+
49+
# Flexiv RDK
50+
find_package(flexiv_rdk REQUIRED)
51+
if(flexiv_rdk_FOUND)
52+
message(STATUS "Found flexiv_rdk: ${flexiv_rdk_DIR}")
53+
endif()
54+
55+
# ===================================================================
56+
# CREATE LIBRARY
57+
# ===================================================================
58+
# Create an INTERFACE library with no source file to compile
59+
add_library(${PROJECT_NAME} INTERFACE)
60+
61+
# Create an alias of the library using flexiv namespace,
62+
# to imitate the install target which uses flexiv namespace.
63+
add_library(flexiv::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
64+
65+
target_include_directories(${PROJECT_NAME} INTERFACE
66+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
67+
$<INSTALL_INTERFACE:include>
68+
)
69+
70+
target_link_libraries(${PROJECT_NAME} INTERFACE
71+
${CMAKE_CURRENT_SOURCE_DIR}/lib/${RDK_STATIC_LIB}
72+
Threads::Threads
73+
flexiv::flexiv_rdk
74+
)
75+
76+
# Use moderate compiler warning option
77+
if(CMAKE_HOST_UNIX)
78+
target_compile_options(${PROJECT_NAME} INTERFACE -Wall -Wextra)
79+
else()
80+
target_compile_options(${PROJECT_NAME} INTERFACE /W1)
81+
endif()
82+
83+
# Install the INTERFACE library
84+
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/FlexivInstallLibrary.cmake)
85+
FlexivInstallLibrary()

0 commit comments

Comments
 (0)