Skip to content

Commit

Permalink
Pre-release/v1.2 (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
pzhu-flexiv authored Dec 1, 2023
1 parent 8137e3d commit 6ff4790
Show file tree
Hide file tree
Showing 65 changed files with 1,953 additions and 1,479 deletions.
63 changes: 46 additions & 17 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ env:

jobs:
build-ubuntu-22:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
# Use Ubuntu 22.04 runner
runs-on: ubuntu-22.04

steps:
Expand All @@ -27,7 +24,7 @@ jobs:
run: |
cd ${{github.workspace}}
cd thirdparty
bash build_and_install_dependencies.sh ~/rdk_install
bash build_and_install_dependencies.sh ~/rdk_install $(nproc)
- name: Build and install library
# Configure CMake, then build and install the flexiv_rdk INTERFACE library to RDK installation directory.
Expand All @@ -54,10 +51,7 @@ jobs:
make -j$(nproc)
build-ubuntu-20:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
# Use Ubuntu 20.04 runner
runs-on: ubuntu-20.04

steps:
Expand All @@ -68,7 +62,7 @@ jobs:
run: |
cd ${{github.workspace}}
cd thirdparty
bash build_and_install_dependencies.sh ~/rdk_install
bash build_and_install_dependencies.sh ~/rdk_install $(nproc)
- name: Build and install library
# Configure CMake, then build and install the flexiv_rdk INTERFACE library to RDK installation directory.
Expand All @@ -94,12 +88,9 @@ jobs:
cmake .. -DCMAKE_INSTALL_PREFIX=~/rdk_install
make -j$(nproc)
build-windows-2022:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: windows-2022
build-macos-12:
# Use self-hosted macOS 12 runner with arm64 processor
runs-on: [self-hosted, macos-12, ARM64]

steps:
- uses: actions/checkout@v2
Expand All @@ -109,7 +100,45 @@ jobs:
run: |
cd ${{github.workspace}}
cd thirdparty
bash build_and_install_dependencies.sh ~/rdk_install
bash build_and_install_dependencies.sh ~/rdk_install $(sysctl -n hw.ncpu)
- name: Build and install library
# Configure CMake, then build and install the flexiv_rdk INTERFACE library to RDK installation directory.
run: |
cd ${{github.workspace}}
mkdir -p build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/rdk_install
make install
- name: Build examples
# Find and link to the flexiv_rdk INTERFACE library, then build all examples.
run: |
cd ${{github.workspace}}/example
mkdir -p build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/rdk_install
make -j$(sysctl -n hw.ncpu)
- name: Build tests
# Find and link to the flexiv_rdk INTERFACE library, then build all tests.
run: |
cd ${{github.workspace}}/test
mkdir -p build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/rdk_install
make -j$(sysctl -n hw.ncpu)
build-windows-2019:
# Use Windows 2019 runner because the 2022 runner uses a MSVC version that's too new for one of the dependencies
runs-on: windows-2019

steps:
- uses: actions/checkout@v2

- name: Build and install dependencies
# Build and install all dependencies to RDK installation directory.
run: |
cd ${{github.workspace}}
cd thirdparty
bash build_and_install_dependencies.sh ~/rdk_install $(nproc)
- name: Build and install library
# Configure CMake, then build and install the flexiv_rdk INTERFACE library to RDK installation directory.
Expand Down
24 changes: 12 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.18.6)
cmake_minimum_required(VERSION 3.16.3)

# ===================================================================
# PROJECT SETUP
# ===================================================================
project(flexiv_rdk VERSION 1.1.0)
project(flexiv_rdk VERSION 1.2.0)

# Configure build type
if(NOT CMAKE_BUILD_TYPE)
Expand All @@ -16,21 +16,21 @@ message("OS: ${CMAKE_SYSTEM_NAME}")
message("Processor: ${CMAKE_SYSTEM_PROCESSOR}")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
set(RDK_STATIC_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/lib/libflexiv_rdk.linux-gnu-x86_64.a")
set(RDK_STATIC_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/lib/libflexiv_rdk.x86_64-linux-gnu.a")
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
set(RDK_STATIC_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/lib/libflexiv_rdk.linux-gnu-aarch64.a")
set(RDK_STATIC_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/lib/libflexiv_rdk.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_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/lib/libflexiv_rdk.darwin-arm64.a")
set(RDK_STATIC_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/lib/libflexiv_rdk.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_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/lib/flexiv_rdk.win-amd64.lib")
set(RDK_STATIC_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/lib/flexiv_rdk.win_amd64.lib")
else()
message(FATAL_ERROR "Windows with ${CMAKE_SYSTEM_PROCESSOR} processor is currently not supported.")
endif()
Expand All @@ -47,19 +47,19 @@ if(Threads_FOUND)
endif()

# Eigen3
find_package(Eigen3 REQUIRED HINTS ${CMAKE_INSTALL_PREFIX})
find_package(Eigen3 REQUIRED)
if(Eigen3_FOUND)
message(STATUS "Found Eigen3: ${Eigen3_DIR}")
endif()

# Fast-CDR
find_package(fastcdr 1.0.24 REQUIRED HINTS ${CMAKE_INSTALL_PREFIX})
find_package(fastcdr 1.0.24 REQUIRED)
if(fastcdr_FOUND)
message(STATUS "Found fastcdr: ${fastcdr_DIR}")
endif()

# Fast-DDS (Fast-RTPS)
find_package(fastrtps 2.6.2 REQUIRED HINTS ${CMAKE_INSTALL_PREFIX})
find_package(fastrtps 2.6.2 REQUIRED)
if(fastrtps_FOUND)
message(STATUS "Found fastrtps: ${fastrtps_DIR}")
endif()
Expand All @@ -70,11 +70,11 @@ endif()
# Create an INTERFACE library with no source file to compile
add_library(${PROJECT_NAME} INTERFACE)

# Create an alias of the library using flexiv namespace,
# 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
target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
Expand All @@ -87,7 +87,7 @@ target_link_libraries(${PROJECT_NAME} INTERFACE
fastcdr
)

# Use moderate compiler warning option
# Use moderate compiler warning option
if(CMAKE_HOST_UNIX)
target_compile_options(${PROJECT_NAME} INTERFACE -Wall -Wextra)
else()
Expand Down
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Flexiv RDK (Robotic Development Kit), a key component of the Flexiv Robotic Soft

## Compatibility Overview

| **Supported OS** | **Supported processor** | **Supported language** | **Required compiler kit** |
| ------------------------------ | ----------------------- | ---------------------- | ------------------------- |
| Linux (Ubuntu 18/20/22 tested) | x86_64, arm64 | C++, Python | build-essential |
| macOS 12 (Monterey) | arm64 | C++, Python | Xcode Command Line Tools |
| Windows 10 | x86_64 | C++, Python | MSVC 14.0+ |
| **Supported OS** | **Supported processor** | **Supported language** | **Required compiler kit** |
| -------------------------- | ----------------------- | ---------------------- | ------------------------- |
| Linux (Ubuntu 20.04/22.04) | x86_64, arm64 | C++, Python | build-essential |
| macOS 12 (Monterey) | arm64 | C++, Python | Xcode Command Line Tools |
| Windows 10 | x86_64 | C++, Python | MSVC 14.0+ |

## Quick Start

Expand All @@ -34,7 +34,7 @@ NOTE: if you will only be using Python RDK, you can skip this section and jump t
sudo apt install build-essential git cmake cmake-qt-gui -y

2. Choose a directory for installing ``flexiv_rdk`` library and all its dependencies. For example, a new folder named ``rdk_install`` under the home directory.
3. In a new Terminal, run the provided script to compile and install all dependencies to the installation directory chosen in step 1:
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_rdk/thirdparty
bash build_and_install_dependencies.sh ~/rdk_install
Expand Down Expand Up @@ -82,10 +82,14 @@ NOTE: if you will only be using Python RDK, you can skip this section and jump t

#### Compile and install for Windows

1. Install Microsoft Visual Studio with version 2015 or above (MSVC 14.0+). Choose the "Desktop development with C++" package during installation.
2. Download ``cmake-3.x.x-windows-x86_64.msi`` from [CMake download page](https://cmake.org/download/) and install the msi file. The minimum required version is 3.16.3. **Add CMake to system PATH** when prompted, so that ``cmake`` and ``cmake-gui`` command can be used from Command Prompt or a bash emulator.
3. Install a bash emulator. Git Bash that comes with Git (for Windows) installation is recommended.
4. Within the bash emulator, the rest steps are the same as [Compile and install for Linux](#compile-and-install-for-linux), beginning from step 2.
1. Install Microsoft Visual Studio with version 2015 or above (MSVC 14.0+). Choose "Desktop development with C++" under the *Workloads* tab during installation. You only need to keep the following components for the selected workload:
* MSVC ... C++ x64/x86 build tools (Latest)
* C++ CMake tools for Windows
* Windows 10 SDK or Windows 11 SDK, depending on your actual Windows version
2. Due to compatibility issue from one of the dependencies, the maximum compatible MSVC version is v14.36. Thus if the above selected "Latest" MSVC is higher than v14.36, an **additional** compatible MSVC needs to be installed. To do so, go to the *Individual components* tab (next to *Workloads*), and search for "MSVC x64/x86 build tools", then select a MSVC with version <= 14.36 to install. Note: you need to also **keep** the "Latest" selection of MSVC that comes with the "Desktop development with C++" workload so that the "C++ CMake tools for Windows" component can work properly.
3. Download ``cmake-3.x.x-windows-x86_64.msi`` from [CMake download page](https://cmake.org/download/) and install the msi file. The minimum required version is 3.16.3. **Add CMake to system PATH** when prompted, so that ``cmake`` and ``cmake-gui`` command can be used from Command Prompt or a bash emulator.
4. Install a bash emulator. Git Bash that comes with Git (for Windows) installation is recommended.
5. Within the bash emulator, the rest steps are the same as [Compile and install for Linux](#compile-and-install-for-linux), beginning from step 2.

### Python RDK

Expand Down
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 RDK 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
9 changes: 5 additions & 4 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.18.6)
cmake_minimum_required(VERSION 3.16.3)
project(flexiv_rdk-examples)

# Show verbose build info
Expand All @@ -21,10 +21,11 @@ set(EXAMPLE_LIST
basics5_zero_force_torque_sensors
basics6_gripper_control
basics7_auto_recovery
basics8_update_robot_tool
intermediate6_robot_dynamics
intermediate7_teach_by_demonstration
)


# Additional examples for Linux and Mac
if(CMAKE_HOST_UNIX)
list(APPEND EXAMPLE_LIST
Expand All @@ -33,7 +34,6 @@ if(CMAKE_HOST_UNIX)
intermediate3_realtime_joint_floating
intermediate4_realtime_cartesian_pure_motion_control
intermediate5_realtime_cartesian_motion_force_control
intermediate6_robot_dynamics
)
endif()

Expand All @@ -44,8 +44,9 @@ find_package(flexiv_rdk REQUIRED)
foreach(example ${EXAMPLE_LIST})
add_executable(${example} ${example}.cpp)
target_link_libraries(${example} flexiv::flexiv_rdk)

# C++17 required
set_target_properties(${example} PROPERTIES
set_target_properties(${example} PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON)
endforeach()
18 changes: 4 additions & 14 deletions example/basics1_display_robot_states.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @example basics1_display_robot_states.cpp
* This tutorial does the very first thing: check connection with the robot server and print
* received robot states.
* @copyright Copyright (C) 2016-2021 Flexiv Ltd. All Rights Reserved.
* @copyright Copyright (C) 2016-2023 Flexiv Ltd. All Rights Reserved.
* @author Flexiv
*/

Expand Down Expand Up @@ -37,16 +37,12 @@ void printHelp()
/** @brief Print robot states data @ 1Hz */
void printRobotStates(flexiv::Robot& robot, flexiv::Log& log)
{
// Data struct storing robot states
flexiv::RobotStates robotStates;

while (true) {
// Get the latest robot states
robot.getRobotStates(robotStates);

// Print all robot states in JSON format using the built-in ostream operator overloading
// Note: because this is not a performance-critical loop, we can use the
// return-by-value-copy version of getRobotStates()
log.info("Current robot states:");
std::cout << robotStates << std::endl;
std::cout << robot.getRobotStates() << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(1));
}
}
Expand Down Expand Up @@ -95,14 +91,8 @@ int main(int argc, char* argv[])
robot.enable();

// Wait for the robot to become operational
int secondsWaited = 0;
while (!robot.isOperational()) {
std::this_thread::sleep_for(std::chrono::seconds(1));
if (++secondsWaited == 10) {
log.warn(
"Still waiting for robot to become operational, please check that the robot 1) "
"has no fault, 2) is in [Auto (remote)] mode");
}
}
log.info("Robot is now operational");

Expand Down
2 changes: 1 addition & 1 deletion example/basics2_clear_fault.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @example basics2_clear_fault.cpp
* This tutorial clears minor faults from the robot server if any. Note that critical faults cannot
* be cleared, see RDK manual for more details.
* @copyright Copyright (C) 2016-2021 Flexiv Ltd. All Rights Reserved.
* @copyright Copyright (C) 2016-2023 Flexiv Ltd. All Rights Reserved.
* @author Flexiv
*/

Expand Down
8 changes: 1 addition & 7 deletions example/basics3_primitive_execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @example basics3_primitive_execution.cpp
* This tutorial executes several basic robot primitives (unit skills). For detailed documentation
* on all available primitives, please see [Flexiv Primitives](https://www.flexiv.com/primitives/).
* @copyright Copyright (C) 2016-2021 Flexiv Ltd. All Rights Reserved.
* @copyright Copyright (C) 2016-2023 Flexiv Ltd. All Rights Reserved.
* @author Flexiv
*/

Expand Down Expand Up @@ -79,14 +79,8 @@ int main(int argc, char* argv[])
robot.enable();

// Wait for the robot to become operational
int secondsWaited = 0;
while (!robot.isOperational()) {
std::this_thread::sleep_for(std::chrono::seconds(1));
if (++secondsWaited == 10) {
log.warn(
"Still waiting for robot to become operational, please check that the robot 1) "
"has no fault, 2) is in [Auto (remote)] mode");
}
}
log.info("Robot is now operational");

Expand Down
Loading

0 comments on commit 6ff4790

Please sign in to comment.