Skip to content

Commit

Permalink
Release/v1.2 (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
pzhu-flexiv authored Nov 15, 2024
1 parent 1176c5f commit f7881b5
Show file tree
Hide file tree
Showing 27 changed files with 1,038 additions and 708 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,24 @@ jobs:
run: |
cd ${{github.workspace}}
cd thirdparty
bash build_and_install_dependencies.sh ~/teleop_install
bash build_and_install_dependencies.sh ~/tdk_install
- name: Build and install library
# Configure CMake, then build and install the flexiv_tdk INTERFACE library to TDK installation directory.
run: |
cd ${{github.workspace}}
mkdir -p build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/teleop_install
cmake .. -DCMAKE_INSTALL_PREFIX=~/tdk_install
make install
- name: Build examples
# Find and link to the flexiv_tdk INTERFACE library, then build all examples.
run: |
cd ${{github.workspace}}/example
mkdir -p build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/teleop_install
cmake .. -DCMAKE_INSTALL_PREFIX=~/tdk_install
make -j$(nproc)
# - name: Build tests
# # Find and link to the flexiv_tdk INTERFACE library, then build all tests.
# run: |
# cd ${{github.workspace}}/test
# mkdir -p build && cd build
# cmake .. -DCMAKE_INSTALL_PREFIX=~/teleop_install
# make -j$(nproc)

build-ubuntu-20:
# Use GitHub-hosted Ubuntu 20.04 runner
runs-on: ubuntu-20.04
Expand Down
46 changes: 22 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16.3)
# ===================================================================
# PROJECT SETUP
# ===================================================================
project(flexiv_tdk VERSION 1.1.0)
project(flexiv_tdk VERSION 1.2.0)

# Configure build type
if(NOT CMAKE_BUILD_TYPE)
Expand All @@ -14,39 +14,36 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" "RelWithD
# Set static library
message("OS: ${CMAKE_SYSTEM_NAME}")
message("Processor: ${CMAKE_SYSTEM_PROCESSOR}")

if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
set(TELEOP_STATIC_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/lib/libflexiv_tdk.x86_64-linux-gnu.a")
set(TDK_STATIC_LIB "libflexiv_tdk.x86_64-linux-gnu.a")
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
set(TDK_STATIC_LIB "libflexiv_tdk.aarch64-linux-gnu.a")
else()
message(FATAL_ERROR "Linux with ${CMAKE_SYSTEM_PROCESSOR} processor is currently not supported.")
endif()
else()
message(FATAL_ERROR "OS:${CMAKE_SYSTEM_NAME} with processor:${CMAKE_SYSTEM_PROCESSOR} is currently not supported.")
endif()

# Set install prefix to non default
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
message(FATAL_ERROR "CMAKE_INSTALL_PREFIX must be set to a non-default value.
Please set it explicitly using -DCMAKE_INSTALL_PREFIX=<path-to-your-install-directory> or using cmake-gui")
endif()
# Add to CMAKE_PREFIX_PATH so the sub-dependencies can also be found
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})

# ===================================================================
# 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()

# OpenSSL
find_package(OpenSSL REQUIRED)
if(OpenSSL_FOUND)
message(STATUS "Found OpenSSL, version: ${OPENSSL_VERSION}, libraries: ${OPENSSL_LIBRARIES}")
# spdlog
find_package(spdlog REQUIRED)
if(spdlog_FOUND)
message(STATUS "Found spdlog: ${spdlog_DIR}")
endif()

# flexiv_rdk
find_package(flexiv_rdk REQUIRED)
if(flexiv_rdk_FOUND)
message(STATUS "Found flexiv_rdk: ${flexiv_rdk_DIR}")
# Fast-DDS (Fast-RTPS)
find_package(fastrtps 2.6.7 REQUIRED)
if(fastrtps_FOUND)
message(STATUS "Found fastrtps: ${fastrtps_DIR}")
endif()

# ===================================================================
Expand All @@ -65,9 +62,10 @@ target_include_directories(${PROJECT_NAME} INTERFACE
)

target_link_libraries(${PROJECT_NAME} INTERFACE
${TELEOP_STATIC_LIBRARY}
${OPENSSL_LIBRARIES}
flexiv::flexiv_rdk
${CMAKE_CURRENT_SOURCE_DIR}/lib/${TDK_STATIC_LIB}
Threads::Threads
spdlog::spdlog
fastrtps
)

# Use moderate compiler warning option
Expand Down
56 changes: 28 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,74 @@

![CMake Badge](https://github.com/flexivrobotics/flexiv_tdk/actions/workflows/cmake.yml/badge.svg) ![Version](https://img.shields.io/badge/version-1.1-blue.svg) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)

Flexiv TDK (Teleoperation Development Kit) is an SDK provides C++ APIs for developing complex and customized applications involving robot-robot or device-robot teleoperation. The supported devices are listed below.

## Supported devices

| **Supported teleop type** | **Supported local devices** | **Supported remote devices** |
| ------------------------- | --------------------------- | ---------------------------- |
| robot-robot | Rizon4s | Rizon4s |
Flexiv TDK (Teleoperation Development Kit) is an SDK for developing customized robot-robot or device-robot teleoperation applications with Flexiv's adaptive robots. It features synchronized motions that are force-guided using high-fidelity perceptual feedback and supports both LAN (Local Area Network) and WAN (Wide Area Network, i.e. Internet) connections.

## Compatibility

| **Supported OS** | **Supported processor** | **Supported language** | **Required compiler kit** |
| -------------------------- | ----------------------- | ---------------------- | ------------------------- |
| Linux (Ubuntu 20.04/22.04) | x86_64 | C++ | build-essential |

## Quick Start

The TDK library is packed into a unified modern CMake project named ``flexiv_tdk``, which can be configured and installed using CMake on all supported OS.

### Install on Linux

1. In a new Terminal, install C++ compiler, libssl-dev, net-tools, Git, and CMake (with GUI) using the package manager:
1. In a new Terminal, install compiler kit, CMake (with GUI), Python interpreter, and Python package manager:

sudo apt install build-essential libssl-dev net-tools git cmake cmake-qt-gui -y
sudo apt install build-essential cmake cmake-qt-gui -y

2. Choose a directory for installing ``flexiv_tdk`` library and all its dependencies. For example, a new folder named ``tdk_install`` under the home directory.

3. Please ensure that your network connection is unobstructed. Then, in a new Terminal, run the provided script to compile and install all dependencies to the installation directory chosen in step 2:
3. In a new Terminal, run the provided script to compile and install all dependencies to the installation directory chosen in step 2:

cd flexiv_tdk/thirdparty
bash build_and_install_dependencies.sh ~/tdk_install

4. In a new Terminal, use CMake to configure `flexiv_tdk`:
NOTE: Internet connection is required for this step.

4. In a new Terminal, configure ``flexiv_tdk`` library as a CMake project:

cd flexiv_tdk
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/tdk_install

NOTE: ``-D`` followed by ``CMAKE_INSTALL_PREFIX`` is a CMake parameter specifying the path of the chosen installation directory. Alternatively, this configuration step can also be done through CMake GUI.
NOTE: ``-D`` followed by ``CMAKE_INSTALL_PREFIX`` is a CMake parameter specifying the path of the chosen installation directory. Alternatively, this configuration step can be done using CMake GUI.

5. Install `flexiv_tdk` library:
5. Install ``flexiv_tdk`` library:

cd flexiv_tdk/build
cmake --build . --target install --config Release

NOTE: the installation of `flexiv_tdk` library is complete now. The following steps show how to link to the installed library from a user project.

### Link to the installed library to a user project
The library will be installed to ``CMAKE_INSTALL_PREFIX`` path, which may or may not be globally discoverable by CMake.

1. To find and link to the installed `flexiv_tdk` library to a user project, using the provided example project for instance:
### Link to installed library from a user program

cd flexiv_tdk/example
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/tdk_install
cmake --build . --config Release -j 4
After the TDK library is installed, it can be found as a CMake target and linked to from other CMake projects. Using the provided examples project for instance::

NOTE: ``-D`` followed by ``CMAKE_INSTALL_PREFIX`` tells user project's CMake where to find the installed `flexiv_tdk` library.
cd flexiv_tdk/example
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/tdk_install
cmake --build . --config Release -j 4

### Run tdk example
NOTE: ``-D`` followed by ``CMAKE_INSTALL_PREFIX`` tells the user project's CMake where to find the installed TDK library. The instruction above applies to all supported OS.

1. Apply for license to run tdk. See [apply_for_license.md](./license_generator/apply_for_license.md)
### Run example programs

2. Set all the robots to `Auto/Remote Mode` via Flexiv Elements, then to run the compiled example program:
To run a compiled example program:

./<program_name> [local_robot_serial_number] [remote_robot_serial_number] [path_to_licenseCfg.json]
cd flexiv_tdk/example/build
sudo ./<program_name> [arguments]

The exact arguments required by an example program are documented in the program's code. Also, ``sudo`` is required to grant root permissions.

## API Documentation

API doc can be generated using doxygen
The API documentation can be generated using doxygen:

sudo apt install doxygen-latex graphviz
cd flexiv_tdk
doxygen doc/Doxyfile.in

The generated API doc is under ```flexiv_tdk/doc/html ```. You can open any of the html file with your web browser to view it.
The generated API documentation is under ``flexiv_tdk/doc/html/`` directory. Open any html file with your browser to view it.
7 changes: 5 additions & 2 deletions cmake/flexiv_tdk-config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
include(CMakeFindDependencyMacro)

# Find dependency
find_dependency(flexiv_rdk REQUIRED)
find_package(OpenSSL REQUIRED)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_dependency(Threads REQUIRED)
find_dependency(spdlog REQUIRED)
find_dependency(fastrtps 2.6.7 REQUIRED)

# Add targets file
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
2 changes: 1 addition & 1 deletion doc/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Flexiv TDK APIs"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.1
PROJECT_NUMBER = 1.2

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
42 changes: 16 additions & 26 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,44 +1,34 @@
cmake_minimum_required(VERSION 3.16.3)

project(flexiv_tdk-examples)

message("OS: ${CMAKE_SYSTEM_NAME}")
message("Processor: ${CMAKE_SYSTEM_PROCESSOR}")

# Show verbose build info
SET(CMAKE_VERBOSE_MAKEFILE ON)

message("OS: ${CMAKE_SYSTEM_NAME}")
message("Processor: ${CMAKE_SYSTEM_PROCESSOR}")

# Configure build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "CMake build type" FORCE)
endif()

# Set default install prefix
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
message(FATAL_ERROR "CMAKE_INSTALL_PREFIX must be set to a non-default value.
Please set it explicitly using -DCMAKE_INSTALL_PREFIX=<path-to-your-install-directory> or using cmake-gui")
set(CMAKE_BUILD_TYPE Release CACHE STRING "CMake build type" FORCE)
endif()

# Add to CMAKE_PREFIX_PATH so the sub-dependencies can also be found
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})

# Example list
set(EXAMPLE_LIST
basics1_cartesian_teleop
cartesian_teleop_under_lan
joint_teleop_over_wan
joint_teleop_under_lan
)

# Find flexiv_tdk INTERFACE library
find_package(flexiv_tdk 1.1.0 REQUIRED)
if(flexiv_tdk_FOUND)
message(STATUS "Found flexiv_tdk:${flexiv_tdk_DIR}")
endif()
find_package(flexiv_tdk REQUIRED)

# Build all examples
# Build all selected examples
foreach(example ${EXAMPLE_LIST})
add_executable(${example} ${example}.cpp)
target_link_libraries(${example} flexiv::flexiv_tdk)
add_executable(${example} ${example}.cpp)
target_link_libraries(${example} flexiv::flexiv_tdk)

# C++17 required
set_target_properties(${example} PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON)
# C++17 required
set_target_properties(${example} PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON)
endforeach()
Loading

0 comments on commit f7881b5

Please sign in to comment.