Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
65 changes: 65 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
Language: Proto
BasedOnStyle: Google
---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BasedOnStyle: WebKit
BinPackArguments: true
BinPackParameters: true
BreakBeforeBraces: Mozilla
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
ColumnLimit: 100
CommentPragmas: "^ IWYU pragma:"
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [foreach, Q_FOREACH, BOOST_FOREACH]
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 100
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 10000
PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Bug Report
about: Report a bug to help us improve
title: "[BUG] "
type: Bug
labels: bug
assignees: pzhu-flexiv

---

## Version info

- DRDK: [e.g. v1.0]
- Robot software: [e.g. v3.9]
- OS: [e.g. Ubuntu 22.04, x86_64]

## How urgent is this bug? Have you found any workarounds?

On a scale of 1 to 10.

## Describe the issue and expected behavior

The issue is ...
The correct behavior you expect is ...

## Steps to reproduce

1. '....'
2. '....'
3. '....'
4. See error

## Screenshots

If applicable, add screenshots to help explain your issue.

## Additional context

Add any other context about the issue.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Feature Request
about: Suggest a new feature
title: "[FEATURE] "
type: Feature
labels: enhancement
assignees: pzhu-flexiv

---

## How urgent is this feature?

On a scale of 1 to 10.

## Is this feature request related to a problem?

This new feature is needed so that ... can be solved.

## Describe the solution you'd like

What you want to happen.

## Describe alternatives you've considered

Any alternative solutions or workarounds you've considered.

## Additional context

Add any other context or screenshots about this feature.
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Question
about: Ask a question related to DRDK
title: "[QUESTION] "
type: Question
labels: help wanted
assignees: pzhu-flexiv

---

## There might already be an answer to your question

Someone might have asked similar questions before, you can search in the [Issues](https://github.com/flexivrobotics/flexiv_drdk/issues?q=type%3AQuestion) tab.

## Not sure how to get started and write a working DRDK program?

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.

## Is this related to a specific version of DRDK?

If yes, please specify.

## Please describe your question

Texts, screenshots, links, code blocks ...
21 changes: 21 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CMake

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build-ubuntu-22:
# GitHub-hosted Ubuntu 22.04 runner
runs-on: ubuntu-22.04
# Use shared steps
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/shared_steps
31 changes: 31 additions & 0 deletions .github/workflows/shared_steps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Shared Build Steps"
runs:
using: "composite"
# Note: working directory will be reset to the repo root for each new step
steps:
# Build and install all dependencies to RDK installation directory.
- name: Build and install dependencies
shell: bash
run: |
pwd
cd thirdparty
bash build_and_install_dependencies.sh ~/drdk_install 4

# Configure CMake, then build and install flexiv_rdk library to RDK installation directory.
- name: Build and install library
shell: bash
run: |
pwd
mkdir -p build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/drdk_install
cmake --build . --target install --config Release

# Find and link to flexiv_rdk library, then build all example programs.
- name: Build examples
shell: bash
run: |
pwd
cd example
mkdir -p build && cd build
cmake .. -DCMAKE_PREFIX_PATH=~/drdk_install
cmake --build . --config Release -j 4
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.vscode
.vs
.DS_Store
config.h
build*/
install/
cloned/
html/
__pycache__
85 changes: 85 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
cmake_minimum_required(VERSION 3.16.3)

# ===================================================================
# PROJECT SETUP
# ===================================================================
project(flexiv_drdk VERSION 1.0.0)

# Configure build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "CMake build type" FORCE)
endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" "RelWithDebInfo")

# Set static library according to platform
message(STATUS "OS: ${CMAKE_SYSTEM_NAME}")
message(STATUS "Processor: ${CMAKE_SYSTEM_PROCESSOR}")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
set(RDK_STATIC_LIB "libflexiv_drdk.x86_64-linux-gnu.a")
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
set(RDK_STATIC_LIB "libflexiv_drdk.aarch64-linux-gnu.a")
else()
message(FATAL_ERROR "Linux with ${CMAKE_SYSTEM_PROCESSOR} processor is currently not supported.")
endif()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64")
set(RDK_STATIC_LIB "libflexiv_drdk.arm64-darwin.a")
else()
message(FATAL_ERROR "Mac with ${CMAKE_SYSTEM_PROCESSOR} processor is currently not supported.")
endif()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "AMD64")
set(RDK_STATIC_LIB "flexiv_drdk.win_amd64.lib")
else()
message(FATAL_ERROR "Windows with ${CMAKE_SYSTEM_PROCESSOR} processor is currently not supported.")
endif()
endif()

# ===================================================================
# PROJECT DEPENDENCIES
# ===================================================================
# Threads
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
if(Threads_FOUND)
message(STATUS "Found Threads: HAVE_PTHREAD = ${THREADS_HAVE_PTHREAD_ARG}")
endif()

# Flexiv RDK
find_package(flexiv_rdk REQUIRED)
if(flexiv_rdk_FOUND)
message(STATUS "Found flexiv_rdk: ${flexiv_rdk_DIR}")
endif()

# ===================================================================
# CREATE LIBRARY
# ===================================================================
# Create an INTERFACE library with no source file to compile
add_library(${PROJECT_NAME} INTERFACE)

# Create an alias of the library using flexiv namespace,
# to imitate the install target which uses flexiv namespace.
add_library(flexiv::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

target_link_libraries(${PROJECT_NAME} INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/lib/${RDK_STATIC_LIB}
Threads::Threads
flexiv::flexiv_rdk
)

# Use moderate compiler warning option
if(CMAKE_HOST_UNIX)
target_compile_options(${PROJECT_NAME} INTERFACE -Wall -Wextra)
else()
target_compile_options(${PROJECT_NAME} INTERFACE /W1)
endif()

# Install the INTERFACE library
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/FlexivInstallLibrary.cmake)
FlexivInstallLibrary()
Loading