diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index dd2335a..4edb1cd 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -23,55 +23,14 @@ jobs: - uses: actions/checkout@v2 - name: Build and install dependencies - # Build and install all dependencies to RDK installation directory. + # Build and install all dependencies to flexiv_omni_teleop installation directory. run: | cd ${{github.workspace}} cd thirdparty bash build_and_install_dependencies.sh ~/teleop_install - name: Build and install library - # Configure CMake, then build and install the flexiv_omni_teleop INTERFACE library to RDK installation directory. - run: | - cd ${{github.workspace}} - mkdir -p build && cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/teleop_install - make install - - - name: Build examples - # Find and link to the flexiv_omni_teleop INTERFACE library, then build all examples. - run: | - cd ${{github.workspace}}/example - mkdir -p build && cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/teleop_install - make -j$(nproc) - - # - name: Build tests - # # Find and link to the flexiv_omni_teleop 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: - # 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: ubuntu-20.04 - - 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 ~/teleop_install - - - name: Build and install library - # Configure CMake, then build and install the flexiv_omni_teleop INTERFACE library to RDK installation directory. + # Configure CMake, then build and install the flexiv_omni_teleop INTERFACE library to flexiv_omni_teleop installation directory. run: | cd ${{github.workspace}} mkdir -p build && cd build diff --git a/CMakeLists.txt b/CMakeLists.txt index 16404d7..48f5061 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,9 @@ -cmake_minimum_required(VERSION 3.18.6) +cmake_minimum_required(VERSION 3.22.1) # =================================================================== # PROJECT SETUP # =================================================================== -project(flexiv_omni_teleop VERSION 0.7.0) +project(flexiv_omni_teleop VERSION 1.0.0) # Configure build type if(NOT CMAKE_BUILD_TYPE) @@ -67,6 +67,11 @@ if(Boost_FOUND) message(STATUS "Found Boost: ${Boost_DIR}") endif() +# OpenSSL +find_package(OpenSSL REQUIRED) +if(OpenSSL_FOUND) + message(STATUS "Found OpenSSL, version: ${OPENSSL_VERSION}, libraries: ${OPENSSL_LIBRARIES}") +endif() # =================================================================== @@ -86,6 +91,7 @@ target_include_directories(${PROJECT_NAME} INTERFACE target_link_libraries(${PROJECT_NAME} INTERFACE ${TELEOP_STATIC_LIBRARY} + ${OPENSSL_LIBRARIES} Threads::Threads Eigen3::Eigen fastrtps diff --git a/README.md b/README.md index 41202a9..326b4df 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Flexiv Omni Teleop SDK +# Flexiv Omni Teleop -![CMake Badge](https://github.com/flexivrobotics/flexiv_omni_teleop/actions/workflows/cmake.yml/badge.svg) ![Version](https://img.shields.io/badge/version-0.7-blue.svg) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) +![CMake Badge](https://github.com/flexivrobotics/flexiv_omni_teleop/actions/workflows/cmake.yml/badge.svg) ![Version](https://img.shields.io/badge/version-1.0-blue.svg) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) -The Flexiv Omni Teleop SDK provides C++ APIs for developing complex and customized applications involving robot-robot or device-robot teleoperation. The supported devices are listed below. +The Flexiv Omni Teleop 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 @@ -12,55 +12,63 @@ The Flexiv Omni Teleop SDK provides C++ APIs for developing complex and customiz ## Compatibility -| **Supported OS** | **Supported processor** | **Supported language** | **Required compiler kit** | -| -------------------------- | ----------------------- | ---------------------- | ------------------------- | -| Linux (Ubuntu 20.04/22.04) | x86_64 | C++ | build-essential | - -### Applying for a license -1. Run the generator to generate your feature ID and provide the feature id to apply for the license. -Note: The feature id is a unique identifier for your application and is bound to your local computer. Please generate feature ID and use license on the same computer. +| **Supported OS** | **Supported processor** | **Supported language** | **Required compiler kit** | +| -------------------- | ----------------------- | ---------------------- | ------------------------- | +| Linux (Ubuntu 22.04) | x86_64 | C++ | build-essential | ### Compile and install for Linux -1. In a new Terminal, install C++ compiler, Git, and CMake (with GUI) using the package manager: +1. In a new Terminal, install C++ compiler, libssl-dev, net-tools, Git, and CMake (with GUI) using the package manager: + + sudo apt install build-essential libssl-dev net-tools git cmake cmake-qt-gui -y - ```bash - sudo apt install build-essential git cmake cmake-qt-gui -y - ``` 2. Choose a directory for installing ``flexiv_omni_teleop`` library and all its dependencies. For example, a new folder named ``teleop_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: - ```bash - cd flexiv_omni_teleop/thirdparty - bash build_and_install_dependencies.sh ~/teleop_install - ``` + cd flexiv_omni_teleop/thirdparty + bash build_and_install_dependencies.sh ~/teleop_install + 4. In a new Terminal, use CMake to configure `flexiv_omni_teleop`: - ```bash - cd flexiv_omni_teleop - mkdir build && cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/teleop_install - ``` + cd flexiv_omni_teleop + mkdir build && cd build + cmake .. -DCMAKE_INSTALL_PREFIX=~/teleop_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. + 5. Compile and install `flexiv_omni_teleop` library: - ```bash - cd flexiv_omni_teleop/build - cmake --build . --target install --config Release - ``` + cd flexiv_omni_teleop/build + cmake --build . --target install --config Release + NOTE: the installation of `flexiv_omni_teleop` 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 + 1. To find and link to the installed `flexiv_omni_teleop` library to a user project, using the provided example project for instance: - ```bash - cd flexiv_omni_teleop/example - mkdir build && cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/teleop_install - cmake --build . --config Release -j 4 - ``` + cd flexiv_omni_teleop/example + mkdir build && cd build + cmake .. -DCMAKE_INSTALL_PREFIX=~/teleop_install + cmake --build . --config Release -j 4 + NOTE: ``-D`` followed by ``CMAKE_INSTALL_PREFIX`` tells user project's CMake where to find the installed `flexiv_omni_teleop` library. -2. Set all the robots were in `Auto/Remote Mode` via flexiv Elements, then to run an compiled example program: - ```bash - sudo ./ -l [local_robot_serial_number] -r [remote_robot_serial_number] -c [path-to-licenseCfg.json] - ``` +### Run Omni-Teleop + +1. Apply for Omni license to run Omni-Teleop. See [Omni_license.md](omni_license_generator/Omni_license.md) + +2. Set all the robots to `Auto/Remote Mode` via flexiv Elements, then to run the compiled example program: + + ./ [remote_robot_SN] [local_robot_SN] [path_to_omni_licenseCfg.json] + +### API Documentation + +API doc can be generated using doxygen + + sudo apt install doxygen-latex graphviz + cd flexiv_omni_teleop + doxygen doc/Doxygen.in + +The generated API doc is under ```flexiv_omni_teleop/doc/html ```. You can open any of the html file with your web browser to view it. diff --git a/doc/Doxygen.in b/doc/Doxygen.in index 0cac79d..b9d9013 100644 --- a/doc/Doxygen.in +++ b/doc/Doxygen.in @@ -32,13 +32,13 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = "flexiv_omni_teleoperation" +PROJECT_NAME = "Flexiv Omni Teleop" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "0.6" +PROJECT_NUMBER = "1.0" # 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 diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 0a77ca3..1358c30 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.18.6) +cmake_minimum_required(VERSION 3.22.1) project(flexiv_omni_teleop_example) @@ -18,7 +18,7 @@ endif() list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) set(EXAMPLE_LIST - basic_free_space_motion_teleop + basics1_cartesian_teleop ) find_package(flexiv_omni_teleop REQUIRED) diff --git a/example/basic_free_space_motion_teleop.cpp b/example/basic_free_space_motion_teleop.cpp deleted file mode 100644 index 5b7de2a..0000000 --- a/example/basic_free_space_motion_teleop.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/** - * @example basic_free_space_motion_teleop.cpp - * @author flexiv - * @brief basic free space motion robot to robot teleoperation using flexiv - * Rizon4s robots - * @copyright Copyright (c) 2023 - */ - -// Flexiv -#include -#include -#include -#include -#include - -using namespace flexiv; - -/** @brief Print usage of example*/ -void printHelp() -{ - // clang-format off - std::cout<<"Invalid program arguments"<"< +#include +#include +#include +#include +#include +#include +namespace { +constexpr std::array k_preferredJntPos + = {-0.67, -0.98, 0.89, 1.55, -0.85, 0.54, 0.46}; ///< Preferred joint position +const std::array k_defaultMaxRemoteWrench + = {80.0, 80.0, 80.0, 24.0, 24.0, 24.0}; ///< Maximum contact wrench of remote robot +std::atomic g_stop_sched = {false}; ///< Atomic signal to stop scheduler tasks +} + +void printHelp() +{ + // clang-format off + std::cout << "Invalid program arguments"<"<>> Simple command line GUI for teleop robot axis lock <<<" + << std::endl; + std::cout << "- x: lock/unlock translational motion along X axis in World frame." + << std::endl; + std::cout << "- y: lock/unlock translational motion along Y axis in World frame." + << std::endl; + std::cout << "- z: lock/unlock translational motion along Z axis in World frame." + << std::endl; + + std::cout << "- q: lock/unlock rotational motion along X axis in World frame." + << std::endl; + std::cout << "- w: lock/unlock rotational motion along Y axis in World frame." + << std::endl; + std::cout << "- e: lock/unlock rotational motion along Z axis in World frame." + << std::endl; + + std::cout << "- X: lock/unlock translational motion along X axis in TCP frame." + << std::endl; + std::cout << "- Y: lock/unlock translational motion along Y axis in TCP frame." + << std::endl; + std::cout << "- Z: lock/unlock translational motion along Z axis in TCP frame." + << std::endl; + + std::cout << "- Q: lock/unlock rotational motion along X axis in TCP frame." + << std::endl; + std::cout << "- W: lock/unlock rotational motion along Y axis in TCP frame." + << std::endl; + std::cout << "- E: lock/unlock rotational motion along Z axis in TCP frame." + << std::endl; + std::cout << "please input command >> " << std::endl; + break; + case 'x': + cmd.trans_axis_lock_list_[0] = !cmd.trans_axis_lock_list_[0]; + cmd.coord = flexiv::omni::teleop::CoordType::CD_WORLD; + + break; + case 'y': + cmd.trans_axis_lock_list_[1] = !cmd.trans_axis_lock_list_[1]; + cmd.coord = flexiv::omni::teleop::CoordType::CD_WORLD; + break; + case 'z': + cmd.trans_axis_lock_list_[2] = !cmd.trans_axis_lock_list_[2]; + cmd.coord = flexiv::omni::teleop::CoordType::CD_WORLD; + break; + case 'q': + cmd.ori_axis_lock_list_[0] = !cmd.ori_axis_lock_list_[0]; + cmd.coord = flexiv::omni::teleop::CoordType::CD_WORLD; + break; + case 'w': + cmd.ori_axis_lock_list_[1] = !cmd.ori_axis_lock_list_[1]; + cmd.coord = flexiv::omni::teleop::CoordType::CD_WORLD; + break; + case 'e': + cmd.ori_axis_lock_list_[2] = !cmd.ori_axis_lock_list_[2]; + cmd.coord = flexiv::omni::teleop::CoordType::CD_WORLD; + break; + + case 'X': + cmd.trans_axis_lock_list_[0] = !cmd.trans_axis_lock_list_[0]; + cmd.coord = flexiv::omni::teleop::CoordType::CD_TCP; + break; + case 'Y': + cmd.trans_axis_lock_list_[1] = !cmd.trans_axis_lock_list_[1]; + cmd.coord = flexiv::omni::teleop::CoordType::CD_TCP; + break; + case 'Z': + cmd.trans_axis_lock_list_[2] = !cmd.trans_axis_lock_list_[2]; + cmd.coord = flexiv::omni::teleop::CoordType::CD_TCP; + break; + case 'Q': + cmd.ori_axis_lock_list_[0] = !cmd.ori_axis_lock_list_[0]; + cmd.coord = flexiv::omni::teleop::CoordType::CD_TCP; + break; + case 'W': + cmd.ori_axis_lock_list_[1] = !cmd.ori_axis_lock_list_[1]; + cmd.coord = flexiv::omni::teleop::CoordType::CD_TCP; + break; + case 'E': + cmd.ori_axis_lock_list_[2] = !cmd.ori_axis_lock_list_[2]; + cmd.coord = flexiv::omni::teleop::CoordType::CD_TCP; + break; + + default: + std::cerr << "Invalid command, please enter \'m\' for help \n"; + break; + } + teleop.setLocalAxisLockCmd(cmd); + std::cout << " Axis [X] in " << flexiv::omni::teleop::CoordTypeStr[cmd.coord] + << " frame locking status : " << cmd.trans_axis_lock_list_[0] << std::endl; + std::cout << " Axis [Y] in " << flexiv::omni::teleop::CoordTypeStr[cmd.coord] + << " frame locking status : " << flexiv::omni::teleop::CoordTypeStr[cmd.coord] + << cmd.trans_axis_lock_list_[1] << std::endl; + std::cout << " Axis [Z] in " << flexiv::omni::teleop::CoordTypeStr[cmd.coord] + << " frame locking status : " << flexiv::omni::teleop::CoordTypeStr[cmd.coord] + << cmd.trans_axis_lock_list_[2] << std::endl; + std::cout << " Axis [Rx] in " << flexiv::omni::teleop::CoordTypeStr[cmd.coord] + << " frame locking status : " << flexiv::omni::teleop::CoordTypeStr[cmd.coord] + << cmd.ori_axis_lock_list_[0] << std::endl; + std::cout << " Axis [Ry] in " << flexiv::omni::teleop::CoordTypeStr[cmd.coord] + << " frame locking status : " << flexiv::omni::teleop::CoordTypeStr[cmd.coord] + << cmd.ori_axis_lock_list_[1] << std::endl; + std::cout << " Axis [Rz] in " << flexiv::omni::teleop::CoordTypeStr[cmd.coord] + << " frame locking status : " << flexiv::omni::teleop::CoordTypeStr[cmd.coord] + << cmd.ori_axis_lock_list_[2] << std::endl; + } + return; +} + +int main(int argc, char* argv[]) +{ + std::string remoteSN; + std::string localSN; + std::string licCfgPath; + + if (argc != 4) { + printHelp(); + return 1; + } + remoteSN = argv[1]; + localSN = argv[2]; + licCfgPath = argv[3]; + + std::cout << "Flexiv Omni-Teleop example" << std::endl; + std::cout << "Copyright (C) 2016-2024 Flexiv" << std::endl; + std::cout << "All Rights Reserved." << std::endl << std::endl; + + std::cout << "Remote SN: " + remoteSN << std::endl; + std::cout << "Local SN: " + localSN << std::endl; + std::cout << "License config file: " + licCfgPath << std::endl; + + try { + // Create Omni-Teleop + flexiv::omni::teleop::Robot2RobotTeleop teleop(localSN, remoteSN, licCfgPath); + + // Enable teleop robots + teleop.enable(); + + // Init teleop robots + teleop.init(); + + // Set preferred joint position to a better configuration + teleop.setLocalNullSpacePosture(k_preferredJntPos); + teleop.setRemoteNullSpacePosture(k_preferredJntPos); + + // Set max remote contact wrench + teleop.setRemoteMaxWrench(k_defaultMaxRemoteWrench); + + // Create real-time scheduler to step periodic tasks + flexiv::omni::teleop::Scheduler scheduler; + + // Wait for elbow posture ready + std::this_thread::sleep_for(std::chrono::seconds(3)); + + // Add periodic task with 1ms interval and highest applicable priority + scheduler.AddTask(std::bind(&periodicTeleopTask, std::ref(teleop)), "HP periodic teleop", 1, + scheduler.max_priority()); + + scheduler.AddTask(std::bind(&periodicConsoleTask, std::ref(teleop)), "LP Periodic console", + 1000, scheduler.min_priority()); + + // Start all added tasks, this is by default a blocking method + scheduler.Start(); + + std::cout << "Flexiv Omni-Teleop started ... "; + + // Wait a bit for any last-second robot log message to arrive and get printed + std::this_thread::sleep_for(std::chrono::seconds(1)); + + // Block until signal received + while (!g_stop_sched) { + std::this_thread::sleep_for(std::chrono::seconds(1)); + } + + } catch (const std::exception& e) { + std::cerr << (e.what()); + return 1; + } + + return 0; +} \ No newline at end of file diff --git a/include/flexiv/omni/teleop/Robot2RobotTeleop.hpp b/include/flexiv/omni/teleop/Robot2RobotTeleop.hpp index 7805658..7a0b840 100644 --- a/include/flexiv/omni/teleop/Robot2RobotTeleop.hpp +++ b/include/flexiv/omni/teleop/Robot2RobotTeleop.hpp @@ -12,136 +12,202 @@ namespace omni { namespace teleop { /** - * @brief Main interface for robot-robot teleop, containing several function categories - * and background services. + * @brief Main interface for robot-robot teleop in Cartesian space, containing several function + * categories and background services. */ class Robot2RobotTeleop { public: - Robot2RobotTeleop() = delete; - - /** - * @brief [Blocking] Create a flexiv::omni::teleop instance as the main teleoperation interface. - * Robot2RobotTeleop services will initialize and connection with the robots will be - * established. - * @param[in] localSN Serial number of the local robot - * @param[in] remoteSN Serial number of the remote robot - * @param [in] licensePath Path to the license config json file. - * @throw std::runtime_error if the initialization sequence failed. - * @throw std::logic_error if the connected robot does not have a valid license; or this - * Teleop library version is incompatible with the connected robot; or model of the connected - * robot is not supported. - * @warning This constructor blocks until the initialization sequence is successfully finished - * and connection with the robot is established. - */ - Robot2RobotTeleop( - const std::string& localSN, const std::string& remoteSN, const std::string& licensePath); - virtual ~Robot2RobotTeleop(); - - /** - * @brief [Blocking] Initialize teleoperation robots states and coordinate bias between local - * and remote. - * @throw std::logic_error if the robot is not connected. - * @throw std::runtime_error if failed to execute the request. - * @note This function blocks until the request is successfully executed. - */ - void init(void); - - /** - * @brief [Blocking] Enable the teleoperation, if all E-stop are released and there's no - * fault, robots will release brakes, and becomes operational a few seconds later. - * @throw std::logic_error if the robot is not connected. - * @throw std::runtime_error if failed to execute the request. - * @note This function blocks until the request is successfully executed. - */ - void enable(void); - - /** - * @brief [Blocking] Stop teleoperation. - * @throw std::runtime_error if failed to stop teleoperation. - * @note This function blocks until teleoperation comes to a complete stop. - */ - void stop(void); - - /** - * @brief [Non-blocking] Check if teleoperaion in fault state. - * @return True: teleoperation has fault, false: everything normal. - */ - bool isFault(void); - - /** - * @brief [Blocking] Clear minor fault. - * @throw std::runtime_error if failed to execute the request. - * @note This function blocks until the request is successfully executed. - */ - void clearFault(void); - - /** - * @brief [Blocking/Non-blocking] Run teleoperation. The remote will always imitate the - * movements of the local. - * @note The remote pose will not exactly the same as that of the local. User can keep the - * remote still by pressing the pedal, while the local can drag freely. When the local reaches - * an appropriate pose, release the pedal and the remote will follow the local again. - * @warning Please connect the pedal to the DI0 and 24V channel of the local control box. And - * ensure that the circuit only connects when the pedal is pressed down. - * @param [in] isBlocking True to block the whole program while running teleoperation, false to - * set a non-blocking running behavior. - * @throw std::runtime_error if failed to execute the request. - */ - void run(bool isBlocking); - - /** - * @brief [Non-blocking] Set local robot Cartesian motion stiffness. - * @param[in] stiffness Cartesian motion stiffness: \f$ K_d \in \mathbb{R}^{6 \times 1} \f$. - * Consists of \f$ \mathbb{R}^{3 \times 1} \f$ linear stiffness and \f$ - * \mathbb{R}^{3 \times 1} \f$ angular stiffness: \f$ [k_x, k_y, k_z, k_{Rx}, k_{Ry}, k_{Rz}]^T - * \f$. Valid range: [0, RobotInfo::nominalK]. Unit: \f$ [N/m]~[Nm/rad] \f$. - * @throw std::invalid_argument if [stiffness] contains any value outside the valid range. - * @throw std::logic_error if local robot is not initialized. - * @warning The local robot will automatically reset to its nominal stiffness upon re-entering - * run. - */ - void setLocalCartesianStiffness(const std::array& stiffness); - - /** - * @brief [Non-blocking] Set local robot Cartesian motion stiffness. - * @param[in] stiffness Cartesian motion stiffness: \f$ K_d \in \mathbb{R}^{6 \times 1} \f$. - * Consists of \f$ \mathbb{R}^{3 \times 1} \f$ linear stiffness and \f$ - * \mathbb{R}^{3 \times 1} \f$ angular stiffness: \f$ [k_x, k_y, k_z, k_{Rx}, k_{Ry}, k_{Rz}]^T - * \f$. Valid range: [0, RobotInfo::nominalK]. Unit: \f$ [N/m]~[Nm/rad] \f$. - * @throw std::invalid_argument if [stiffness] contains any value outside the valid range. - * @throw std::logic_error if local robot is not initialized. - * @warning The local robot will automatically reset to its nominal stiffness upon re-entering - * run. - */ - void setRemoteCartesianStiffness(const std::array& stiffness); - - /** - * @brief [Non-blocking] Set the local robot axis locking command. - * - * @param[in] cmd User input command to lock the motion of the specified axis in the reference - * coordinate. - */ - void setLocalAxisLockCmd(const AxisLockDefs& cmd); - - /** - * @brief [Non-blocking] Get the local robot axis locking status - * - * @param[out] data Current axis locking state of local robot. - */ - void getLocalAxisLockState(AxisLockDefs& data); - - /** - * @brief [Non-blocking] Get the local robot axis locking status - * @warning This fuction is less efficient than the other overloaded one as additional runtime - * memory allocation and data copying are performed. - * @return AxisLockDefs - */ - AxisLockDefs getLocalAxisLockState(void); + Robot2RobotTeleop() = delete; + Robot2RobotTeleop(const Robot2RobotTeleop&) = delete; + Robot2RobotTeleop(Robot2RobotTeleop&&) = delete; + Robot2RobotTeleop& operator=(const Robot2RobotTeleop&) = delete; + /** + * @brief [Blocking] Create a flexiv::omni::teleop instance as the main Omni-Teleop interface. + * Omni-Teleop services will initialize and connection with the local and remote robot will be + * established. + * @param[in] localSN Serial number of the local robot, e.g. Rizon4s-062001. Only Rizon4s is + * supported. + * @param[in] remoteSN Serial number of the remote robot, e.g. Rizon4s-062002. Only Rizon4s is + * supported. + * @param [in] licensePath Path to the omni license config json file. See README.md to apply for + * omni license. + * @throw std::runtime_error if the initialization sequence failed. + * @throw std::logic_error if the connected robot does not have a valid license; or this + * Teleop library version is incompatible with the connected robot; or model of the connected + * robot is not supported. + * @warning This constructor blocks until the initialization sequence is successfully finished + * and connection with the robot is established. + */ + Robot2RobotTeleop( + const std::string& localSN, const std::string& remoteSN, const std::string& licensePath); + virtual ~Robot2RobotTeleop(); + + /** + * @brief [Blocking] Initialize Omni-Teleop robots states, this will zeroing force/torque sensors, + * make sure nothing is in contact with the local and remote robots. + * @throw std::logic_error if robots are not connected. + * @throw std::runtime_error if failed to execute the request. + * @note This function blocks until the request is successfully executed. + */ + void init(void); + + /** + * @brief [Blocking] Enable the Omni-Teleop, if all E-stop are released and there's no + * fault, both local and remote robots will release brakes, and becomes operational a few seconds + * later. + * @throw std::logic_error if the robot is not connected. + * @throw std::runtime_error if failed to execute the request. + * @note This function blocks until the request is successfully executed. + */ + void enable(void); + + /** + * @brief [Blocking] Stop Omni-Teleop. + * @throw std::runtime_error if failed to stop Omni-Teleop. + * @note This function blocks until Omni-Teleop comes to a complete stop. + */ + void stop(void); + + /** + * @brief [Non-blocking] Check if robots in fault state. + * @return True: Omni-Teleop has fault, false: everything normal. + */ + bool isFault(void); + + /** + * @brief [Non-blocking] Whether the local and remote robots are normally operational, which + * requires the following conditions to be met: enabled, brakes fully released, in auto-remote + * mode, no fault, and not in reduced state. + * @return True: operational, false: not operational. + * @warning The robot won't execute any command until it becomes normally operational. + */ + bool isOperational(void); + + /** + * @brief [Blocking] Clear minor fault of the local and remote robots. + * @return True: successfully cleared fault, false: cannot clear fault. + * @throw std::runtime_error if failed to deliver the request. + * @note This function blocks until fault on local and remote is successfully cleared or + * maximum number of attempts is reached. + */ + bool clearFault(void); + + /** + * @brief [Non-blocking] Periodically step Omni-Teleop and the called frequency should be 1KHz. + * The remote will always imitate the movements of the local and feedback the external wrench to + * the local. + * @note The remote pose will not exactly the same as that of the local. User can keep the remote + * still by releasing the pedal, while the local can drag freely. When the local reaches an + * appropriate pose, press down the pedal and the remote will follow the local again. + * @note Please connect the pedal to the DI0 and 24V channel of the local control box. And + * ensure that the circuit only connects when the pedal is pressed down. + * @throw std::runtime_error if failed to execute the request. + */ + void step(void); + + /** + * @brief [Non-blocking] Set preferred joint positions for the null-space posture control of local + * robot. + * @param[in] preferredPositions Preferred joint positions for the null-space posture control: + * \f$ q_{ns} \in \mathbb{R}^{n \times 1} \f$. Valid range: [TeleopRobotInfo::qMin, + * TeleopRobotInfo::qMax]. Unit: \f$ [rad] \f$. + * @throw std::invalid_argument if [preferredPositions] contains any value outside the valid + * range. + * @throw std::logic_error if Omni-Teleop was not successfully initialized. + * @note This setting will persist across the applicable control modes until changed again. + * @par Null-space posture control + * Similar to human arm, a robotic arm with redundant joint-space degree(s) of freedom (DOF > 6) + * can change its overall posture without affecting the ongoing primary task. This is achieved + * through a technique called "null-space control". After the preferred joint positions for a + * desired robot posture is set using this function, the robot's null-space control module will + * try to pull the arm as close to this posture as possible without affecting the primary + * Cartesian motion-force control task. + */ + void setLocalNullSpacePosture(const std::array& preferredPositions); + + /** + * @brief [Non-blocking] Set preferred joint positions for the null-space posture control of + * remote robot. + * @param[in] preferredPositions Preferred joint positions for the null-space posture control: + * \f$ q_{ns} \in \mathbb{R}^{n \times 1} \f$. Valid range: [TeleopRobotInfo::qMin, + * TeleopRobotInfo::qMax]. Unit: \f$ [rad] \f$. + * @throw std::invalid_argument if [preferredPositions] contains any value outside the valid + * range. + * @throw std::logic_error if Omni-Teleop was not successfully initialized. + * @note This setting will persist across the applicable control modes until changed again. + * @par Null-space posture control + * Similar to human arm, a robotic arm with redundant joint-space degree(s) of freedom (DOF > 6) + * can change its overall posture without affecting the ongoing primary task. This is achieved + * through a technique called "null-space control". After the preferred joint positions for a + * desired robot posture is set using this function, the robot's null-space control module will + * try to pull the arm as close to this posture as possible without affecting the primary + * Cartesian motion-force control task. + */ + void setRemoteNullSpacePosture(const std::array& preferredPositions); + + /** + * @brief [Non-blocking] Set maximum wrench for the remote robot. The controller will regulate its + * output to maintain contact wrench (force and moment) with the environment under the set values. + * @param[in] max_wrench Maximum contact wrench (force and moment): \f$ F_max \in \mathbb{R}^{6 + * \times 1} \f$. Consists of \f$ \mathbb{R}^{3 \times 1} \f$ maximum force and \f$ + * \mathbb{R}^{3 \times 1} \f$ maximum moment: \f$ [f_x, f_y, f_z, m_x, m_y, m_z]^T \f$. Unit: + * \f$ [N]~[Nm] \f$. + * @throw std::invalid_argument if [max_wrench] contains any negative value. + */ + void setRemoteMaxWrench(const std::array& max_wrench); + + /** + * @brief [Non-blocking] Set the repulsive wrench in world/TCP frame for the remote robot. + * @param[in] repulsiveWrench The virtual repulsive wrench that will applied on the remote + * robot.(force and moment): \f$ repulsiveW \in \mathbb{R}^{6 \times 1} \f$. Consists of \f$ + * \mathbb{R}^{3 \times 1} \f$ repulsive force and \f$ \mathbb{R}^{3 \times 1} \f$ repulsive + * moment: \f$ [f_x, f_y, f_z, m_x, m_y, m_z]^T \f$. Unit: \f$ [N]~[Nm] \f$. + * @param[in] inWorld Flag to indicate that the repulsive wrench is in World frame or TCP frame. + * true in World frame, false in TCP frame. + * @note This virtual repulsive wrench will only work on those unlocked axis. + * @see setLocalAxisLockCmd + * @see getLocalAxisLockState + */ + void setRepulsiveWrench( + const std::array& repulsiveWrench, bool inWorld = true); + + /** + * @brief [Non-blocking] Access general information of the local robot. + * @return TeleopRobotInfo instance. + */ + TeleopRobotInfo getLocalInfo(void) const; + + /** + * @brief [Non-blocking] Access general information of the remote robot. + * @return TeleopRobotInfo instance. + */ + TeleopRobotInfo getRemoteInfo(void) const; + + /** + * @brief [Non-blocking] Set the local robot axis locking command. + * @param[in] cmd User input command to lock the motion of the specified axis in the reference + * coordinate. + */ + void setLocalAxisLockCmd(const AxisLockDefs& cmd); + + /** + * @brief [Non-blocking] Get the local robot axis locking status + * @param[out] data Current axis locking state of local robot. + */ + void getLocalAxisLockState(AxisLockDefs& data); + + /** + * @brief [Non-blocking] Get the local robot axis locking status + * @warning This fuction is less efficient than the other overloaded one as additional runtime + * memory allocation and data copying are performed. + * @return AxisLockDefs + */ + AxisLockDefs getLocalAxisLockState(void); private: - class Impl; - std::unique_ptr m_pImpl; + class Impl; + std::unique_ptr pimpl_; }; } // namespace teleop diff --git a/include/flexiv/omni/teleop/Scheduler.hpp b/include/flexiv/omni/teleop/Scheduler.hpp new file mode 100644 index 0000000..6fbd2c3 --- /dev/null +++ b/include/flexiv/omni/teleop/Scheduler.hpp @@ -0,0 +1,110 @@ +/** + * @file scheduler.hpp + * @copyright Copyright (C) 2016-2024 Flexiv Ltd. All Rights Reserved. + */ +#pragma once +#include +#include +#include +namespace flexiv { +namespace omni { +namespace teleop { +/** + * @class Scheduler + * @brief Real-time scheduler that can simultaneously run multiple periodic + * tasks. Parameters for each task are configured independently. + */ +class Scheduler +{ +public: + /** + * @brief [Blocking] Create an instance and initialize the real-time scheduler. + * @throw std::runtime_error if the initialization sequence failed. + * @warning This constructor blocks until the initialization sequence is successfully finished. + */ + Scheduler(); + virtual ~Scheduler(); + + /** + * @brief [Non-blocking] Add a new periodic task to the scheduler's task pool. Each task in the + * pool is assigned to a dedicated thread with independent thread configuration. + * @param[in] callback Callback function of user task. + * @param[in] task_name A unique name for this task. + * @param[in] interval Execution interval of this periodic task [ms]. The minimum available + * interval is 1 ms, equivalent to 1 kHz loop frequency. + * @param[in] priority Priority for this task thread, can be set to + * min_priority()–max_priority() for real-time scheduling, or 0 for non-real-time scheduling. + * When the priority is set to use real-time scheduling, this thread becomes a real-time thread + * and can only be interrupted by threads with higher priority. When the priority is set to use + * non-real-time scheduling (i.e. 0), this thread becomes a non-real-time thread and can be + * interrupted by any real-time threads. The common practice is to set priority of the most + * critical tasks to max_priority() or near, and set priority of other non-critical tasks to 0 + * or near. To avoid race conditions, the same priority should be assigned to only one task. + * @param[in] cpu_affinity CPU core for this task thread to bind to, can be set to 2–(num_cores + * - 1). This task thread will only run on the specified CPU core. If left with the default + * value (-1), then this task thread will not bind to any CPU core, and the system will decide + * which core to run this task thread on according to the system's own strategy. The common + * practice is to bind the high-priority task to a dedicated spare core, and bind low-priority + * tasks to other cores or just leave them unbound (cpu_affinity = -1). + * @throw std::logic_error if the scheduler is already started or is not fully initialized yet. + * @throw std::invalid_argument if the specified interval/priority/affinity is invalid or the + * specified task name is duplicate. + * @throw std::runtime_error if an error is triggered by the client computer. + * @note Setting CPU affinity on macOS has no effect, as its Mach kernel takes full control of + * thread placement so CPU binding is not supported. + * @warning Calling this method after start() is not allowed. + * @warning For maximum scheduling performance, setting CPU affinity to 0 or 1 is not allowed: + * core 0 is usually the default core for system processes and can be crowded; core 1 is + * reserved for the scheduler itself. + */ + void AddTask(std::function&& callback, const std::string& task_name, int interval, + int priority, int cpu_affinity = -1); + + /** + * @brief [Blocking] Start all added tasks. A dedicated thread will be created for each added + * task and the periodic execution will begin. + * @throw std::logic_error if the scheduler is not initialized yet. + * @throw std::runtime_error if failed to start the tasks. + * @note This function blocks until all added tasks are started. + */ + void Start(); + + /** + * @brief [Blocking] Stop all added tasks. The periodic execution will stop and all task threads + * will be closed with the resources released. + * @throw std::logic_error if the scheduler is not initialized or the tasks are not started yet. + * @throw std::runtime_error if failed to stop the tasks. + * @note Calling start() again can restart the added tasks. + * @note This function blocks until all task threads have exited and resources are released. + * @warning This function cannot be called from within a task thread. + */ + void Stop(); + + /** + * @brief [Non-blocking] Get maximum available priority for user tasks. + * @return The maximum priority that can be set for a user task with real-time scheduling policy + * when calling AddTask(). + */ + int max_priority() const; + + /** + * @brief [Non-blocking] Get minimum available priority for user tasks. + * @return The minimum priority that can be set for a user task with real-time scheduling policy + * when calling AddTask(). + */ + int min_priority() const; + + /** + * @brief [Non-blocking] Get number of tasks added to the scheduler. + * @return Number of added tasks. + */ + size_t num_tasks() const; + +private: + class Impl; + std::unique_ptr pimpl_; +}; + +} // namespace teleop +} // namespace omni +} // namespace flexiv diff --git a/include/flexiv/omni/teleop/TeleopDefs.hpp b/include/flexiv/omni/teleop/TeleopDefs.hpp index 3c24bfe..c2b0c04 100644 --- a/include/flexiv/omni/teleop/TeleopDefs.hpp +++ b/include/flexiv/omni/teleop/TeleopDefs.hpp @@ -14,14 +14,17 @@ namespace teleop { /** Robot Cartesian-space degrees of freedom \f$ m \f$ */ constexpr size_t k_cartDOF = 6; +/** Robot joint-space degrees of freedom \f$ n \f$ */ +constexpr size_t k_jointDOF = 7; + /** * @brief Reference coordinate that the axis to be locked */ enum CoordType { - CD_UNKNOWN = 0, ///> Unknown coordinate - CD_TCP, ///> TCP coordinate of local robot - CD_WORLD ///> WORLD coordinate of local robot + CD_UNKNOWN = 0, ///> Unknown coordinate + CD_TCP, ///> TCP coordinate of local robot + CD_WORLD ///> WORLD coordinate of local robot }; @@ -35,12 +38,12 @@ static const std::string CoordTypeStr[] = {"UNKNOWN", "TCP", "BASE"}; */ static inline CoordType getCoordType(const std::string& str) { - for (size_t i = 0; i < CD_WORLD - CD_UNKNOWN + 1; i++) { - if (str == CoordTypeStr[i]) { - return static_cast(i); - } + for (size_t i = 0; i < CD_WORLD - CD_UNKNOWN + 1; i++) { + if (str == CoordTypeStr[i]) { + return static_cast(i); } - return CD_UNKNOWN; + } + return CD_UNKNOWN; } /** @@ -49,22 +52,44 @@ static inline CoordType getCoordType(const std::string& str) */ struct AxisLockDefs { - /** - * @brief Reference coordinate that the axis to be locked - */ - CoordType coord = CoordType::CD_UNKNOWN; + /** + * @brief Reference coordinate that the axis to be locked + */ + CoordType coord = CoordType::CD_UNKNOWN; + + /** + * @brief Translation axis locking list, the corresponding axis order is \f$ [X, Y, Z] \f$. True + * for locking, false for floating. + */ + std::array trans_axis_lock_list_ = {false, false, false}; + + /** + * @brief Orientation axis locking list, the corresponding axis order is \f$ [Rx, Ry, Rz] \f$. + * True for locking, false for floating. + */ + std::array ori_axis_lock_list_ = {false, false, false}; +}; + +struct TeleopRobotInfo +{ + /** + * Lower limits of joint positions: \f$ q_{min} \in \mathbb{R}^{n \times 1} \f$. + * Unit: \f$ [rad] \f$. + */ + std::array qMin = {}; - /** - * @brief Translation axis locking list, the corresponding axis order is \f$ [X, Y, Z] \f$. True - * for locking, false for floating. - */ - std::array m_transAxisLockList = {false, false, false}; + /** + * Upper limits of joint positions: \f$ q_{max} \in \mathbb{R}^{n \times 1} \f$. + * Unit: \f$ [rad] \f$. + */ + std::array qMax = {}; - /** - * @brief Orientation axis locking list, the corresponding axis order is \f$ [Rx, Ry, Rz] \f$. - * True for locking, false for floating. - */ - std::array m_oriAxisLockList = {false, false, false}; + /** + * Measured joint positions using link-side encoder: \f$ q \in \mathbb{R}^{n \times 1} \f$. + * This is the direct measurement of joint positions, preferred for most cases. + * Unit: \f$ [rad] \f$. + */ + std::array qCurrent = {}; }; } // namespace teleop diff --git a/lib/libflexiv_omni_teleop.x86_64-linux-gnu.a b/lib/libflexiv_omni_teleop.x86_64-linux-gnu.a index b77d213..f892871 100644 Binary files a/lib/libflexiv_omni_teleop.x86_64-linux-gnu.a and b/lib/libflexiv_omni_teleop.x86_64-linux-gnu.a differ diff --git a/license/generator b/license/generator deleted file mode 100755 index c018f4c..0000000 Binary files a/license/generator and /dev/null differ diff --git a/omni_license_generator/Omni_license.md b/omni_license_generator/Omni_license.md new file mode 100644 index 0000000..76cb5bd --- /dev/null +++ b/omni_license_generator/Omni_license.md @@ -0,0 +1,16 @@ +# Applying for Omni license +1. The Omni license is forcibly bound to the user's Ubuntu computer hardware, so before proceeding with the following steps, make sure you have prepared a physical computer with Ubuntu 22.04 and CPU platform x86_64. If you need compatible with other operating systems or CPU architectures, please contact Flexiv. +2. Install net-tools + ```bash + sudo apt update + sudo apt install net-tools + ``` +3. Run the generator under ``flexiv_omni_teleop/omni_license_generator`` on your computer. + ```bash + ./generator + ``` + This will generate a feature_id.txt. Send this file to Flexiv to apply for the Omni license. + + Note: The feature id is a unique identifier for your application and is bound to your computer. You CANNOT use your Omni license and run Omni-Teleop on other devices. Please generate feature_id and use Omni license on the same computer. +4. After received the Omni license, extract the zip package and put the .lic, .signature and .json file to a safe directory. For example, a new folder named ``omni_license`` under your home directory. +5. Parse the path of omni_licenseCfg.json file when construct Omni-Teleop class in your code. \ No newline at end of file diff --git a/omni_license_generator/generator b/omni_license_generator/generator new file mode 100755 index 0000000..9c853a9 Binary files /dev/null and b/omni_license_generator/generator differ diff --git a/thirdparty/build_and_install_dependencies.sh b/thirdparty/build_and_install_dependencies.sh index 21c6867..4111bca 100644 --- a/thirdparty/build_and_install_dependencies.sh +++ b/thirdparty/build_and_install_dependencies.sh @@ -1,5 +1,5 @@ #!/bin/sh -# This script builds from source and installs all dependencies of flexiv_rdk. +# This script builds from source and installs all dependencies of flexiv_omni_teleop. # Absolute path of this script SCRIPTPATH="$(dirname $(readlink -f $0))" @@ -9,21 +9,21 @@ set -e if [ "$#" -lt 1 ]; then echo "Error: invalid script argument" echo "Required argument: [install_directory_path]" - echo " install_directory_path: directory to install all dependencies, should be the same as the install directory of flexiv_rdk" + echo " install_directory_path: directory to install all dependencies, should be the same as the install directory of flexiv_omni_teleop" echo "Optional argument: [num_parallel_jobs]" echo " num_parallel_jobs: number of parallel jobs used to build, if not specified, the number of CPU cores will be used" exit fi -# Get dependencies install directory from script argument, should be the same as the install directory of flexiv_rdk +# Get dependencies install directory from script argument, should be the same as the install directory of flexiv_omni_teleop INSTALL_DIR=$1 echo "Dependencies will be installed to: $INSTALL_DIR" # Use specified number for parallel build jobs, otherwise use number of cores if [ -n "$2" ] ;then - NUM_JOBS=$2 + export NUM_JOBS=$2 else - NUM_JOBS=$(nproc) + export NUM_JOBS=$(nproc) fi echo "Number of parallel build jobs: $NUM_JOBS" @@ -32,11 +32,11 @@ echo "Number of parallel build jobs: $NUM_JOBS" mkdir -p cloned && cd cloned # Build and install all dependencies to INSTALL_DIR -bash $SCRIPTPATH/scripts/install_eigen.sh $INSTALL_DIR $NUM_JOBS -bash $SCRIPTPATH/scripts/install_tinyxml2.sh $INSTALL_DIR $NUM_JOBS -bash $SCRIPTPATH/scripts/install_foonathan_memory.sh $INSTALL_DIR $NUM_JOBS -bash $SCRIPTPATH/scripts/install_Fast-CDR.sh $INSTALL_DIR $NUM_JOBS -bash $SCRIPTPATH/scripts/install_Fast-DDS.sh $INSTALL_DIR $NUM_JOBS -bash $SCRIPTPATH/scripts/install_boost.sh $INSTALL_DIR $NUM_JOBS +bash $SCRIPTPATH/scripts/install_eigen.sh $INSTALL_DIR +bash $SCRIPTPATH/scripts/install_tinyxml2.sh $INSTALL_DIR +bash $SCRIPTPATH/scripts/install_foonathan_memory.sh $INSTALL_DIR +bash $SCRIPTPATH/scripts/install_Fast-CDR.sh $INSTALL_DIR +bash $SCRIPTPATH/scripts/install_Fast-DDS.sh $INSTALL_DIR +bash $SCRIPTPATH/scripts/install_boost.sh $INSTALL_DIR echo ">>>>>>>>>> Finished <<<<<<<<<<" diff --git a/thirdparty/scripts/install_Fast-CDR.sh b/thirdparty/scripts/install_Fast-CDR.sh index c901383..d4a8289 100644 --- a/thirdparty/scripts/install_Fast-CDR.sh +++ b/thirdparty/scripts/install_Fast-CDR.sh @@ -2,9 +2,8 @@ set -e echo "Installing Fast-CDR" -# Get install directory and number of parallel build jobs as script arguments +# Get install directory as script argument INSTALL_DIR=$1 -NUM_JOBS=$2 # Clone source code if [ ! -d Fast-CDR ] ; then @@ -24,6 +23,7 @@ cmake .. -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + -DCMAKE_PREFIX_PATH=$INSTALL_DIR \ -DCOMPILE_EXAMPLES=OFF # Build and install diff --git a/thirdparty/scripts/install_Fast-DDS.sh b/thirdparty/scripts/install_Fast-DDS.sh index 23a7a9a..cf5d83d 100644 --- a/thirdparty/scripts/install_Fast-DDS.sh +++ b/thirdparty/scripts/install_Fast-DDS.sh @@ -3,9 +3,8 @@ set -e echo "Installing Fast-DDS" -# Get install directory and number of parallel build jobs as script arguments +# Get install directory as script argument INSTALL_DIR=$1 -NUM_JOBS=$2 # Clone source code if [ ! -d Fast-DDS ] ; then @@ -16,7 +15,7 @@ else fi # Use specific version -git checkout v2.6.2 +git checkout v2.6.7 git submodule update --init --recursive # Configure CMake @@ -25,6 +24,7 @@ cmake .. -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + -DCMAKE_PREFIX_PATH=$INSTALL_DIR \ -DTHIRDPARTY_Asio=ON \ -DCOMPILE_EXAMPLES=OFF \ -DSQLITE3_SUPPORT=OFF \ diff --git a/thirdparty/scripts/install_boost.sh b/thirdparty/scripts/install_boost.sh index 8fcf4f1..7291d99 100644 --- a/thirdparty/scripts/install_boost.sh +++ b/thirdparty/scripts/install_boost.sh @@ -6,17 +6,17 @@ echo "Installing boost" INSTALL_DIR=$1 # Download source code -if [ ! -d boost_1_72_0 ] ; then +if [ ! -d boost_1_74_0 ] ; then # download is faster than clone - URL="https://boostorg.jfrog.io/artifactory/main/release/1.72.0/source/boost_1_72_0.tar.bz2" + URL="https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.bz2" echo "-- Downloading: $URL" wget $URL --no-clobber --quiet --show-progress --progress=bar:force 2>&1 # Unzip - echo "-- Extracting: boost_1_72_0.tar.bz2" - tar --bzip2 -xf "boost_1_72_0.tar.bz2" - cd boost_1_72_0 + echo "-- Extracting: boost_1_74_0.tar.bz2" + tar --bzip2 -xf "boost_1_74_0.tar.bz2" + cd boost_1_74_0 else - cd boost_1_72_0 + cd boost_1_74_0 fi # Build and install diff --git a/thirdparty/scripts/install_eigen.sh b/thirdparty/scripts/install_eigen.sh index 1c2f335..3759dc3 100644 --- a/thirdparty/scripts/install_eigen.sh +++ b/thirdparty/scripts/install_eigen.sh @@ -2,9 +2,8 @@ set -e echo "Installing eigen" -# Get install directory and number of parallel build jobs as script arguments +# Get install directory as script argument INSTALL_DIR=$1 -NUM_JOBS=$2 # Clone source code if [ ! -d eigen ] ; then @@ -24,6 +23,7 @@ cmake .. -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + -DCMAKE_PREFIX_PATH=$INSTALL_DIR # Build and install cmake --build . --target install --config Release -j $NUM_JOBS diff --git a/thirdparty/scripts/install_foonathan_memory.sh b/thirdparty/scripts/install_foonathan_memory.sh index 817c949..bfee855 100644 --- a/thirdparty/scripts/install_foonathan_memory.sh +++ b/thirdparty/scripts/install_foonathan_memory.sh @@ -2,9 +2,8 @@ set -e echo "Installing foonathan_memory" -# Get install directory and number of parallel build jobs as script arguments +# Get install directory as script argument INSTALL_DIR=$1 -NUM_JOBS=$2 # Clone source code if [ ! -d foonathan_memory_vendor ] ; then @@ -23,7 +22,8 @@ mkdir -p build && cd build cmake .. -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR + -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + -DCMAKE_PREFIX_PATH=$INSTALL_DIR # Build and install cmake --build . --target install --config Release -j $NUM_JOBS diff --git a/thirdparty/scripts/install_tinyxml2.sh b/thirdparty/scripts/install_tinyxml2.sh index 373b668..1a29597 100644 --- a/thirdparty/scripts/install_tinyxml2.sh +++ b/thirdparty/scripts/install_tinyxml2.sh @@ -2,9 +2,8 @@ set -e echo "Installing tinyxml2" -# Get install directory and number of parallel build jobs as script arguments +# Get install directory as script argument INSTALL_DIR=$1 -NUM_JOBS=$2 # Clone source code if [ ! -d tinyxml2 ] ; then @@ -24,6 +23,7 @@ cmake .. -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + -DCMAKE_PREFIX_PATH=$INSTALL_DIR # Build and install cmake --build . --target install --config Release -j $NUM_JOBS