Skip to content

Commit 10a57dc

Browse files
authored
1 parent 1865733 commit 10a57dc

File tree

660 files changed

+4424
-32044
lines changed

Some content is hidden

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

660 files changed

+4424
-32044
lines changed

CMakeLists.txt

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ if( NOT CMAKE_BUILD_TYPE )
1212
FORCE )
1313
endif()
1414

15+
option(BUILD_FOR_ARM64 "Link to RDK library for arm64 processor, otherwise link to x64" OFF)
16+
1517
set(CMAKE_VERBOSE_MAKEFILE ON)
1618

1719
set(THREADS_PREFER_PTHREAD_FLAG ON)
@@ -25,16 +27,18 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/example)
2527

2628
# list of examples
2729
set(EXAMPLE_LIST
30+
auto_recovery
2831
cartesian_impedance_control
32+
clear_fault
33+
display_robot_states
34+
floating_with_soft_limits
35+
gripper_control
2936
joint_impedance_control
3037
joint_position_control
3138
plan_execution
3239
primitive_execution
3340
robot_dynamics
34-
display_robot_states
3541
series_operation
36-
floating_with_soft_limits
37-
auto_recovery
3842
visualization
3943
)
4044

@@ -46,14 +50,24 @@ foreach(example ${EXAMPLE_LIST})
4650
target_include_directories(${example}
4751
PUBLIC
4852
${CMAKE_CURRENT_SOURCE_DIR}/include
49-
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/Eigen
53+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/eigen3
5054
)
5155

56+
# Link basic libraries
5257
target_link_libraries(${example}
53-
${CMAKE_CURRENT_SOURCE_DIR}/lib/libFlexivRdk.a
54-
anl
5558
Threads::Threads
59+
anl
5660
)
61+
62+
# Link arm64 or x64 version of libFlexivRdk
63+
if (${BUILD_FOR_ARM64})
64+
target_link_libraries(${example}
65+
${CMAKE_CURRENT_SOURCE_DIR}/lib/cpp/arm64/libFlexivRdk.a)
66+
else()
67+
target_link_libraries(${example}
68+
${CMAKE_CURRENT_SOURCE_DIR}/lib/cpp/x64/libFlexivRdk.a)
69+
endif()
70+
5771
endforeach()
5872

5973

@@ -65,14 +79,13 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test)
6579

6680
# list of tests
6781
set(TEST_LIST
68-
test_dynamic_engine
69-
test_scheduler
70-
test_set_tool
71-
test_timeliness_monitor
72-
test_data_integrity
82+
test_dynamics_engine
83+
test_dynamics_with_tool
7384
test_endurance
7485
test_log
7586
test_loop_latency
87+
test_scheduler
88+
test_timeliness_monitor
7689
)
7790

7891
foreach(test ${TEST_LIST})
@@ -83,12 +96,22 @@ foreach(test ${TEST_LIST})
8396
target_include_directories(${test}
8497
PUBLIC
8598
${CMAKE_CURRENT_SOURCE_DIR}/include
86-
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/Eigen
99+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/eigen3
87100
)
88101

102+
# Link basic libraries
89103
target_link_libraries(${test}
90-
${CMAKE_CURRENT_SOURCE_DIR}/lib/libFlexivRdk.a
91-
anl
92104
Threads::Threads
105+
anl
93106
)
107+
108+
# Link arm64 or x64 version of libFlexivRdk
109+
if (${BUILD_FOR_ARM64})
110+
target_link_libraries(${test}
111+
${CMAKE_CURRENT_SOURCE_DIR}/lib/cpp/arm64/libFlexivRdk.a)
112+
else()
113+
target_link_libraries(${test}
114+
${CMAKE_CURRENT_SOURCE_DIR}/lib/cpp/x64/libFlexivRdk.a)
115+
endif()
116+
94117
endforeach()

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,33 @@
55

66
Flexiv RDK (Robot Development Kit) is a powerful toolkit as an add-on to the Flexiv software platform. It enables the users to create complex applications with APIs that provide low-level real-time access to the robot.
77

8-
**C++** interface (real-time and non-real-time APIs) and **Python** interface (non-real-time APIs only) are supported.
8+
**C++** (access to all APIs) and **Python** (access to non-real-time APIs only) are supported.
99

1010
## License
1111

1212
Flexiv RDK is licensed under the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0.html).
1313

1414
## References
1515

16-
**[Flexiv RDK Manual](https://flexivrobotics.github.io/)** is the main reference and contains important information on how to properly set up the system and use Flexiv RDK library.
17-
18-
[API documentation](https://flexivrobotics.github.io/flexiv_rdk/) contains details about available APIs, generated from Doxygen.
16+
[Flexiv RDK main webpage](https://rdk.flexiv.com/) contains important information like the user manual and API documentation, please read them carefully before proceeding.
1917

2018
## Run example programs
2119

2220
**NOTE:** the instruction below is only a quick reference, assuming you've already gone through the Flexiv RDK Manual.
2321

2422
### C++ interface
2523

26-
1. Configure and build example programs:
24+
1. Configure and compile example programs for x64 processors:
2725

2826
cd flexiv_rdk
2927
mkdir build && cd build
3028
cmake ..
3129
make -j4
3230

31+
For arm64 processors, set the additional CMake option when configuring:
32+
33+
cmake .. -DBUILD_FOR_ARM64=ON
34+
3335
2. The compiled program binaries will be output to ``flexiv_rdk/build/example``
3436
3. Assume the robot is booted and connected, to run an example program:
3537

@@ -66,3 +68,4 @@ Flexiv RDK has integrated visualization (only available for C++ interface) based
6668
4. Use APIs in ``flexiv::Visualization`` to communicate with the Meshcat server, the empty scene will be populated with robot(s) and user-defined objects if any. Refer to ``example/visualization.cpp``.
6769

6870
**Note:** only STL mesh files are supported, which are provided in ``spec/meshes``.
71+

doc/Doxyfile.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@ DOXYFILE_ENCODING = UTF-8
3232
# title of most generated pages and in a few other places.
3333
# The default value is: My Project.
3434

35-
PROJECT_NAME = "RDK"
35+
PROJECT_NAME = "Flexiv RDK APIs"
3636

3737
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = "0.4.0"
41+
PROJECT_NUMBER = "0.5.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
4545
# quick idea about the purpose of the project. Keep the description short.
4646

47-
PROJECT_BRIEF = "C++ APIs"
47+
PROJECT_BRIEF = ""
4848

4949
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
5050
# in the documentation. The maximum height of the logo should not exceed 55

example/auto_recovery.cpp

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
* Run auto-recovery if the robot's safety system is in recovery state,
44
* otherwise run damped floating with joint soft limit disabled, so that the
55
* user can manually trigger a safety system recovery state by moving any joint
6-
* close to its limit. See flexiv::Mode::MODE_AUTO_RECOVERY for more details.
6+
* close to its limit. See flexiv::Robot::isRecoveryState() for more details.
77
* @copyright Copyright (C) 2016-2021 Flexiv Ltd. All Rights Reserved.
88
* @author Flexiv
99
*/
1010

11-
#include <Robot.hpp>
12-
#include <Log.hpp>
11+
#include <flexiv/Robot.hpp>
12+
#include <flexiv/Exception.hpp>
13+
#include <flexiv/Log.hpp>
1314

1415
#include <string>
1516
#include <thread>
@@ -32,49 +33,45 @@ int main(int argc, char* argv[])
3233
// IP of the workstation PC running this program
3334
std::string localIP = argv[2];
3435

35-
// RDK Initialization
36-
//=============================================================================
37-
// Instantiate robot interface
38-
auto robot = std::make_shared<flexiv::Robot>();
39-
40-
// Create data struct for storing robot states
41-
auto robotStates = std::make_shared<flexiv::RobotStates>();
36+
try {
37+
// RDK Initialization
38+
//=============================================================================
39+
// Instantiate robot interface
40+
flexiv::Robot robot(robotIP, localIP);
4241

43-
// Initialize robot interface and connect to the robot server
44-
robot->init(robotIP, localIP);
42+
// Create data struct for storing robot states
43+
flexiv::RobotStates robotStates;
4544

46-
// Wait for the connection to be established
47-
do {
48-
std::this_thread::sleep_for(std::chrono::milliseconds(1));
49-
} while (!robot->isConnected());
50-
51-
// Enable the robot, make sure the E-stop is released before enabling
52-
if (robot->enable()) {
45+
// Enable the robot, make sure the E-stop is released before enabling
5346
log.info("Enabling robot ...");
54-
}
47+
robot.enable();
5548

56-
// Application-specific Code
57-
//=============================================================================
58-
// If the system is in recovery state, we can't use isOperational to tell if
59-
// the enabling process is done, so just wait long enough for the process to
60-
// finish
61-
std::this_thread::sleep_for(std::chrono::seconds(8));
49+
// Application-specific Code
50+
//=============================================================================
51+
// If the system is in recovery state, we can't use isOperational to
52+
// tell if the enabling process is done, so just wait long enough for
53+
// the process to finish
54+
std::this_thread::sleep_for(std::chrono::seconds(8));
6255

63-
// Start auto recovery if the system is in recovery state, the involved
64-
// Joints will start to move back into allowed position range
65-
if (robot->isRecoveryState()) {
66-
robot->startAutoRecovery();
67-
// Block forever, must reboot the robot and restart user program after
68-
// auto recovery is done
69-
do {
70-
std::this_thread::sleep_for(std::chrono::milliseconds(1));
71-
} while (true);
72-
}
73-
// Otherwise the system is normal, do nothing
74-
else {
75-
log.info(
76-
"Robot system is not in recovery state, nothing to be done, "
77-
"exiting ...");
56+
// Start auto recovery if the system is in recovery state, the involved
57+
// Joints will start to move back into allowed position range
58+
if (robot.isRecoveryState()) {
59+
robot.startAutoRecovery();
60+
// Block forever, must reboot the robot and restart user program
61+
// after auto recovery is done
62+
while (true) {
63+
std::this_thread::sleep_for(std::chrono::seconds(1));
64+
}
65+
}
66+
// Otherwise the system is normal, do nothing
67+
else {
68+
log.info(
69+
"Robot system is not in recovery state, nothing to be done, "
70+
"exiting ...");
71+
}
72+
} catch (const flexiv::Exception& e) {
73+
log.error(e.what());
74+
return 0;
7875
}
7976

8077
return 0;

0 commit comments

Comments
 (0)