Skip to content

Commit dca9a15

Browse files
authored
1 parent 4cc08da commit dca9a15

80 files changed

Lines changed: 1776 additions & 1075 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/shared_steps/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ runs:
1515
run: |
1616
cmake --version
1717
cd thirdparty
18-
bash build_and_install_dependencies.sh ~/rdk_install 4
18+
bash build_and_install_dependencies.sh ~/rdk_install 8
1919
2020
# Configure CMake, then build and install flexiv_rdk library to RDK installation directory.
2121
- name: Build and install library
@@ -32,7 +32,7 @@ runs:
3232
cd example
3333
mkdir -p build && cd build
3434
cmake .. -DCMAKE_PREFIX_PATH=~/rdk_install
35-
cmake --build . --config Release -j 4
35+
cmake --build . --config Release -j 8
3636
3737
# Find and link to flexiv_rdk library, then build all test programs.
3838
- name: Build tests
@@ -41,4 +41,4 @@ runs:
4141
cd test
4242
mkdir -p build && cd build
4343
cmake .. -DCMAKE_PREFIX_PATH=~/rdk_install
44-
cmake --build . --config Release -j 4
44+
cmake --build . --config Release -j 8

CMakeLists.txt

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
cmake_minimum_required(VERSION 3.16.3)
1+
cmake_minimum_required(VERSION 3.22.1)
22

33
# ===================================================================
44
# PROJECT SETUP
55
# ===================================================================
6-
project(flexiv_rdk VERSION 1.9.1)
6+
project(flexiv_rdk VERSION 2.0)
77

88
# Configure build type
99
if(NOT CMAKE_BUILD_TYPE)
@@ -46,23 +46,6 @@ else()
4646
message(FATAL_ERROR "${CMAKE_SYSTEM_NAME} is currently not supported.")
4747
endif()
4848

49-
# Option to support ROS2 Jazzy
50-
option(RDK_SUPPORT_ROS2_JAZZY "Use RDK library compatible with ROS2 Jazzy" OFF)
51-
if(RDK_SUPPORT_ROS2_JAZZY)
52-
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
53-
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
54-
set(RDK_LIB "libflexiv_rdk.x86_64-linux-gnu.ros2-jazzy.a")
55-
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
56-
set(RDK_LIB "libflexiv_rdk.aarch64-linux-gnu.ros2-jazzy.a")
57-
else()
58-
message(FATAL_ERROR
59-
"Compatibility with ROS2 Jazzy is currently not supported on Linux with ${CMAKE_SYSTEM_PROCESSOR} processor.")
60-
endif()
61-
else()
62-
message(FATAL_ERROR "Compatibility with ROS2 Jazzy is currently not supported on ${CMAKE_SYSTEM_NAME}.")
63-
endif()
64-
endif()
65-
6649
# Parse expected hash of the library file
6750
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/lib/${RDK_LIB}.sha256 EXPECTED_HASH)
6851

@@ -90,24 +73,24 @@ find_package(Threads REQUIRED)
9073
message(STATUS "Found Threads")
9174

9275
# Eigen3
93-
find_package(Eigen3 REQUIRED)
76+
find_package(Eigen3 3.4.0 REQUIRED)
9477
message(STATUS "Found Eigen3 v${Eigen3_VERSION}: ${Eigen3_DIR}")
9578

9679
# spdlog
97-
find_package(spdlog REQUIRED)
80+
find_package(spdlog 1.9.2 REQUIRED)
9881
message(STATUS "Found spdlog v${spdlog_VERSION}: ${spdlog_DIR}")
9982

100-
# Fast-DDS (Fast-RTPS)
101-
find_package(fastrtps REQUIRED)
102-
message(STATUS "Found fastrtps v${fastrtps_VERSION}: ${fastrtps_DIR}")
83+
# Fast-DDS
84+
find_package(fastdds 3.5.0 REQUIRED)
85+
message(STATUS "Found fastdds v${fastdds_VERSION}: ${fastdds_DIR}")
10386

10487
# Fast-CDR
105-
find_package(fastcdr REQUIRED)
88+
find_package(fastcdr 2.3.5 REQUIRED)
10689
message(STATUS "Found fastcdr v${fastcdr_VERSION}: ${fastcdr_DIR}")
10790

10891
# RBDyn
10992
set(Boost_USE_STATIC_LIBS OFF)
110-
find_package(RBDyn REQUIRED)
93+
find_package(RBDyn 1.9.3 REQUIRED)
11194
message(STATUS "Found RBDyn v${RBDyn_VERSION}: ${RBDyn_DIR}")
11295

11396
# ===================================================================
@@ -130,7 +113,7 @@ target_link_libraries(${PROJECT_NAME} PUBLIC
130113
Threads::Threads
131114
Eigen3::Eigen
132115
spdlog::spdlog
133-
fastrtps
116+
fastdds
134117
fastcdr
135118
RBDyn::RBDyn
136119
RBDyn::Parsers

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ For AI-assisted code generation in this repository, see [llms.txt](llms.txt).
1717

1818
| **OS** | **Platform** | **C++ compiler kit** | **Python interpreter** |
1919
| --------------------- | --------------- | -------------------- | ---------------------- |
20-
| Linux (Ubuntu 22.04+) | x86_64, aarch64 | GCC v11.4+ | 3.10, 3.12, 3.13 |
20+
| Linux (Ubuntu 22.04+) | x86_64, aarch64 | GCC v11.4+ | 3.10, 3.12, 3.14 |
2121
| macOS 12+ | arm64 | Clang v14.0+ | 3.10, 3.12 |
2222
| Windows 10+ | x86_64 | MSVC v14.2+ | 3.10, 3.12 |
2323
| QNX 8.0.3+ | x86_64, aarch64 | QCC v12.2+ | Not supported |

cmake/flexiv_rdk-config.cmake.in

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ include(CMakeFindDependencyMacro)
44
set(THREADS_PREFER_PTHREAD_FLAG ON)
55
set(Boost_USE_STATIC_LIBS OFF)
66
find_dependency(Threads REQUIRED)
7-
find_dependency(Eigen3 REQUIRED)
8-
find_dependency(spdlog REQUIRED)
9-
find_dependency(fastrtps REQUIRED)
10-
find_dependency(fastcdr REQUIRED)
11-
find_dependency(RBDyn REQUIRED)
7+
find_dependency(Eigen3 3.4.0 REQUIRED)
8+
find_dependency(spdlog 1.9.2 REQUIRED)
9+
find_dependency(fastdds 3.5.0 REQUIRED)
10+
find_dependency(fastcdr 2.3.5 REQUIRED)
11+
find_dependency(RBDyn 1.9.3 REQUIRED)
1212

1313
# Add targets file
1414
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")

doc/Doxyfile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "Flexiv RDK APIs"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = 1.9.1
41+
PROJECT_NUMBER = 2.0
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

example/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.16.3)
1+
cmake_minimum_required(VERSION 3.22.1)
22
project(flexiv_rdk-examples)
33

44
# Show verbose build info

example/basics10_logging_behavior.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @example basics10_logging_behavior.cpp
33
* This tutorial shows how to change the logging behaviors of RDK client.
4-
* @copyright Copyright (C) 2016-2025 Flexiv Ltd. All Rights Reserved.
4+
* @copyright Copyright (C) 2016-2026 Flexiv Ltd. All Rights Reserved.
55
* @author Flexiv
66
*/
77

example/basics1_display_robot_states.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @example basics1_display_robot_states.cpp
33
* This tutorial does the very first thing: check connection with the robot server and print
44
* received robot states.
5-
* @copyright Copyright (C) 2016-2025 Flexiv Ltd. All Rights Reserved.
5+
* @copyright Copyright (C) 2016-2026 Flexiv Ltd. All Rights Reserved.
66
* @author Flexiv
77
*/
88

@@ -30,12 +30,21 @@ void PrintHelp()
3030
void PrintRobotStates(rdk::Robot& robot)
3131
{
3232
while (true) {
33+
// Print Available joint groups
34+
std::string joint_groups_str;
35+
for (const auto& group : robot.groups()) {
36+
joint_groups_str += "[" + rdk::kJointGroupNames.at(group) + "] ";
37+
}
38+
spdlog::info("Available joint groups: {}", joint_groups_str);
39+
3340
// Print all robot states in JSON format using the built-in ostream operator overloading
34-
spdlog::info("Current robot states:");
35-
std::cout << robot.states() << std::endl;
41+
for (const auto& [group, states] : robot.states()) {
42+
spdlog::info("[{}] robot states:", rdk::kJointGroupNames.at(group));
43+
std::cout << states << std::endl;
44+
}
3645

3746
// Print digital inputs
38-
spdlog::info("Current digital inputs:");
47+
spdlog::info("Digital inputs:");
3948
std::cout << rdk::utility::Arr2Str(robot.digital_inputs()) << std::endl;
4049
std::this_thread::sleep_for(std::chrono::seconds(1));
4150
}

example/basics2_clear_fault.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @example basics2_clear_fault.cpp
33
* This tutorial clears minor or critical faults, if any, of the connected robot.
4-
* @copyright Copyright (C) 2016-2025 Flexiv Ltd. All Rights Reserved.
4+
* @copyright Copyright (C) 2016-2026 Flexiv Ltd. All Rights Reserved.
55
* @author Flexiv
66
*/
77

example/basics3_primitive_execution.cpp

Lines changed: 66 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @example basics3_primitive_execution.cpp
33
* This tutorial executes several basic robot primitives (unit skills). For detailed documentation
44
* on all available primitives, please see [Flexiv Primitives](https://www.flexiv.com/primitives/).
5-
* @copyright Copyright (C) 2016-2025 Flexiv Ltd. All Rights Reserved.
5+
* @copyright Copyright (C) 2016-2026 Flexiv Ltd. All Rights Reserved.
66
* @author Flexiv
77
*/
88

@@ -13,6 +13,7 @@
1313
#include <iostream>
1414
#include <iomanip>
1515
#include <thread>
16+
#include <algorithm>
1617

1718
using namespace flexiv;
1819

@@ -74,6 +75,9 @@ int main(int argc, char* argv[])
7475

7576
// Execute Primitives
7677
// =========================================================================================
78+
// All available joint groups of the robot
79+
const auto joint_groups = robot.groups();
80+
7781
// Switch to primitive execution mode
7882
robot.SwitchMode(rdk::Mode::NRT_PRIMITIVE_EXECUTION);
7983

@@ -84,10 +88,17 @@ int main(int argc, char* argv[])
8488
spdlog::info("Executing primitive: Home");
8589

8690
// Send command to robot
87-
robot.ExecutePrimitive("Home", std::map<std::string, rdk::FlexivDataTypes> {});
91+
std::map<rdk::JointGroup, rdk::PrimitiveArgs> pt_args;
92+
for (const auto& group : joint_groups) {
93+
pt_args[group] = rdk::PrimitiveArgs("Home", {});
94+
}
95+
robot.ExecutePrimitive(pt_args);
8896

8997
// Wait for reached target
90-
while (!std::get<int>(robot.primitive_states()["reachedTarget"])) {
98+
while (!std::all_of(joint_groups.begin(), joint_groups.end(), [&robot](const auto& group) {
99+
return std::get<int>(
100+
robot.primitive_states().at(group).names_and_values.at("reachedTarget"));
101+
})) {
91102
std::this_thread::sleep_for(std::chrono::seconds(1));
92103
}
93104

@@ -103,24 +114,35 @@ int main(int argc, char* argv[])
103114
spdlog::info("Executing primitive: MoveJ");
104115

105116
// Send command to robot
106-
robot.ExecutePrimitive("MoveJ",
107-
{
108-
{"target", rdk::JPos({30, -45, 0, 90, 0, 40, 30}, {-50, 30})},
109-
{"waypoints",
110-
std::vector<rdk::JPos> {rdk::JPos({10, -30, 10, 30, 10, 15, 10}, {-15, 10}),
111-
rdk::JPos({20, -60, -10, 60, -10, 30, 20}, {-30, 20})}},
112-
});
117+
pt_args.clear();
118+
for (const auto& group : joint_groups) {
119+
pt_args[group] = rdk::PrimitiveArgs("MoveJ",
120+
{
121+
{"target", rdk::JPos({30, -45, 0, 90, 0, 40, 30}, {-50, 30})},
122+
{"waypoints",
123+
std::vector<rdk::JPos> {rdk::JPos({10, -30, 10, 30, 10, 15, 10}, {-15, 10}),
124+
rdk::JPos({20, -60, -10, 60, -10, 30, 20}, {-30, 20})}},
125+
});
126+
}
127+
robot.ExecutePrimitive(pt_args);
113128

114129
// Most primitives won't exit by themselves and require users to explicitly trigger
115130
// transitions based on specific primitive states. Here we check if the primitive state
116131
// [reachedTarget] becomes true and trigger the transition manually by sending a new
117132
// primitive command.
118-
while (!std::get<int>(robot.primitive_states()["reachedTarget"])) {
133+
while (!std::all_of(joint_groups.begin(), joint_groups.end(), [&robot](const auto& group) {
134+
return std::get<int>(
135+
robot.primitive_states().at(group).names_and_values.at("reachedTarget"));
136+
})) {
119137
// Print current primitive states
120138
spdlog::info("Current primitive states:");
121-
for (const auto& st : robot.primitive_states()) {
122-
std::cout << st.first << ": " << rdk::utility::FlexivTypes2Str(st.second);
123-
std::cout << std::endl;
139+
for (const auto& group : joint_groups) {
140+
std::cout << rdk::kJointGroupNames.at(group) << ":" << std::endl;
141+
const auto primitive_states = robot.primitive_states().at(group).names_and_values;
142+
for (const auto& st : primitive_states) {
143+
std::cout << st.first << ": " << rdk::utility::FlexivTypes2Str(st.second);
144+
std::cout << std::endl;
145+
}
124146
}
125147
std::this_thread::sleep_for(std::chrono::seconds(1));
126148
}
@@ -138,19 +160,25 @@ int main(int argc, char* argv[])
138160
spdlog::info("Executing primitive: MoveL");
139161

140162
// Send command to robot
141-
robot.ExecutePrimitive("MoveL",
142-
{
143-
{"target", rdk::Coord({0.65, -0.3, 0.2}, {180, 0, 180}, {"WORLD", "WORLD_ORIGIN"})},
144-
{"waypoints",
145-
std::vector<rdk::Coord> {
146-
rdk::Coord({0.45, 0.1, 0.2}, {180, 0, 180}, {"WORLD", "WORLD_ORIGIN"}),
147-
rdk::Coord({0.45, -0.3, 0.2}, {180, 0, 180}, {"WORLD", "WORLD_ORIGIN"})}},
148-
{"vel", 0.6},
149-
{"zoneRadius", "Z50"},
150-
});
163+
pt_args.clear();
164+
for (const auto& group : joint_groups) {
165+
pt_args[group] = rdk::PrimitiveArgs("MoveL",
166+
{{"target",
167+
rdk::Coord({0.3, -0.1, 0.2}, {160, 20, 180}, {"WORLD", "WORLD_ORIGIN"})},
168+
{"waypoints",
169+
std::vector<rdk::Coord> {rdk::Coord({0.1, 0.1, 0.1}, {-160, -20, 180},
170+
{"WORLD", "WORLD_ORIGIN"}),
171+
rdk::Coord({0.3, 0.2, 0.1}, {180, 0, 180}, {"WORLD", "WORLD_ORIGIN"})}},
172+
173+
{"vel", 0.6}, {"zoneRadius", "Z50"}});
174+
}
175+
robot.ExecutePrimitive(pt_args);
151176

152177
// Wait for reached target
153-
while (!std::get<int>(robot.primitive_states()["reachedTarget"])) {
178+
while (!std::all_of(joint_groups.begin(), joint_groups.end(), [&robot](const auto& group) {
179+
return std::get<int>(
180+
robot.primitive_states().at(group).names_and_values.at("reachedTarget"));
181+
})) {
154182
std::this_thread::sleep_for(std::chrono::seconds(1));
155183
}
156184

@@ -166,13 +194,20 @@ int main(int argc, char* argv[])
166194
auto targetEulerDeg = rdk::utility::Rad2Deg(rdk::utility::Quat2EulerZYX(targetQuat));
167195

168196
// Send command to robot. This motion will hold current TCP position and only do rotation
169-
robot.ExecutePrimitive(
170-
"MoveL", {
171-
{"target", rdk::Coord({0.0, 0.0, 0.0}, targetEulerDeg, {"TRAJ", "START"})},
172-
{"vel", 0.2},
173-
});
197+
pt_args.clear();
198+
for (const auto& group : joint_groups) {
199+
pt_args[group] = rdk::PrimitiveArgs("MoveL",
200+
{
201+
{"target", rdk::Coord({0.0, 0.0, 0.0}, targetEulerDeg, {"TRAJ", "START"})},
202+
{"vel", 0.2},
203+
});
204+
}
205+
robot.ExecutePrimitive(pt_args);
174206
// Wait for reached target
175-
while (!std::get<int>(robot.primitive_states()["reachedTarget"])) {
207+
while (!std::all_of(joint_groups.begin(), joint_groups.end(), [&robot](const auto& group) {
208+
return std::get<int>(
209+
robot.primitive_states().at(group).names_and_values.at("reachedTarget"));
210+
})) {
176211
std::this_thread::sleep_for(std::chrono::seconds(1));
177212
}
178213

0 commit comments

Comments
 (0)