Skip to content

Commit

Permalink
Pre-release/v1.3 (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
pzhu-flexiv authored Mar 26, 2024
1 parent 6ff4790 commit 319f200
Show file tree
Hide file tree
Showing 66 changed files with 2,025 additions and 2,442 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:

jobs:
build-ubuntu-22:
# Use Ubuntu 22.04 runner
# Use GitHub-hosted Ubuntu 22.04 runner
runs-on: ubuntu-22.04

steps:
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
make -j$(nproc)
build-ubuntu-20:
# Use Ubuntu 20.04 runner
# Use GitHub-hosted Ubuntu 20.04 runner
runs-on: ubuntu-20.04

steps:
Expand Down Expand Up @@ -126,9 +126,9 @@ jobs:
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
build-windows-2022:
# Use GitHub-hosted Windows 2022 runner
runs-on: windows-2022

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.vs
.DS_Store
config.h
build/
build*/
install/
cloned/
html/
Expand Down
2 changes: 1 addition & 1 deletion 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_rdk VERSION 1.2.0)
project(flexiv_rdk VERSION 1.3.0)

# Configure build type
if(NOT CMAKE_BUILD_TYPE)
Expand Down
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ Flexiv RDK (Robotic Development Kit), a key component of the Flexiv Robotic Soft
| **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+ |
| macOS 12 and above | arm64 | C++, Python | Xcode Command Line Tools |
| Windows 10/11 | x86_64 | C++, Python | MSVC v142+ |

## Quick Start

**NOTE:** the full documentation is in [Flexiv RDK Manual](https://rdk.flexiv.com/manual/).
### Note

* The full documentation is in [Flexiv RDK Manual](https://rdk.flexiv.com/manual/).
* You might need to turn off your computer's firewall to be able to connect to the robot.

### C++ RDK

Expand Down Expand Up @@ -82,20 +85,19 @@ 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 "Desktop development with C++" under the *Workloads* tab during installation. You only need to keep the following components for the selected workload:
1. Install Microsoft Visual Studio 2019 (MSVC v142) or above . 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.
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.

### Python RDK

Python 3.8 and 3.10 are supported by RDK, see Flexiv RDK Manual for more details. A brief instruction is provided below and applies to all supported OS.
Python 3.10 and 3.12 are supported by RDK, see Flexiv RDK Manual for more details. A brief instruction is provided below and applies to all supported OS.

1. Check Python version is 3.8.x or 3.10.x:
1. Check Python version is 3.10.x or 3.12.x:

python3 --version

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.2"
PROJECT_NUMBER = "1.3"

# 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
1 change: 0 additions & 1 deletion example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ set(EXAMPLE_LIST
basics7_auto_recovery
basics8_update_robot_tool
intermediate6_robot_dynamics
intermediate7_teach_by_demonstration
)

# Additional examples for Linux and Mac
Expand Down
58 changes: 27 additions & 31 deletions example/basics1_display_robot_states.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
* @author Flexiv
*/

#include <flexiv/Robot.hpp>
#include <flexiv/Log.hpp>
#include <flexiv/Utility.hpp>
#include <flexiv/robot.h>
#include <flexiv/log.h>
#include <flexiv/utility.h>

#include <iostream>
#include <thread>

/** @brief Print tutorial description */
void printDescription()
void PrintDescription()
{
std::cout << "This tutorial does the very first thing: check connection with the robot server "
"and print received robot states."
Expand All @@ -23,7 +23,7 @@ void printDescription()
}

/** @brief Print program usage help */
void printHelp()
void PrintHelp()
{
// clang-format off
std::cout << "Required arguments: [robot SN]" << std::endl;
Expand All @@ -39,10 +39,8 @@ void printRobotStates(flexiv::Robot& robot, flexiv::Log& log)
{
while (true) {
// 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 << robot.getRobotStates() << std::endl;
log.Info("Current robot states:");
std::cout << robot.states() << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(1));
}
}
Expand All @@ -55,58 +53,56 @@ int main(int argc, char* argv[])
flexiv::Log log;

// Parse parameters
if (argc < 2 || flexiv::utility::programArgsExistAny(argc, argv, {"-h", "--help"})) {
printHelp();
if (argc < 2 || flexiv::utility::ProgramArgsExistAny(argc, argv, {"-h", "--help"})) {
PrintHelp();
return 1;
}
// Serial number of the robot to connect to. Remove any space, for example: Rizon4s-123456
std::string robotSN = argv[1];
std::string robot_sn = argv[1];

// Print description
log.info("Tutorial description:");
printDescription();
log.Info("Tutorial description:");
PrintDescription();

try {
// RDK Initialization
// =========================================================================================
// Instantiate robot interface
flexiv::Robot robot(robotSN);
flexiv::Robot robot(robot_sn);

// Clear fault on robot server if any
if (robot.isFault()) {
log.warn("Fault occurred on robot server, trying to clear ...");
// Clear fault on the connected robot if any
if (robot.fault()) {
log.Warn("Fault occurred on the connected robot, trying to clear ...");
// Try to clear the fault
robot.clearFault();
std::this_thread::sleep_for(std::chrono::seconds(2));
// Check again
if (robot.isFault()) {
log.error("Fault cannot be cleared, exiting ...");
if (!robot.ClearFault()) {
log.Error("Fault cannot be cleared, exiting ...");
return 1;
}
log.info("Fault on robot server is cleared");
log.Info("Fault on the connected robot is cleared");
}

// Enable the robot, make sure the E-stop is released before enabling
log.info("Enabling robot ...");
robot.enable();
log.Info("Enabling robot ...");
robot.Enable();

// Wait for the robot to become operational
while (!robot.isOperational()) {
while (!robot.operational()) {
std::this_thread::sleep_for(std::chrono::seconds(1));
}
log.info("Robot is now operational");
log.Info("Robot is now operational");

// Print States
// =========================================================================================
// Use std::thread to do scheduling so that this example can run on all OS, since not all OS
// support flexiv::Scheduler
std::thread lowPriorityThread(std::bind(printRobotStates, std::ref(robot), std::ref(log)));
std::thread low_priority_thread(
std::bind(printRobotStates, std::ref(robot), std::ref(log)));

// Properly exit thread
lowPriorityThread.join();
low_priority_thread.join();

} catch (const std::exception& e) {
log.error(e.what());
log.Error(e.what());
return 1;
}

Expand Down
41 changes: 19 additions & 22 deletions example/basics2_clear_fault.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
* @author Flexiv
*/

#include <flexiv/Robot.hpp>
#include <flexiv/Log.hpp>
#include <flexiv/Utility.hpp>
#include <flexiv/robot.h>
#include <flexiv/log.h>
#include <flexiv/utility.h>

#include <iostream>
#include <string>
#include <thread>

/** @brief Print tutorial description */
void printDescription()
void PrintDescription()
{
std::cout << "This tutorial clears minor faults from the robot server if any. Note that "
"critical faults cannot be cleared, see RDK manual for more details."
Expand All @@ -24,7 +24,7 @@ void printDescription()
}

/** @brief Print program usage help */
void printHelp()
void PrintHelp()
{
// clang-format off
std::cout << "Required arguments: [robot SN]" << std::endl;
Expand All @@ -43,42 +43,39 @@ int main(int argc, char* argv[])
flexiv::Log log;

// Parse parameters
if (argc < 2 || flexiv::utility::programArgsExistAny(argc, argv, {"-h", "--help"})) {
printHelp();
if (argc < 2 || flexiv::utility::ProgramArgsExistAny(argc, argv, {"-h", "--help"})) {
PrintHelp();
return 1;
}
// Serial number of the robot to connect to. Remove any space, for example: Rizon4s-123456
std::string robotSN = argv[1];
std::string robot_sn = argv[1];

// Print description
log.info("Tutorial description:");
printDescription();
log.Info("Tutorial description:");
PrintDescription();

try {
// RDK Initialization
// =========================================================================================
// Instantiate robot interface
flexiv::Robot robot(robotSN);
flexiv::Robot robot(robot_sn);

// Fault Clearing
// =========================================================================================
// Check if the robot has fault
if (robot.isFault()) {
log.warn("Fault occurred on robot server, trying to clear ...");
// Clear fault on the connected robot if any
if (robot.fault()) {
log.Warn("Fault occurred on the connected robot, trying to clear ...");
// Try to clear the fault
robot.clearFault();
std::this_thread::sleep_for(std::chrono::seconds(2));
// Check again
if (robot.isFault()) {
log.error("Fault cannot be cleared, exiting ...");
if (!robot.ClearFault()) {
log.Error("Fault cannot be cleared, exiting ...");
return 1;
}
log.info("Fault on robot server is cleared");
log.Info("Fault on the connected robot is cleared");
} else {
log.info("No fault on robot server");
log.Info("No fault on the connected robot");
}
} catch (const std::exception& e) {
log.error(e.what());
log.Error(e.what());
return 1;
}

Expand Down
Loading

0 comments on commit 319f200

Please sign in to comment.