贴面后不再抬回悬高;MoveL 切回关节后不再把整段位移当前进速度。

搜孔开局会抬到悬高再落回 hole_hover_z_m,螺纹还没咬合臂就离开孔口。没有接触传感器,到位只认 final_gap 算出的法兰高度,贴面后停在这个 Z。09:25 厂家 MoveL 切回 NRT_JOINT_POSITION 的第一拍把整段关节差算成 1.686 rad/s,前瞻再推 0.07 rad,光心从 5 mm 冲到 276 mm 后急停。切回后钉住结束瞬间的关节角并清零速度,JTC 还指着出发前的关节时不放行。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
arm_dev
2026-10-19 11:30:49 +08:00
parent 8c4dccccb1
commit 7af9e3d4b6
103 changed files with 5594 additions and 2498 deletions
@@ -1,139 +0,0 @@
/**
* @file flexiv_dual_hardware_interface.hpp
* @brief Hardware interface to a pair of Flexiv robots for ROS 2 control.
* @copyright Copyright (C) 2016-2025 Flexiv Ltd. All Rights Reserved.
* @author Flexiv
*/
#ifndef FLEXIV_HARDWARE__FLEXIV_DUAL_HARDWARE_INTERFACE_HPP_
#define FLEXIV_HARDWARE__FLEXIV_DUAL_HARDWARE_INTERFACE_HPP_
#include <memory>
#include <string>
#include <vector>
#include <map>
// ROS
#include <rclcpp/clock.hpp>
#include <rclcpp/duration.hpp>
#include <rclcpp/macros.hpp>
#include <rclcpp/logger.hpp>
#include <rclcpp/time.hpp>
#include <rclcpp_lifecycle/state.hpp>
// ros2_control hardware_interface
#include <hardware_interface/hardware_info.hpp>
#include <hardware_interface/system_interface.hpp>
#include <hardware_interface/types/hardware_interface_return_values.hpp>
#include "flexiv_hardware/visibility_control.h"
// Flexiv
#include "flexiv/drdk/robot_pair.hpp"
namespace flexiv_hardware {
enum StoppingInterface
{
NONE,
STOP_POSITION,
STOP_VELOCITY,
STOP_EFFORT
};
class FlexivDualHardwareInterface : public hardware_interface::SystemInterface
{
public:
RCLCPP_SHARED_PTR_DEFINITIONS(FlexivDualHardwareInterface)
FLEXIV_HARDWARE_PUBLIC
hardware_interface::CallbackReturn on_init(
const hardware_interface::HardwareInfo& info) override;
FLEXIV_HARDWARE_PUBLIC
std::vector<hardware_interface::StateInterface> export_state_interfaces() override;
FLEXIV_HARDWARE_PUBLIC
std::vector<hardware_interface::CommandInterface> export_command_interfaces() override;
FLEXIV_HARDWARE_PUBLIC
hardware_interface::return_type prepare_command_mode_switch(
const std::vector<std::string>& start_interfaces,
const std::vector<std::string>& stop_interfaces) override;
FLEXIV_HARDWARE_PUBLIC
hardware_interface::return_type perform_command_mode_switch(
const std::vector<std::string>& start_interfaces,
const std::vector<std::string>& stop_interfaces) override;
FLEXIV_HARDWARE_PUBLIC
hardware_interface::CallbackReturn on_activate(
const rclcpp_lifecycle::State& previous_state) override;
FLEXIV_HARDWARE_PUBLIC
hardware_interface::CallbackReturn on_deactivate(
const rclcpp_lifecycle::State& previous_state) override;
FLEXIV_HARDWARE_PUBLIC
hardware_interface::return_type read(
const rclcpp::Time& time, const rclcpp::Duration& period) override;
FLEXIV_HARDWARE_PUBLIC
hardware_interface::return_type write(
const rclcpp::Time& time, const rclcpp::Duration& period) override;
private:
// Flexiv DRDK
std::unique_ptr<flexiv::drdk::RobotPair> robot_pair_;
// RDK control mode for joint position and velocity interfaces
flexiv::rdk::Mode rdk_control_mode_;
// External axis type
std::string external_axis_type_ = "";
// Joint commands
std::vector<double> hw_commands_joint_positions_;
std::vector<double> hw_commands_joint_velocities_;
std::vector<double> hw_commands_joint_efforts_;
// Joint states
std::vector<double> hw_states_joint_positions_;
std::vector<double> hw_states_joint_velocities_;
std::vector<double> hw_states_joint_efforts_;
// Robot States
flexiv::rdk::RobotStates hw_flexiv_robot_states_left_;
flexiv::rdk::RobotStates hw_flexiv_robot_states_right_;
flexiv::rdk::RobotStates* hw_flexiv_robot_states_addr_left_ = &hw_flexiv_robot_states_left_;
flexiv::rdk::RobotStates* hw_flexiv_robot_states_addr_right_ = &hw_flexiv_robot_states_right_;
// GPIO commands and states
std::vector<double> hw_commands_gpio_out_;
std::vector<double> hw_states_gpio_in_;
// Current digital output map
std::map<unsigned int, bool> current_digital_outputs_left_;
std::map<unsigned int, bool> current_digital_outputs_right_;
// Joint mapping
struct JointMap
{
int robot_index; // 0: Left, 1: Right
int dof_index; // Index in the robot's q vector
};
std::vector<JointMap> joint_map_;
static rclcpp::Logger getLogger();
// Control modes
bool controllers_initialized_;
std::vector<uint> stop_modes_;
std::vector<std::string> start_modes_;
bool position_controller_running_;
bool velocity_controller_running_;
bool torque_controller_running_;
};
} /* namespace flexiv_hardware */
#endif /* FLEXIV_HARDWARE__FLEXIV_DUAL_HARDWARE_INTERFACE_HPP_ */
@@ -0,0 +1 @@
/home/cc/ros2/src/flexiv_hardware/include/flexiv_hardware/flexiv_dual_hardware_interface.hpp
@@ -1,156 +0,0 @@
/**
* @file flexiv_hardware_interface.hpp
* @brief Hardware interface to Flexiv robots for ROS 2 control. Adapted from
* ros2_control_demos/example_3/hardware/include/ros2_control_demo_example_3/rrbot_system_multi_interface.hpp
* @copyright Copyright (C) 2016-2024 Flexiv Ltd. All Rights Reserved.
* @author Flexiv
*/
#ifndef FLEXIV_HARDWARE__FLEXIV_HARDWARE_INTERFACE_HPP_
#define FLEXIV_HARDWARE__FLEXIV_HARDWARE_INTERFACE_HPP_
#include <chrono>
#include <memory>
#include <string>
#include <vector>
// ROS
#include <rclcpp/clock.hpp>
#include <rclcpp/duration.hpp>
#include <rclcpp/macros.hpp>
#include <rclcpp/logger.hpp>
#include <rclcpp/time.hpp>
#include <rclcpp_lifecycle/state.hpp>
// ros2_control hardware_interface
#include <hardware_interface/hardware_info.hpp>
#include <hardware_interface/system_interface.hpp>
#include <hardware_interface/types/hardware_interface_return_values.hpp>
#include "flexiv_hardware/visibility_control.h"
// Flexiv
#include "flexiv/rdk/robot.hpp"
namespace flexiv_hardware {
enum StoppingInterface
{
NONE,
STOP_POSITION,
STOP_VELOCITY,
STOP_EFFORT
};
class FlexivHardwareInterface : public hardware_interface::SystemInterface
{
public:
RCLCPP_SHARED_PTR_DEFINITIONS(FlexivHardwareInterface)
FLEXIV_HARDWARE_PUBLIC
hardware_interface::CallbackReturn on_init(
const hardware_interface::HardwareInfo& info) override;
FLEXIV_HARDWARE_PUBLIC
std::vector<hardware_interface::StateInterface> export_state_interfaces() override;
FLEXIV_HARDWARE_PUBLIC
std::vector<hardware_interface::CommandInterface> export_command_interfaces() override;
FLEXIV_HARDWARE_PUBLIC
hardware_interface::return_type prepare_command_mode_switch(
const std::vector<std::string>& start_interfaces,
const std::vector<std::string>& stop_interfaces) override;
FLEXIV_HARDWARE_PUBLIC
hardware_interface::return_type perform_command_mode_switch(
const std::vector<std::string>& start_interfaces,
const std::vector<std::string>& stop_interfaces) override;
FLEXIV_HARDWARE_PUBLIC
hardware_interface::CallbackReturn on_activate(
const rclcpp_lifecycle::State& previous_state) override;
FLEXIV_HARDWARE_PUBLIC
hardware_interface::CallbackReturn on_deactivate(
const rclcpp_lifecycle::State& previous_state) override;
FLEXIV_HARDWARE_PUBLIC
hardware_interface::return_type read(
const rclcpp::Time& time, const rclcpp::Duration& period) override;
FLEXIV_HARDWARE_PUBLIC
hardware_interface::return_type write(
const rclcpp::Time& time, const rclcpp::Duration& period) override;
private:
// Flexiv RDK
std::unique_ptr<flexiv::rdk::Robot> robot_;
// RDK control mode for joint position and velocity interfaces
flexiv::rdk::Mode rdk_control_mode_;
// Joint commands
std::vector<double> hw_commands_joint_positions_;
std::vector<double> hw_commands_joint_velocities_;
std::vector<double> hw_commands_joint_efforts_;
// Joint states
std::vector<double> hw_states_joint_positions_;
std::vector<double> hw_states_joint_velocities_;
std::vector<double> hw_states_joint_efforts_;
// Robot States
flexiv::rdk::RobotStates hw_flexiv_robot_states_;
flexiv::rdk::RobotStates* hw_flexiv_robot_states_addr_ = &hw_flexiv_robot_states_;
// GPIO commands and states
std::vector<double> hw_commands_gpio_out_;
std::vector<double> hw_states_gpio_in_;
// Map from RDK joint index to ROS joint index
// RDK expects: [ext_axis_1, ..., ext_axis_N, arm_joint_1, ..., arm_joint_7]
std::vector<size_t> rdk_to_ros_map_;
// Current digital output map
std::map<unsigned int, bool> current_digital_outputs_;
static rclcpp::Logger getLogger();
// Control modes
bool controllers_initialized_;
std::vector<uint> stop_modes_;
std::vector<std::string> start_modes_;
bool position_controller_running_;
bool velocity_controller_running_;
bool torque_controller_running_;
// ===== 连接存活看门狗(2026-09-28 真机踩到)=====
//
// 现象:RDK 断连后 `operational()` 会**一直保持 true**,于是 read() 照跑却只
// 返回最后一帧缓存(关节状态永久冻结),write() 把命令发进虚空也不抛异常,
// 而 rizon_arm_controller 是本地插值、不校验反馈 —— 最终表现为
// **「控制器报 Goal reached/success、关节状态纹丝不动、臂一步没动」**。
//
// 实测:14:53:44 RDK 打印 "Disconnected from the robot, waiting for reconnection",
// 此后 50 分钟里 /joint_states 的 robot_timestamp 推进量恒为 0,而 `op=1` 没变过。
// 根因是两台臂出厂 MAC 相同(88:88:88:88:87:88)在同一 L2 段抢转发,链路丢包 40~53%。
//
// 这里用 connected() + states().timestamp 双重判活:任一失效就返回 ERROR,
// 让 ros2_control 把栈停下来报错,而不是静默地"成功"。
int64_t last_state_stamp_ns_ = 0; // 上一帧的机器人时间戳
int64_t last_state_change_ns_ = 0; // 上一帧时间戳发生变化的本地时刻
// D435 粗定位的 MoveL 走已经连上的这份 RDK。write() 里一步一步推进,
// 不另开线程,也不在这段里往关节接口灌点。请求文件是 /tmp/flexiv_movel_req。
enum class VendorMovelPhase { kIdle, kRunning };
VendorMovelPhase vendor_movel_phase_ = VendorMovelPhase::kIdle;
long vendor_movel_seq_ = -1;
long vendor_movel_done_seq_ = -1;
std::chrono::steady_clock::time_point vendor_movel_deadline_ {};
bool poll_vendor_movel();
void finish_vendor_movel(long seq, bool ok, const std::string& detail);
};
} /* namespace flexiv_hardware */
#endif /* FLEXIV_HARDWARE__FLEXIV_HARDWARE_INTERFACE_HPP_ */
@@ -0,0 +1 @@
/home/cc/ros2/src/flexiv_hardware/include/flexiv_hardware/flexiv_hardware_interface.hpp
@@ -1,35 +0,0 @@
#ifndef FLEXIV_HARDWARE__VISIBILITY_CONTROL_H_
#define FLEXIV_HARDWARE__VISIBILITY_CONTROL_H_
// This logic was borrowed (then namespaced) from the examples on the gcc wiki:
// https://gcc.gnu.org/wiki/Visibility
#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define FLEXIV_HARDWARE_EXPORT __attribute__((dllexport))
#define FLEXIV_HARDWARE_IMPORT __attribute__((dllimport))
#else
#define FLEXIV_HARDWARE_EXPORT __declspec(dllexport)
#define FLEXIV_HARDWARE_IMPORT __declspec(dllimport)
#endif
#ifdef FLEXIV_HARDWARE_BUILDING_DLL
#define FLEXIV_HARDWARE_PUBLIC FLEXIV_HARDWARE_EXPORT
#else
#define FLEXIV_HARDWARE_PUBLIC FLEXIV_HARDWARE_IMPORT
#endif
#define FLEXIV_HARDWARE_PUBLIC_TYPE FLEXIV_HARDWARE_PUBLIC
#define FLEXIV_HARDWARE_LOCAL
#else
#define FLEXIV_HARDWARE_EXPORT __attribute__((visibility("default")))
#define FLEXIV_HARDWARE_IMPORT
#if __GNUC__ >= 4
#define FLEXIV_HARDWARE_PUBLIC __attribute__((visibility("default")))
#define FLEXIV_HARDWARE_LOCAL __attribute__((visibility("hidden")))
#else
#define FLEXIV_HARDWARE_PUBLIC
#define FLEXIV_HARDWARE_LOCAL
#endif
#define FLEXIV_HARDWARE_PUBLIC_TYPE
#endif
#endif // FLEXIV_HARDWARE__VISIBILITY_CONTROL_H_
@@ -0,0 +1 @@
/home/cc/ros2/src/flexiv_hardware/include/flexiv_hardware/visibility_control.h
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/libflexiv_hardware.so
@@ -1 +0,0 @@
share/flexiv_hardware/flexiv_hardware_interface_plugin.xml
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/ament_cmake_index/share/ament_index/resource_index/hardware_interface__pluginlib__plugin/flexiv_hardware
@@ -1 +0,0 @@
rclcpp;rclcpp_lifecycle;hardware_interface;pluginlib;ament_lint_auto;ament_lint_common;ament_cmake_gtest
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/ament_cmake_index/share/ament_index/resource_index/package_run_dependencies/flexiv_hardware
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/ament_cmake_index/share/ament_index/resource_index/packages/flexiv_hardware
@@ -1 +0,0 @@
/home/cc/ros2/install/gpio_controller:/home/cc/ros2/install/flexiv_bringup:/home/cc/ros2/install/flexiv_test_nodes:/home/cc/ros2/install/flexiv_robot_states_broadcaster:/home/cc/ros2/install/flexiv_gripper:/home/cc/ros2/install/flexiv_msgs:/home/cc/ros2/install/flexiv_moveit_config:/home/cc/ros2/install/flexiv_hardware:/home/cc/ros2/install/arm_sim_gazebo:/home/cc/ros2/install/arm_bringup:/home/cc/ros2/install/arm_moveit_config:/home/cc/ros2/install/arm_description:/home/cc/ros2/install/flexiv_description:/home/cc/ros2/install/arm_driver_flexiv:/home/cc/ros2/install/arm_control:/home/cc/ros2/install/arm_application:/home/cc/ros2/install/arm_msgs:/home/cc/ros2/install/arm_kinematics:/home/cc/ros2/install/arm_interfaces:/home/cc/anaconda3/envs/ros_flexiv
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/ament_cmake_index/share/ament_index/resource_index/parent_prefix_path/flexiv_hardware
@@ -1,94 +0,0 @@
# generated from ament_cmake_export_dependencies/cmake/ament_cmake_export_dependencies-extras.cmake.in
set(_exported_dependencies "hardware_interface;pluginlib;rclcpp;rclcpp_lifecycle")
find_package(ament_cmake_libraries QUIET REQUIRED)
# find_package() all dependencies
# and append their DEFINITIONS INCLUDE_DIRS, LIBRARIES, and LINK_FLAGS
# variables to flexiv_hardware_DEFINITIONS, flexiv_hardware_INCLUDE_DIRS,
# flexiv_hardware_LIBRARIES, and flexiv_hardware_LINK_FLAGS.
# Additionally collect the direct dependency names in
# flexiv_hardware_DEPENDENCIES as well as the recursive dependency names
# in flexiv_hardware_RECURSIVE_DEPENDENCIES.
if(NOT _exported_dependencies STREQUAL "")
find_package(ament_cmake_core QUIET REQUIRED)
set(flexiv_hardware_DEPENDENCIES ${_exported_dependencies})
set(flexiv_hardware_RECURSIVE_DEPENDENCIES ${_exported_dependencies})
set(_libraries)
foreach(_dep ${_exported_dependencies})
if(NOT ${_dep}_FOUND)
find_package("${_dep}" QUIET REQUIRED)
endif()
# if a package provides modern CMake interface targets use them
# exclusively assuming the classic CMake variables only exist for
# backward compatibility
set(use_modern_cmake FALSE)
if(NOT "${${_dep}_TARGETS}" STREQUAL "")
foreach(_target ${${_dep}_TARGETS})
# only use actual targets
# in case a package uses this variable for other content
if(TARGET "${_target}")
get_target_property(_include_dirs ${_target} INTERFACE_INCLUDE_DIRECTORIES)
if(_include_dirs)
list_append_unique(flexiv_hardware_INCLUDE_DIRS "${_include_dirs}")
endif()
get_target_property(_imported_configurations ${_target} IMPORTED_CONFIGURATIONS)
if(_imported_configurations)
string(TOUPPER "${_imported_configurations}" _imported_configurations)
if(DEBUG_CONFIGURATIONS)
string(TOUPPER "${DEBUG_CONFIGURATIONS}" _debug_configurations_uppercase)
else()
set(_debug_configurations_uppercase "DEBUG")
endif()
foreach(_imported_config ${_imported_configurations})
get_target_property(_imported_implib ${_target} IMPORTED_IMPLIB_${_imported_config})
if(_imported_implib)
set(_imported_implib_config "optimized")
if(${_imported_config} IN_LIST _debug_configurations_uppercase)
set(_imported_implib_config "debug")
endif()
list(APPEND _libraries ${_imported_implib_config} ${_imported_implib})
else()
get_target_property(_imported_location ${_target} IMPORTED_LOCATION_${_imported_config})
if(_imported_location)
list(APPEND _libraries "${_imported_location}")
endif()
endif()
endforeach()
endif()
get_target_property(_link_libraries ${_target} INTERFACE_LINK_LIBRARIES)
if(_link_libraries)
list(APPEND _libraries "${_link_libraries}")
endif()
set(use_modern_cmake TRUE)
endif()
endforeach()
endif()
if(NOT use_modern_cmake)
if(${_dep}_DEFINITIONS)
list_append_unique(flexiv_hardware_DEFINITIONS "${${_dep}_DEFINITIONS}")
endif()
if(${_dep}_INCLUDE_DIRS)
list_append_unique(flexiv_hardware_INCLUDE_DIRS "${${_dep}_INCLUDE_DIRS}")
endif()
if(${_dep}_LIBRARIES)
list(APPEND _libraries "${${_dep}_LIBRARIES}")
endif()
if(${_dep}_LINK_FLAGS)
list_append_unique(flexiv_hardware_LINK_FLAGS "${${_dep}_LINK_FLAGS}")
endif()
if(${_dep}_RECURSIVE_DEPENDENCIES)
list_append_unique(flexiv_hardware_RECURSIVE_DEPENDENCIES "${${_dep}_RECURSIVE_DEPENDENCIES}")
endif()
endif()
if(_libraries)
ament_libraries_deduplicate(_libraries "${_libraries}")
list(APPEND _libraries ${flexiv_hardware_LIBRARIES})
list(REMOVE_DUPLICATES _libraries)
set(flexiv_hardware_LIBRARIES ${_libraries})
endif()
endforeach()
endif()
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/ament_cmake_export_dependencies/ament_cmake_export_dependencies-extras.cmake
@@ -1,16 +0,0 @@
# generated from ament_cmake_export_include_directories/cmake/ament_cmake_export_include_directories-extras.cmake.in
set(_exported_include_dirs "${flexiv_hardware_DIR}/../../../include")
# append include directories to flexiv_hardware_INCLUDE_DIRS
# warn about not existing paths
if(NOT _exported_include_dirs STREQUAL "")
find_package(ament_cmake_core QUIET REQUIRED)
foreach(_exported_include_dir ${_exported_include_dirs})
if(NOT IS_DIRECTORY "${_exported_include_dir}")
message(WARNING "Package 'flexiv_hardware' exports the include directory '${_exported_include_dir}' which doesn't exist")
endif()
normalize_path(_exported_include_dir "${_exported_include_dir}")
list(APPEND flexiv_hardware_INCLUDE_DIRS "${_exported_include_dir}")
endforeach()
endif()
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/ament_cmake_export_include_directories/ament_cmake_export_include_directories-extras.cmake
@@ -1,141 +0,0 @@
# generated from ament_cmake_export_libraries/cmake/template/ament_cmake_export_libraries.cmake.in
set(_exported_libraries "flexiv_hardware")
set(_exported_library_names "")
# populate flexiv_hardware_LIBRARIES
if(NOT _exported_libraries STREQUAL "")
# loop over libraries, either target names or absolute paths
list(LENGTH _exported_libraries _length)
set(_i 0)
while(_i LESS _length)
list(GET _exported_libraries ${_i} _arg)
# pass linker flags along
if("${_arg}" MATCHES "^-" AND NOT "${_arg}" MATCHES "^-[l|framework]")
list(APPEND flexiv_hardware_LIBRARIES "${_arg}")
math(EXPR _i "${_i} + 1")
continue()
endif()
if("${_arg}" MATCHES "^(debug|optimized|general)$")
# remember build configuration keyword
# and get following library
set(_cfg "${_arg}")
math(EXPR _i "${_i} + 1")
if(_i EQUAL _length)
message(FATAL_ERROR "Package 'flexiv_hardware' passes the build configuration keyword '${_cfg}' as the last exported library")
endif()
list(GET _exported_libraries ${_i} _library)
else()
# the value is a library without a build configuration keyword
set(_cfg "")
set(_library "${_arg}")
endif()
math(EXPR _i "${_i} + 1")
if(NOT IS_ABSOLUTE "${_library}")
# search for library target relative to this CMake file
set(_lib "NOTFOUND")
find_library(
_lib NAMES "${_library}"
PATHS "${flexiv_hardware_DIR}/../../../lib"
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
)
if(NOT _lib)
# warn about not existing library and ignore it
message(FATAL_ERROR "Package 'flexiv_hardware' exports the library '${_library}' which couldn't be found")
elseif(NOT IS_ABSOLUTE "${_lib}")
# the found library must be an absolute path
message(FATAL_ERROR "Package 'flexiv_hardware' found the library '${_library}' at '${_lib}' which is not an absolute path")
elseif(NOT EXISTS "${_lib}")
# the found library must exist
message(FATAL_ERROR "Package 'flexiv_hardware' found the library '${_lib}' which doesn't exist")
else()
list(APPEND flexiv_hardware_LIBRARIES ${_cfg} "${_lib}")
endif()
else()
if(NOT EXISTS "${_library}")
# the found library must exist
message(WARNING "Package 'flexiv_hardware' exports the library '${_library}' which doesn't exist")
else()
list(APPEND flexiv_hardware_LIBRARIES ${_cfg} "${_library}")
endif()
endif()
endwhile()
endif()
# find_library() library names with optional LIBRARY_DIRS
# and add the libraries to flexiv_hardware_LIBRARIES
if(NOT _exported_library_names STREQUAL "")
# loop over library names
# but remember related build configuration keyword if available
list(LENGTH _exported_library_names _length)
set(_i 0)
while(_i LESS _length)
list(GET _exported_library_names ${_i} _arg)
# pass linker flags along
if("${_arg}" MATCHES "^-" AND NOT "${_arg}" MATCHES "^-[l|framework]")
list(APPEND flexiv_hardware_LIBRARIES "${_arg}")
math(EXPR _i "${_i} + 1")
continue()
endif()
if("${_arg}" MATCHES "^(debug|optimized|general)$")
# remember build configuration keyword
# and get following library name
set(_cfg "${_arg}")
math(EXPR _i "${_i} + 1")
if(_i EQUAL _length)
message(FATAL_ERROR "Package 'flexiv_hardware' passes the build configuration keyword '${_cfg}' as the last exported target")
endif()
list(GET _exported_library_names ${_i} _library)
else()
# the value is a library target without a build configuration keyword
set(_cfg "")
set(_library "${_arg}")
endif()
math(EXPR _i "${_i} + 1")
# extract optional LIBRARY_DIRS from library name
string(REPLACE ":" ";" _library_dirs "${_library}")
list(GET _library_dirs 0 _library_name)
list(REMOVE_AT _library_dirs 0)
set(_lib "NOTFOUND")
if(NOT _library_dirs)
# search for library in the common locations
find_library(
_lib
NAMES "${_library_name}"
)
if(NOT _lib)
# warn about not existing library and later ignore it
message(WARNING "Package 'flexiv_hardware' exports library '${_library_name}' which couldn't be found")
endif()
else()
# search for library in the specified directories
find_library(
_lib
NAMES "${_library_name}"
PATHS ${_library_dirs}
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
)
if(NOT _lib)
# warn about not existing library and later ignore it
message(WARNING
"Package 'flexiv_hardware' exports library '${_library_name}' with LIBRARY_DIRS '${_library_dirs}' which couldn't be found")
endif()
endif()
if(_lib)
list(APPEND flexiv_hardware_LIBRARIES ${_cfg} "${_lib}")
endif()
endwhile()
endif()
# TODO(dirk-thomas) deduplicate flexiv_hardware_LIBRARIES
# while maintaining library order
# as well as build configuration keywords
# as well as linker flags
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/ament_cmake_export_libraries/ament_cmake_export_libraries-extras.cmake
@@ -1,14 +0,0 @@
# generated from ament/cmake/core/templates/nameConfig-version.cmake.in
set(PACKAGE_VERSION "1.9.1")
set(PACKAGE_VERSION_EXACT False)
set(PACKAGE_VERSION_COMPATIBLE False)
if("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "${PACKAGE_VERSION}")
set(PACKAGE_VERSION_EXACT True)
set(PACKAGE_VERSION_COMPATIBLE True)
endif()
if("${PACKAGE_FIND_VERSION}" VERSION_LESS "${PACKAGE_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE True)
endif()
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/ament_cmake_core/flexiv_hardwareConfig-version.cmake
@@ -1,42 +0,0 @@
# generated from ament/cmake/core/templates/nameConfig.cmake.in
# prevent multiple inclusion
if(_flexiv_hardware_CONFIG_INCLUDED)
# ensure to keep the found flag the same
if(NOT DEFINED flexiv_hardware_FOUND)
# explicitly set it to FALSE, otherwise CMake will set it to TRUE
set(flexiv_hardware_FOUND FALSE)
elseif(NOT flexiv_hardware_FOUND)
# use separate condition to avoid uninitialized variable warning
set(flexiv_hardware_FOUND FALSE)
endif()
return()
endif()
set(_flexiv_hardware_CONFIG_INCLUDED TRUE)
# output package information
if(NOT flexiv_hardware_FIND_QUIETLY)
message(STATUS "Found flexiv_hardware: 1.9.1 (${flexiv_hardware_DIR})")
endif()
# warn when using a deprecated package
if(NOT "" STREQUAL "")
set(_msg "Package 'flexiv_hardware' is deprecated")
# append custom deprecation text if available
if(NOT "" STREQUAL "TRUE")
set(_msg "${_msg} ()")
endif()
# optionally quiet the deprecation message
if(NOT ${flexiv_hardware_DEPRECATED_QUIET})
message(DEPRECATION "${_msg}")
endif()
endif()
# flag package as ament-based to distinguish it after being find_package()-ed
set(flexiv_hardware_FOUND_AMENT_PACKAGE TRUE)
# include all config extra files
set(_extras "ament_cmake_export_include_directories-extras.cmake;ament_cmake_export_libraries-extras.cmake;ament_cmake_export_dependencies-extras.cmake")
foreach(_extra ${_extras})
include("${flexiv_hardware_DIR}/${_extra}")
endforeach()
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/ament_cmake_core/flexiv_hardwareConfig.cmake
@@ -1 +0,0 @@
prepend-non-duplicate;AMENT_PREFIX_PATH;
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/ament_cmake_environment_hooks/ament_prefix_path.dsv
@@ -1,4 +0,0 @@
# copied from
# ament_cmake_core/cmake/environment_hooks/environment/ament_prefix_path.sh
ament_prepend_unique_value AMENT_PREFIX_PATH "$AMENT_CURRENT_PREFIX"
@@ -0,0 +1 @@
/home/cc/anaconda3/envs/ros_flexiv/share/ament_cmake_core/cmake/environment_hooks/environment/ament_prefix_path.sh
@@ -1 +0,0 @@
prepend-non-duplicate-if-exists;PATH;bin
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/ament_cmake_environment_hooks/path.dsv
@@ -1,5 +0,0 @@
# copied from ament_cmake_core/cmake/environment_hooks/environment/path.sh
if [ -d "$AMENT_CURRENT_PREFIX/bin" ]; then
ament_prepend_unique_value PATH "$AMENT_CURRENT_PREFIX/bin"
fi
@@ -0,0 +1 @@
/home/cc/anaconda3/envs/ros_flexiv/share/ament_cmake_core/cmake/environment_hooks/environment/path.sh
@@ -1,20 +0,0 @@
<library path="flexiv_hardware">
<class name="flexiv_hardware/FlexivHardwareInterface"
type="flexiv_hardware::FlexivHardwareInterface"
base_class_type="hardware_interface::SystemInterface">
<description>
ROS 2 Control Hardware interface for the Flexiv robots. This driver
uses Flexiv RDK. Position, Velocity and Effort interfaces are supported.
</description>
</class>
<class name="flexiv_hardware/FlexivDualHardwareInterface"
type="flexiv_hardware::FlexivDualHardwareInterface"
base_class_type="hardware_interface::SystemInterface">
<description>
ROS 2 Control Hardware interface for a pair of Flexiv robots. This driver
uses Flexiv DRDK. Position, Velocity and Effort interfaces are supported.
</description>
</class>
</library>
@@ -0,0 +1 @@
/home/cc/ros2/src/flexiv_hardware/flexiv_hardware_interface_plugin.xml
@@ -1,46 +0,0 @@
# generated from ament_package/template/package_level/local_setup.bash.in
# source local_setup.sh from same directory as this file
_this_path=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" && pwd)
# provide AMENT_CURRENT_PREFIX to shell script
AMENT_CURRENT_PREFIX=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`/../.." && pwd)
# store AMENT_CURRENT_PREFIX to restore it before each environment hook
_package_local_setup_AMENT_CURRENT_PREFIX=$AMENT_CURRENT_PREFIX
# trace output
if [ -n "$AMENT_TRACE_SETUP_FILES" ]; then
echo "# . \"$_this_path/local_setup.sh\""
fi
. "$_this_path/local_setup.sh"
unset _this_path
# unset AMENT_ENVIRONMENT_HOOKS
# if not appending to them for return
if [ -z "$AMENT_RETURN_ENVIRONMENT_HOOKS" ]; then
unset AMENT_ENVIRONMENT_HOOKS
fi
# restore AMENT_CURRENT_PREFIX before evaluating the environment hooks
AMENT_CURRENT_PREFIX=$_package_local_setup_AMENT_CURRENT_PREFIX
# list all environment hooks of this package
# source all shell-specific environment hooks of this package
# if not returning them
if [ -z "$AMENT_RETURN_ENVIRONMENT_HOOKS" ]; then
_package_local_setup_IFS=$IFS
IFS=":"
for _hook in $AMENT_ENVIRONMENT_HOOKS; do
# restore AMENT_CURRENT_PREFIX for each environment hook
AMENT_CURRENT_PREFIX=$_package_local_setup_AMENT_CURRENT_PREFIX
# restore IFS before sourcing other files
IFS=$_package_local_setup_IFS
. "$_hook"
done
unset _hook
IFS=$_package_local_setup_IFS
unset _package_local_setup_IFS
unset AMENT_ENVIRONMENT_HOOKS
fi
unset _package_local_setup_AMENT_CURRENT_PREFIX
unset AMENT_CURRENT_PREFIX
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/ament_cmake_environment_hooks/local_setup.bash
@@ -1,2 +0,0 @@
source;share/flexiv_hardware/environment/ament_prefix_path.sh
source;share/flexiv_hardware/environment/path.sh
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/ament_cmake_environment_hooks/local_setup.dsv
@@ -1,184 +0,0 @@
# generated from ament_package/template/package_level/local_setup.sh.in
# since this file is sourced use either the provided AMENT_CURRENT_PREFIX
# or fall back to the destination set at configure time
: ${AMENT_CURRENT_PREFIX:="/home/cc/ros2/install/flexiv_hardware"}
if [ ! -d "$AMENT_CURRENT_PREFIX" ]; then
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
echo "The compile time prefix path '$AMENT_CURRENT_PREFIX' doesn't " \
"exist. Consider sourcing a different extension than '.sh'." 1>&2
else
AMENT_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
fi
fi
# function to append values to environment variables
# using colons as separators and avoiding leading separators
ament_append_value() {
# arguments
_listname="$1"
_value="$2"
#echo "listname $_listname"
#eval echo "list value \$$_listname"
#echo "value $_value"
# avoid leading separator
eval _values=\"\$$_listname\"
if [ -z "$_values" ]; then
eval export $_listname=\"$_value\"
#eval echo "set list \$$_listname"
else
# field separator must not be a colon
_ament_append_value_IFS=$IFS
unset IFS
eval export $_listname=\"\$$_listname:$_value\"
#eval echo "append list \$$_listname"
IFS=$_ament_append_value_IFS
unset _ament_append_value_IFS
fi
unset _values
unset _value
unset _listname
}
# function to append non-duplicate values to environment variables
# using colons as separators and avoiding leading separators
ament_append_unique_value() {
# arguments
_listname=$1
_value=$2
#echo "listname $_listname"
#eval echo "list value \$$_listname"
#echo "value $_value"
# check if the list contains the value
eval _values=\$$_listname
_duplicate=
_ament_append_unique_value_IFS=$IFS
IFS=":"
if [ "$AMENT_SHELL" = "zsh" ]; then
ament_zsh_to_array _values
fi
for _item in $_values; do
# ignore empty strings
if [ -z "$_item" ]; then
continue
fi
if [ $_item = $_value ]; then
_duplicate=1
fi
done
unset _item
# append only non-duplicates
if [ -z "$_duplicate" ]; then
# avoid leading separator
if [ -z "$_values" ]; then
eval $_listname=\"$_value\"
#eval echo "set list \$$_listname"
else
# field separator must not be a colon
unset IFS
eval $_listname=\"\$$_listname:$_value\"
#eval echo "append list \$$_listname"
fi
fi
IFS=$_ament_append_unique_value_IFS
unset _ament_append_unique_value_IFS
unset _duplicate
unset _values
unset _value
unset _listname
}
# function to prepend non-duplicate values to environment variables
# using colons as separators and avoiding trailing separators
ament_prepend_unique_value() {
# arguments
_listname="$1"
_value="$2"
#echo "listname $_listname"
#eval echo "list value \$$_listname"
#echo "value $_value"
# check if the list contains the value
eval _values=\"\$$_listname\"
_duplicate=
_ament_prepend_unique_value_IFS=$IFS
IFS=":"
if [ "$AMENT_SHELL" = "zsh" ]; then
ament_zsh_to_array _values
fi
for _item in $_values; do
# ignore empty strings
if [ -z "$_item" ]; then
continue
fi
if [ "$_item" = "$_value" ]; then
_duplicate=1
fi
done
unset _item
# prepend only non-duplicates
if [ -z "$_duplicate" ]; then
# avoid trailing separator
if [ -z "$_values" ]; then
eval export $_listname=\"$_value\"
#eval echo "set list \$$_listname"
else
# field separator must not be a colon
unset IFS
eval export $_listname=\"$_value:\$$_listname\"
#eval echo "prepend list \$$_listname"
fi
fi
IFS=$_ament_prepend_unique_value_IFS
unset _ament_prepend_unique_value_IFS
unset _duplicate
unset _values
unset _value
unset _listname
}
# unset AMENT_ENVIRONMENT_HOOKS
# if not appending to them for return
if [ -z "$AMENT_RETURN_ENVIRONMENT_HOOKS" ]; then
unset AMENT_ENVIRONMENT_HOOKS
fi
# list all environment hooks of this package
ament_append_value AMENT_ENVIRONMENT_HOOKS "$AMENT_CURRENT_PREFIX/share/flexiv_hardware/environment/ament_prefix_path.sh"
ament_append_value AMENT_ENVIRONMENT_HOOKS "$AMENT_CURRENT_PREFIX/share/flexiv_hardware/environment/path.sh"
# source all shell-specific environment hooks of this package
# if not returning them
if [ -z "$AMENT_RETURN_ENVIRONMENT_HOOKS" ]; then
_package_local_setup_IFS=$IFS
IFS=":"
if [ "$AMENT_SHELL" = "zsh" ]; then
ament_zsh_to_array AMENT_ENVIRONMENT_HOOKS
fi
for _hook in $AMENT_ENVIRONMENT_HOOKS; do
if [ -f "$_hook" ]; then
# restore IFS before sourcing other files
IFS=$_package_local_setup_IFS
# trace output
if [ -n "$AMENT_TRACE_SETUP_FILES" ]; then
echo "# . \"$_hook\""
fi
. "$_hook"
fi
done
unset _hook
IFS=$_package_local_setup_IFS
unset _package_local_setup_IFS
unset AMENT_ENVIRONMENT_HOOKS
fi
# reset AMENT_CURRENT_PREFIX after each package
# allowing to source multiple package-level setup files
unset AMENT_CURRENT_PREFIX
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/ament_cmake_environment_hooks/local_setup.sh
@@ -1,59 +0,0 @@
# generated from ament_package/template/package_level/local_setup.zsh.in
AMENT_SHELL=zsh
# source local_setup.sh from same directory as this file
_this_path=$(builtin cd -q "`dirname "${(%):-%N}"`" > /dev/null && pwd)
# provide AMENT_CURRENT_PREFIX to shell script
AMENT_CURRENT_PREFIX=$(builtin cd -q "`dirname "${(%):-%N}"`/../.." > /dev/null && pwd)
# store AMENT_CURRENT_PREFIX to restore it before each environment hook
_package_local_setup_AMENT_CURRENT_PREFIX=$AMENT_CURRENT_PREFIX
# function to convert array-like strings into arrays
# to wordaround SH_WORD_SPLIT not being set
ament_zsh_to_array() {
local _listname=$1
local _dollar="$"
local _split="{="
local _to_array="(\"$_dollar$_split$_listname}\")"
eval $_listname=$_to_array
}
# trace output
if [ -n "$AMENT_TRACE_SETUP_FILES" ]; then
echo "# . \"$_this_path/local_setup.sh\""
fi
# the package-level local_setup file unsets AMENT_CURRENT_PREFIX
. "$_this_path/local_setup.sh"
unset _this_path
# unset AMENT_ENVIRONMENT_HOOKS
# if not appending to them for return
if [ -z "$AMENT_RETURN_ENVIRONMENT_HOOKS" ]; then
unset AMENT_ENVIRONMENT_HOOKS
fi
# restore AMENT_CURRENT_PREFIX before evaluating the environment hooks
AMENT_CURRENT_PREFIX=$_package_local_setup_AMENT_CURRENT_PREFIX
# list all environment hooks of this package
# source all shell-specific environment hooks of this package
# if not returning them
if [ -z "$AMENT_RETURN_ENVIRONMENT_HOOKS" ]; then
_package_local_setup_IFS=$IFS
IFS=":"
for _hook in $AMENT_ENVIRONMENT_HOOKS; do
# restore AMENT_CURRENT_PREFIX for each environment hook
AMENT_CURRENT_PREFIX=$_package_local_setup_AMENT_CURRENT_PREFIX
# restore IFS before sourcing other files
IFS=$_package_local_setup_IFS
. "$_hook"
done
unset _hook
IFS=$_package_local_setup_IFS
unset _package_local_setup_IFS
unset AMENT_ENVIRONMENT_HOOKS
fi
unset _package_local_setup_AMENT_CURRENT_PREFIX
unset AMENT_CURRENT_PREFIX
@@ -0,0 +1 @@
/home/cc/ros2/build/flexiv_hardware/ament_cmake_environment_hooks/local_setup.zsh
@@ -1,25 +0,0 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>flexiv_hardware</name>
<version>1.9.1</version>
<description>Hardware interfaces to Flexiv robots for ROS 2 control</description>
<maintainer email="munseng.phoon@flexiv.com">Mun Seng Phoon</maintainer>
<license>Apache 2.0</license>
<author email="munseng.phoon@flexiv.com">Mun Seng Phoon</author>
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>rclcpp</depend>
<depend>rclcpp_lifecycle</depend>
<depend>hardware_interface</depend>
<depend>pluginlib</depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<test_depend>ament_cmake_gtest</test_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
@@ -0,0 +1 @@
/home/cc/ros2/src/flexiv_hardware/package.xml