别人克隆后没有 install,source 会直接失败。把展开后的 install 放进仓库,符号链接和指向本机 build 的 egg-link 收成真实文件,Python 入口改走当前环境的解释器,这样不用先 colcon build 也能启动。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+195
@@ -0,0 +1,195 @@
|
||||
/**
|
||||
* @file flexiv_robot_states.hpp
|
||||
* @brief Semantic component interface to read the Flexiv robot states.
|
||||
* @copyright Copyright (C) 2016-2024 Flexiv Ltd. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef SEMANTIC_COMPONENTS__FLEXIV_ROBOT_STATES_HPP_
|
||||
#define SEMANTIC_COMPONENTS__FLEXIV_ROBOT_STATES_HPP_
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <rclcpp/rclcpp.hpp>
|
||||
#include <rclcpp/logging.hpp>
|
||||
|
||||
#include "hardware_interface/loaned_state_interface.hpp"
|
||||
#include "semantic_components/semantic_component_interface.hpp"
|
||||
#include "flexiv/rdk/data.hpp"
|
||||
#include "flexiv_msgs/msg/robot_states.hpp"
|
||||
|
||||
#include "geometry_msgs/msg/accel.hpp"
|
||||
#include "geometry_msgs/msg/point.hpp"
|
||||
#include "geometry_msgs/msg/pose.hpp"
|
||||
#include "geometry_msgs/msg/quaternion.hpp"
|
||||
#include "geometry_msgs/msg/twist.hpp"
|
||||
#include "geometry_msgs/msg/vector3.hpp"
|
||||
#include "geometry_msgs/msg/wrench.hpp"
|
||||
|
||||
namespace {
|
||||
|
||||
const std::string kWorldFrameId = "world";
|
||||
const std::string kFlangeFrameId = "flange";
|
||||
|
||||
// Example implementation of bit_cast: https://en.cppreference.com/w/cpp/numeric/bit_cast
|
||||
template <class To, class From>
|
||||
std::enable_if_t<sizeof(To) == sizeof(From) && std::is_trivially_copyable<From>::value
|
||||
&& std::is_trivially_copyable<To>::value,
|
||||
To>
|
||||
bit_cast(const From& src) noexcept
|
||||
{
|
||||
static_assert(std::is_trivially_constructible<To>::value,
|
||||
"This implementation additionally requires "
|
||||
"destination type to be trivially constructible");
|
||||
|
||||
To dst;
|
||||
std::memcpy(&dst, &src, sizeof(To));
|
||||
return dst;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace semantic_components {
|
||||
|
||||
class FlexivRobotStates : public SemanticComponentInterface<flexiv_msgs::msg::RobotStates>
|
||||
{
|
||||
public:
|
||||
FlexivRobotStates(const std::string& name)
|
||||
: SemanticComponentInterface(name, 1)
|
||||
{
|
||||
interface_names_.emplace_back(name_ + "/" + state_interface_name_);
|
||||
}
|
||||
|
||||
virtual ~FlexivRobotStates() = default;
|
||||
|
||||
void init_robot_states_message(flexiv_msgs::msg::RobotStates& message)
|
||||
{
|
||||
message.tcp_pose.header.frame_id = kWorldFrameId;
|
||||
message.tcp_vel.header.frame_id = kWorldFrameId;
|
||||
message.flange_pose.header.frame_id = kWorldFrameId;
|
||||
message.ft_sensor_raw.header.frame_id = name_ + "_" + kFlangeFrameId;
|
||||
message.ext_wrench_in_tcp.header.frame_id = name_ + "_" + kFlangeFrameId;
|
||||
message.ext_wrench_in_world.header.frame_id = kWorldFrameId;
|
||||
message.ext_wrench_in_tcp_raw.header.frame_id = name_ + "_" + kFlangeFrameId;
|
||||
message.ext_wrench_in_world_raw.header.frame_id = kWorldFrameId;
|
||||
}
|
||||
|
||||
/// Return RobotStates message
|
||||
bool get_values_as_message(flexiv_msgs::msg::RobotStates& message)
|
||||
{
|
||||
const std::string flexiv_robot_states_interface_name = name_ + "/" + state_interface_name_;
|
||||
|
||||
auto flexiv_robot_states_interface
|
||||
= std::find_if(state_interfaces_.cbegin(), state_interfaces_.cend(),
|
||||
[&flexiv_robot_states_interface_name](const auto& state_interface) {
|
||||
return state_interface.get().get_name() == flexiv_robot_states_interface_name;
|
||||
});
|
||||
|
||||
if (flexiv_robot_states_interface != state_interfaces_.end()) {
|
||||
// Get the robot states pointer via bit_cast
|
||||
flexiv_robot_states_ptr = bit_cast<flexiv::rdk::RobotStates*>(
|
||||
(*flexiv_robot_states_interface).get().get_value());
|
||||
} else {
|
||||
RCLCPP_ERROR(
|
||||
rclcpp::get_logger("FlexivRobotStates"), "Robot states interface not found.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Update timestamps
|
||||
message.tcp_pose.header.stamp = message.header.stamp;
|
||||
message.tcp_vel.header.stamp = message.header.stamp;
|
||||
message.flange_pose.header.stamp = message.header.stamp;
|
||||
message.ft_sensor_raw.header.stamp = message.header.stamp;
|
||||
message.ext_wrench_in_tcp.header.stamp = message.header.stamp;
|
||||
message.ext_wrench_in_world.header.stamp = message.header.stamp;
|
||||
message.ext_wrench_in_tcp_raw.header.stamp = message.header.stamp;
|
||||
message.ext_wrench_in_world_raw.header.stamp = message.header.stamp;
|
||||
|
||||
// Fill the RobotStates message
|
||||
message.robot_timestamp.sec = flexiv_robot_states_ptr->timestamp.first;
|
||||
message.robot_timestamp.nanosec = flexiv_robot_states_ptr->timestamp.second;
|
||||
|
||||
message.q = flexiv_robot_states_ptr->q;
|
||||
message.theta = flexiv_robot_states_ptr->theta;
|
||||
message.dq = flexiv_robot_states_ptr->dq;
|
||||
message.dtheta = flexiv_robot_states_ptr->dtheta;
|
||||
message.tau = flexiv_robot_states_ptr->tau;
|
||||
message.tau_des = flexiv_robot_states_ptr->tau_des;
|
||||
message.tau_dot = flexiv_robot_states_ptr->tau_dot;
|
||||
message.tau_ext = flexiv_robot_states_ptr->tau_ext;
|
||||
message.tau_interact = flexiv_robot_states_ptr->tau_interact;
|
||||
message.temperature = flexiv_robot_states_ptr->temperature;
|
||||
|
||||
message.tcp_pose.pose = toPoseMsg(flexiv_robot_states_ptr->tcp_pose);
|
||||
message.tcp_vel.accel = toAccelMsg(flexiv_robot_states_ptr->tcp_vel);
|
||||
message.flange_pose.pose = toPoseMsg(flexiv_robot_states_ptr->flange_pose);
|
||||
message.ft_sensor_raw.wrench = toWrenchMsg(flexiv_robot_states_ptr->ft_sensor_raw);
|
||||
message.ext_wrench_in_tcp.wrench = toWrenchMsg(flexiv_robot_states_ptr->ext_wrench_in_tcp);
|
||||
message.ext_wrench_in_world.wrench
|
||||
= toWrenchMsg(flexiv_robot_states_ptr->ext_wrench_in_world);
|
||||
message.ext_wrench_in_tcp_raw.wrench
|
||||
= toWrenchMsg(flexiv_robot_states_ptr->ext_wrench_in_tcp_raw);
|
||||
message.ext_wrench_in_world_raw.wrench
|
||||
= toWrenchMsg(flexiv_robot_states_ptr->ext_wrench_in_world_raw);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
flexiv::rdk::RobotStates* flexiv_robot_states_ptr;
|
||||
|
||||
const std::string state_interface_name_ {"flexiv_robot_states"};
|
||||
|
||||
// Convert std::array to geometry_msgs::msg::Pose
|
||||
geometry_msgs::msg::Pose toPoseMsg(
|
||||
const std::array<double, flexiv::rdk::kPoseSize>& pose_values)
|
||||
{
|
||||
geometry_msgs::msg::Pose pose_msg;
|
||||
pose_msg.position = geometry_msgs::build<geometry_msgs::msg::Point>()
|
||||
.x(pose_values[0])
|
||||
.y(pose_values[1])
|
||||
.z(pose_values[2]);
|
||||
pose_msg.orientation = geometry_msgs::build<geometry_msgs::msg::Quaternion>()
|
||||
.x(pose_values[4])
|
||||
.y(pose_values[5])
|
||||
.z(pose_values[6])
|
||||
.w(pose_values[3]);
|
||||
return pose_msg;
|
||||
}
|
||||
|
||||
// Convert std::array to geometry_msgs::msg::Accel
|
||||
geometry_msgs::msg::Accel toAccelMsg(
|
||||
const std::array<double, flexiv::rdk::kCartDoF>& accel_values)
|
||||
{
|
||||
geometry_msgs::msg::Accel accel_msg;
|
||||
accel_msg.linear = geometry_msgs::build<geometry_msgs::msg::Vector3>()
|
||||
.x(accel_values[0])
|
||||
.y(accel_values[1])
|
||||
.z(accel_values[2]);
|
||||
accel_msg.angular = geometry_msgs::build<geometry_msgs::msg::Vector3>()
|
||||
.x(accel_values[3])
|
||||
.y(accel_values[4])
|
||||
.z(accel_values[5]);
|
||||
return accel_msg;
|
||||
}
|
||||
|
||||
// Convert std::array to geometry_msgs::msg::Wrench
|
||||
geometry_msgs::msg::Wrench toWrenchMsg(
|
||||
const std::array<double, flexiv::rdk::kCartDoF>& wrench_values)
|
||||
{
|
||||
geometry_msgs::msg::Wrench wrench_msg;
|
||||
wrench_msg.force = geometry_msgs::build<geometry_msgs::msg::Vector3>()
|
||||
.x(wrench_values[0])
|
||||
.y(wrench_values[1])
|
||||
.z(wrench_values[2]);
|
||||
wrench_msg.torque = geometry_msgs::build<geometry_msgs::msg::Vector3>()
|
||||
.x(wrench_values[3])
|
||||
.y(wrench_values[4])
|
||||
.z(wrench_values[5]);
|
||||
return wrench_msg;
|
||||
}
|
||||
};
|
||||
|
||||
} /* namespace semantic_components */
|
||||
|
||||
#endif /* SEMANTIC_COMPONENTS__FLEXIV_ROBOT_STATES_HPP_ */
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* @file flexiv_robot_states_broadcaster.hpp
|
||||
* @brief Header file for FlexivRobotStatesBroadcaster class
|
||||
* @copyright Copyright (C) 2016-2024 Flexiv Ltd. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef FLEXIV_ROBOT_STATES_BROADCASTER__FLEXIV_ROBOT_STATES_BROADCASTER_HPP_
|
||||
#define FLEXIV_ROBOT_STATES_BROADCASTER__FLEXIV_ROBOT_STATES_BROADCASTER_HPP_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "controller_interface/controller_interface.hpp"
|
||||
#include "flexiv_msgs/msg/robot_states.hpp"
|
||||
#include "flexiv_robot_states_broadcaster/flexiv_robot_states.hpp"
|
||||
#include "flexiv_robot_states_broadcaster/flexiv_robot_states_broadcaster_parameters.hpp"
|
||||
#include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp"
|
||||
#include "rclcpp_lifecycle/state.hpp"
|
||||
#include "realtime_tools/realtime_publisher.hpp"
|
||||
|
||||
namespace flexiv_robot_states_broadcaster {
|
||||
using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
|
||||
|
||||
const std::string kRobotStatesTopic = "/flexiv_robot_states";
|
||||
const std::string kTcpPoseTopic = "/tcp_pose";
|
||||
const std::string kTcpVelocityTopic = "/tcp_velocity";
|
||||
const std::string kFlangePoseTopic = "/flange_pose";
|
||||
const std::string kFTSensorTopic = "/ft_sensor_wrench";
|
||||
const std::string kExternalWrenchInTcpFrameTopic = "/external_wrench_in_tcp";
|
||||
const std::string kExternalWrenchInWorldFrameTopic = "/external_wrench_in_world";
|
||||
|
||||
class FlexivRobotStatesBroadcaster : public controller_interface::ControllerInterface
|
||||
{
|
||||
public:
|
||||
FlexivRobotStatesBroadcaster();
|
||||
|
||||
controller_interface::InterfaceConfiguration command_interface_configuration() const override;
|
||||
|
||||
controller_interface::InterfaceConfiguration state_interface_configuration() const override;
|
||||
|
||||
controller_interface::return_type update(
|
||||
const rclcpp::Time& time, const rclcpp::Duration& period) override;
|
||||
|
||||
CallbackReturn on_init() override;
|
||||
|
||||
CallbackReturn on_configure(const rclcpp_lifecycle::State& previous_state) override;
|
||||
|
||||
CallbackReturn on_activate(const rclcpp_lifecycle::State& previous_state) override;
|
||||
|
||||
CallbackReturn on_deactivate(const rclcpp_lifecycle::State& previous_state) override;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<ParamListener> param_listener_;
|
||||
Params params_;
|
||||
|
||||
std::unique_ptr<semantic_components::FlexivRobotStates> flexiv_robot_states_;
|
||||
|
||||
std::shared_ptr<rclcpp::Publisher<flexiv_msgs::msg::RobotStates>>
|
||||
flexiv_robot_states_publisher_;
|
||||
using StatePublisher = realtime_tools::RealtimePublisher<flexiv_msgs::msg::RobotStates>;
|
||||
std::shared_ptr<StatePublisher> realtime_flexiv_robot_states_publisher_;
|
||||
|
||||
using PoseStampedPublisher = rclcpp::Publisher<geometry_msgs::msg::PoseStamped>;
|
||||
std::shared_ptr<PoseStampedPublisher> tcp_pose_publisher_;
|
||||
std::shared_ptr<PoseStampedPublisher> flange_pose_publisher_;
|
||||
|
||||
using AccelStampedPublisher = rclcpp::Publisher<geometry_msgs::msg::AccelStamped>;
|
||||
std::shared_ptr<AccelStampedPublisher> tcp_velocity_publisher_;
|
||||
|
||||
using WrenchStampedPublisher = rclcpp::Publisher<geometry_msgs::msg::WrenchStamped>;
|
||||
std::shared_ptr<WrenchStampedPublisher> ft_sensor_publisher_;
|
||||
std::shared_ptr<WrenchStampedPublisher> external_wrench_in_tcp_publisher_;
|
||||
std::shared_ptr<WrenchStampedPublisher> external_wrench_in_world_publisher_;
|
||||
};
|
||||
|
||||
} /* namespace flexiv_robot_states_broadcaster */
|
||||
|
||||
#endif /* FLEXIV_ROBOT_STATES_BROADCASTER__FLEXIV_ROBOT_STATES_BROADCASTER_HPP_ */
|
||||
+234
@@ -0,0 +1,234 @@
|
||||
// auto-generated DO NOT EDIT
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
#include <mutex>
|
||||
#include <rclcpp/node.hpp>
|
||||
#include <rclcpp_lifecycle/lifecycle_node.hpp>
|
||||
#include <rclcpp/logger.hpp>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <fmt/core.h>
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#include <parameter_traits/parameter_traits.hpp>
|
||||
|
||||
#include <rsl/static_string.hpp>
|
||||
#include <rsl/static_vector.hpp>
|
||||
#include <rsl/parameter_validators.hpp>
|
||||
|
||||
|
||||
|
||||
namespace flexiv_robot_states_broadcaster {
|
||||
|
||||
// Use validators from RSL
|
||||
using rsl::unique;
|
||||
using rsl::subset_of;
|
||||
using rsl::fixed_size;
|
||||
using rsl::size_gt;
|
||||
using rsl::size_lt;
|
||||
using rsl::not_empty;
|
||||
using rsl::element_bounds;
|
||||
using rsl::lower_element_bounds;
|
||||
using rsl::upper_element_bounds;
|
||||
using rsl::bounds;
|
||||
using rsl::lt;
|
||||
using rsl::gt;
|
||||
using rsl::lt_eq;
|
||||
using rsl::gt_eq;
|
||||
using rsl::one_of;
|
||||
using rsl::to_parameter_result_msg;
|
||||
|
||||
// temporarily needed for backwards compatibility for custom validators
|
||||
using namespace parameter_traits;
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] auto to_parameter_value(T value) {
|
||||
return rclcpp::ParameterValue(value);
|
||||
}
|
||||
|
||||
template <size_t capacity>
|
||||
[[nodiscard]] auto to_parameter_value(rsl::StaticString<capacity> const& value) {
|
||||
return rclcpp::ParameterValue(rsl::to_string(value));
|
||||
}
|
||||
|
||||
template <typename T, size_t capacity>
|
||||
[[nodiscard]] auto to_parameter_value(rsl::StaticVector<T, capacity> const& value) {
|
||||
return rclcpp::ParameterValue(rsl::to_vector(value));
|
||||
}
|
||||
struct Params {
|
||||
std::string robot_sn = "";
|
||||
// for detecting if the parameter struct has been updated
|
||||
rclcpp::Time __stamp;
|
||||
};
|
||||
struct StackParams {
|
||||
};
|
||||
|
||||
class ParamListener{
|
||||
public:
|
||||
// throws rclcpp::exceptions::InvalidParameterValueException on initialization if invalid parameter are loaded
|
||||
ParamListener(rclcpp::Node::SharedPtr node, std::string const& prefix = "")
|
||||
: ParamListener(node->get_node_parameters_interface(), node->get_logger(), prefix) {}
|
||||
|
||||
ParamListener(rclcpp_lifecycle::LifecycleNode::SharedPtr node, std::string const& prefix = "")
|
||||
: ParamListener(node->get_node_parameters_interface(), node->get_logger(), prefix) {}
|
||||
|
||||
ParamListener(const std::shared_ptr<rclcpp::node_interfaces::NodeParametersInterface>& parameters_interface,
|
||||
std::string const& prefix = "")
|
||||
: ParamListener(parameters_interface, rclcpp::get_logger("flexiv_robot_states_broadcaster"), prefix) {
|
||||
RCLCPP_DEBUG(logger_, "ParameterListener: Not using node logger, recommend using other constructors to use a node logger");
|
||||
}
|
||||
|
||||
ParamListener(const std::shared_ptr<rclcpp::node_interfaces::NodeParametersInterface>& parameters_interface,
|
||||
rclcpp::Logger logger, std::string const& prefix = "")
|
||||
: prefix_{prefix},
|
||||
logger_{std::move(logger)} {
|
||||
if (!prefix_.empty() && prefix_.back() != '.') {
|
||||
prefix_ += ".";
|
||||
}
|
||||
|
||||
parameters_interface_ = parameters_interface;
|
||||
declare_params();
|
||||
auto update_param_cb = [this](const std::vector<rclcpp::Parameter> ¶meters){return this->update(parameters);};
|
||||
handle_ = parameters_interface_->add_on_set_parameters_callback(update_param_cb);
|
||||
clock_ = rclcpp::Clock();
|
||||
}
|
||||
|
||||
Params get_params() const{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
return params_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Tries to update the parsed Params object
|
||||
* @param params_in The Params object to update
|
||||
* @return true if the Params object was updated, false if it was already up to date or the mutex could not be locked
|
||||
* @note This function tries to lock the mutex without blocking, so it can be used in a RT loop
|
||||
*/
|
||||
bool try_update_params(Params & params_in) const {
|
||||
std::unique_lock<std::mutex> lock(mutex_, std::try_to_lock);
|
||||
if (lock.owns_lock()) {
|
||||
if (const bool is_old = params_in.__stamp != params_.__stamp; is_old) {
|
||||
params_in = params_;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Tries to get the current Params object
|
||||
* @param params_in The Params object to fill with the current parameters
|
||||
* @return true if mutex can be locked, false if mutex could not be locked
|
||||
* @note The parameters are only filled, when the mutex can be locked and the params timestamp is different
|
||||
* @note This function tries to lock the mutex without blocking, so it can be used in a RT loop
|
||||
*/
|
||||
bool try_get_params(Params & params_in) const {
|
||||
if (mutex_.try_lock()) {
|
||||
if (const bool is_old = params_in.__stamp != params_.__stamp; is_old) {
|
||||
params_in = params_;
|
||||
}
|
||||
mutex_.unlock();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_old(Params const& other) const {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
return params_.__stamp != other.__stamp;
|
||||
}
|
||||
|
||||
StackParams get_stack_params() {
|
||||
Params params = get_params();
|
||||
StackParams output;
|
||||
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void refresh_dynamic_parameters() {
|
||||
auto updated_params = get_params();
|
||||
// TODO remove any destroyed dynamic parameters
|
||||
|
||||
// declare any new dynamic parameters
|
||||
rclcpp::Parameter param;
|
||||
|
||||
}
|
||||
|
||||
rcl_interfaces::msg::SetParametersResult update(const std::vector<rclcpp::Parameter> ¶meters) {
|
||||
auto updated_params = get_params();
|
||||
|
||||
for (const auto ¶m: parameters) {
|
||||
if (param.get_name() == (prefix_ + "robot_sn")) {
|
||||
updated_params.robot_sn = param.as_string();
|
||||
RCLCPP_DEBUG_STREAM(logger_, param.get_name() << ": " << param.get_type_name() << " = " << param.value_to_string());
|
||||
}
|
||||
}
|
||||
|
||||
updated_params.__stamp = clock_.now();
|
||||
update_internal_params(updated_params);
|
||||
if (user_callback_) {
|
||||
user_callback_(updated_params);
|
||||
}
|
||||
return rsl::to_parameter_result_msg({});
|
||||
}
|
||||
|
||||
void declare_params(){
|
||||
auto updated_params = get_params();
|
||||
// declare all parameters and give default values to non-required ones
|
||||
if (!parameters_interface_->has_parameter(prefix_ + "robot_sn")) {
|
||||
rcl_interfaces::msg::ParameterDescriptor descriptor;
|
||||
descriptor.description = "Robot arm serial number";
|
||||
descriptor.read_only = false;
|
||||
auto parameter = to_parameter_value(updated_params.robot_sn);
|
||||
parameters_interface_->declare_parameter(prefix_ + "robot_sn", parameter, descriptor);
|
||||
}
|
||||
// get parameters and fill struct fields
|
||||
rclcpp::Parameter param;
|
||||
param = parameters_interface_->get_parameter(prefix_ + "robot_sn");
|
||||
RCLCPP_DEBUG_STREAM(logger_, param.get_name() << ": " << param.get_type_name() << " = " << param.value_to_string());
|
||||
updated_params.robot_sn = param.as_string();
|
||||
|
||||
|
||||
updated_params.__stamp = clock_.now();
|
||||
update_internal_params(updated_params);
|
||||
}
|
||||
|
||||
using userParameterUpdateCB = std::function<void(const Params&)>;
|
||||
void setUserCallback(const userParameterUpdateCB& callback){
|
||||
user_callback_ = callback;
|
||||
}
|
||||
|
||||
void clearUserCallback(){
|
||||
user_callback_ = {};
|
||||
}
|
||||
|
||||
private:
|
||||
void update_internal_params(Params updated_params) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
params_ = std::move(updated_params);
|
||||
}
|
||||
|
||||
std::string prefix_;
|
||||
Params params_;
|
||||
rclcpp::Clock clock_;
|
||||
std::shared_ptr<rclcpp::node_interfaces::OnSetParametersCallbackHandle> handle_;
|
||||
std::shared_ptr<rclcpp::node_interfaces::NodeParametersInterface> parameters_interface_;
|
||||
userParameterUpdateCB user_callback_;
|
||||
|
||||
rclcpp::Logger logger_;
|
||||
std::mutex mutable mutex_;
|
||||
};
|
||||
|
||||
} // namespace flexiv_robot_states_broadcaster
|
||||
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
share/flexiv_robot_states_broadcaster/flexiv_robot_states_broadcaster.xml
|
||||
+1
@@ -0,0 +1 @@
|
||||
controller_interface;flexiv_hardware;flexiv_msgs;generate_parameter_library;geometry_msgs;hardware_interface;pluginlib;rclcpp;rclcpp_lifecycle;realtime_tools
|
||||
+1
@@ -0,0 +1 @@
|
||||
/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_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
|
||||
+1
@@ -0,0 +1 @@
|
||||
controller_interface:flexiv_hardware:flexiv_msgs:generate_parameter_library:geometry_msgs:hardware_interface:pluginlib:rclcpp:rclcpp_lifecycle:realtime_tools
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
# generated from ament_cmake_export_dependencies/cmake/ament_cmake_export_dependencies-extras.cmake.in
|
||||
|
||||
set(_exported_dependencies "fmt;parameter_traits;rclcpp;rclcpp_lifecycle;rsl;tcb_span;tl_expected;builtin_interfaces;controller_interface;flexiv_hardware;flexiv_msgs;generate_parameter_library;geometry_msgs;hardware_interface;pluginlib;rclcpp_lifecycle;rcutils;realtime_tools")
|
||||
|
||||
find_package(ament_cmake_libraries QUIET REQUIRED)
|
||||
|
||||
# find_package() all dependencies
|
||||
# and append their DEFINITIONS INCLUDE_DIRS, LIBRARIES, and LINK_FLAGS
|
||||
# variables to flexiv_robot_states_broadcaster_DEFINITIONS, flexiv_robot_states_broadcaster_INCLUDE_DIRS,
|
||||
# flexiv_robot_states_broadcaster_LIBRARIES, and flexiv_robot_states_broadcaster_LINK_FLAGS.
|
||||
# Additionally collect the direct dependency names in
|
||||
# flexiv_robot_states_broadcaster_DEPENDENCIES as well as the recursive dependency names
|
||||
# in flexiv_robot_states_broadcaster_RECURSIVE_DEPENDENCIES.
|
||||
if(NOT _exported_dependencies STREQUAL "")
|
||||
find_package(ament_cmake_core QUIET REQUIRED)
|
||||
set(flexiv_robot_states_broadcaster_DEPENDENCIES ${_exported_dependencies})
|
||||
set(flexiv_robot_states_broadcaster_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_robot_states_broadcaster_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_robot_states_broadcaster_DEFINITIONS "${${_dep}_DEFINITIONS}")
|
||||
endif()
|
||||
if(${_dep}_INCLUDE_DIRS)
|
||||
list_append_unique(flexiv_robot_states_broadcaster_INCLUDE_DIRS "${${_dep}_INCLUDE_DIRS}")
|
||||
endif()
|
||||
if(${_dep}_LIBRARIES)
|
||||
list(APPEND _libraries "${${_dep}_LIBRARIES}")
|
||||
endif()
|
||||
if(${_dep}_LINK_FLAGS)
|
||||
list_append_unique(flexiv_robot_states_broadcaster_LINK_FLAGS "${${_dep}_LINK_FLAGS}")
|
||||
endif()
|
||||
if(${_dep}_RECURSIVE_DEPENDENCIES)
|
||||
list_append_unique(flexiv_robot_states_broadcaster_RECURSIVE_DEPENDENCIES "${${_dep}_RECURSIVE_DEPENDENCIES}")
|
||||
endif()
|
||||
endif()
|
||||
if(_libraries)
|
||||
ament_libraries_deduplicate(_libraries "${_libraries}")
|
||||
list(APPEND _libraries ${flexiv_robot_states_broadcaster_LIBRARIES})
|
||||
list(REMOVE_DUPLICATES _libraries)
|
||||
set(flexiv_robot_states_broadcaster_LIBRARIES ${_libraries})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
# generated from ament_cmake_export_targets/cmake/ament_cmake_export_targets-extras.cmake.in
|
||||
|
||||
set(_exported_targets "export_flexiv_robot_states_broadcaster")
|
||||
|
||||
# include all exported targets
|
||||
if(NOT _exported_targets STREQUAL "")
|
||||
foreach(_target ${_exported_targets})
|
||||
set(_export_file "${flexiv_robot_states_broadcaster_DIR}/${_target}Export.cmake")
|
||||
include("${_export_file}")
|
||||
|
||||
# extract the target names associated with the export
|
||||
set(_regex "foreach\\((_cmake)?_expected_?[Tt]arget (IN ITEMS )?(.+)\\)")
|
||||
file(
|
||||
STRINGS "${_export_file}" _foreach_targets
|
||||
REGEX "${_regex}")
|
||||
list(LENGTH _foreach_targets _matches)
|
||||
if(NOT _matches EQUAL 1)
|
||||
message(FATAL_ERROR
|
||||
"Failed to find exported target names in '${_export_file}'")
|
||||
endif()
|
||||
string(REGEX REPLACE "${_regex}" "\\3" _targets "${_foreach_targets}")
|
||||
string(REPLACE " " ";" _targets "${_targets}")
|
||||
list(LENGTH _targets _length)
|
||||
|
||||
list(APPEND flexiv_robot_states_broadcaster_TARGETS ${_targets})
|
||||
endforeach()
|
||||
endif()
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#----------------------------------------------------------------
|
||||
# Generated CMake target import file.
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Commands may need to know the format version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||
|
||||
# Import target "flexiv_robot_states_broadcaster::flexiv_robot_states_broadcaster" for configuration ""
|
||||
set_property(TARGET flexiv_robot_states_broadcaster::flexiv_robot_states_broadcaster APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
|
||||
set_target_properties(flexiv_robot_states_broadcaster::flexiv_robot_states_broadcaster PROPERTIES
|
||||
IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/lib/libflexiv_robot_states_broadcaster.so"
|
||||
IMPORTED_SONAME_NOCONFIG "libflexiv_robot_states_broadcaster.so"
|
||||
)
|
||||
|
||||
list(APPEND _cmake_import_check_targets flexiv_robot_states_broadcaster::flexiv_robot_states_broadcaster )
|
||||
list(APPEND _cmake_import_check_files_for_flexiv_robot_states_broadcaster::flexiv_robot_states_broadcaster "${_IMPORT_PREFIX}/lib/libflexiv_robot_states_broadcaster.so" )
|
||||
|
||||
# Commands beyond this point should not need to know the version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION)
|
||||
+116
File diff suppressed because one or more lines are too long
+14
@@ -0,0 +1,14 @@
|
||||
# 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()
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
# generated from ament/cmake/core/templates/nameConfig.cmake.in
|
||||
|
||||
# prevent multiple inclusion
|
||||
if(_flexiv_robot_states_broadcaster_CONFIG_INCLUDED)
|
||||
# ensure to keep the found flag the same
|
||||
if(NOT DEFINED flexiv_robot_states_broadcaster_FOUND)
|
||||
# explicitly set it to FALSE, otherwise CMake will set it to TRUE
|
||||
set(flexiv_robot_states_broadcaster_FOUND FALSE)
|
||||
elseif(NOT flexiv_robot_states_broadcaster_FOUND)
|
||||
# use separate condition to avoid uninitialized variable warning
|
||||
set(flexiv_robot_states_broadcaster_FOUND FALSE)
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
set(_flexiv_robot_states_broadcaster_CONFIG_INCLUDED TRUE)
|
||||
|
||||
# output package information
|
||||
if(NOT flexiv_robot_states_broadcaster_FIND_QUIETLY)
|
||||
message(STATUS "Found flexiv_robot_states_broadcaster: 1.9.1 (${flexiv_robot_states_broadcaster_DIR})")
|
||||
endif()
|
||||
|
||||
# warn when using a deprecated package
|
||||
if(NOT "" STREQUAL "")
|
||||
set(_msg "Package 'flexiv_robot_states_broadcaster' is deprecated")
|
||||
# append custom deprecation text if available
|
||||
if(NOT "" STREQUAL "TRUE")
|
||||
set(_msg "${_msg} ()")
|
||||
endif()
|
||||
# optionally quiet the deprecation message
|
||||
if(NOT ${flexiv_robot_states_broadcaster_DEPRECATED_QUIET})
|
||||
message(DEPRECATION "${_msg}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# flag package as ament-based to distinguish it after being find_package()-ed
|
||||
set(flexiv_robot_states_broadcaster_FOUND_AMENT_PACKAGE TRUE)
|
||||
|
||||
# include all config extra files
|
||||
set(_extras "ament_cmake_export_dependencies-extras.cmake;ament_cmake_export_targets-extras.cmake")
|
||||
foreach(_extra ${_extras})
|
||||
include("${flexiv_robot_states_broadcaster_DIR}/${_extra}")
|
||||
endforeach()
|
||||
+1
@@ -0,0 +1 @@
|
||||
prepend-non-duplicate;AMENT_PREFIX_PATH;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
# copied from
|
||||
# ament_cmake_core/cmake/environment_hooks/environment/ament_prefix_path.sh
|
||||
|
||||
ament_prepend_unique_value AMENT_PREFIX_PATH "$AMENT_CURRENT_PREFIX"
|
||||
+1
@@ -0,0 +1 @@
|
||||
prepend-non-duplicate-if-exists;PATH;bin
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
# 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
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<library path="flexiv_robot_states_broadcaster">
|
||||
<class name="flexiv_robot_states_broadcaster/FlexivRobotStatesBroadcaster"
|
||||
type="flexiv_robot_states_broadcaster::FlexivRobotStatesBroadcaster" base_class_type="controller_interface::ControllerInterface">
|
||||
<description>
|
||||
The robot states broadcaster publishes the Flexiv robot states.
|
||||
</description>
|
||||
</class>
|
||||
</library>
|
||||
+1
@@ -0,0 +1 @@
|
||||
prepend-non-duplicate;CMAKE_PREFIX_PATH;
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
# generated from colcon_powershell/shell/template/hook_prepend_value.ps1.em
|
||||
|
||||
colcon_prepend_unique_value CMAKE_PREFIX_PATH "$env:COLCON_CURRENT_PREFIX"
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
# generated from colcon_core/shell/template/hook_prepend_value.sh.em
|
||||
|
||||
_colcon_prepend_unique_value CMAKE_PREFIX_PATH "$COLCON_CURRENT_PREFIX"
|
||||
+1
@@ -0,0 +1 @@
|
||||
prepend-non-duplicate;LD_LIBRARY_PATH;lib
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
# generated from colcon_powershell/shell/template/hook_prepend_value.ps1.em
|
||||
|
||||
colcon_prepend_unique_value LD_LIBRARY_PATH "$env:COLCON_CURRENT_PREFIX/lib"
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
# generated from colcon_core/shell/template/hook_prepend_value.sh.em
|
||||
|
||||
_colcon_prepend_unique_value LD_LIBRARY_PATH "$COLCON_CURRENT_PREFIX/lib"
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
# 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
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
source;share/flexiv_robot_states_broadcaster/environment/ament_prefix_path.sh
|
||||
source;share/flexiv_robot_states_broadcaster/environment/path.sh
|
||||
+184
@@ -0,0 +1,184 @@
|
||||
# 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_robot_states_broadcaster"}
|
||||
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_robot_states_broadcaster/environment/ament_prefix_path.sh"
|
||||
ament_append_value AMENT_ENVIRONMENT_HOOKS "$AMENT_CURRENT_PREFIX/share/flexiv_robot_states_broadcaster/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
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
# 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
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
# generated from colcon_bash/shell/template/package.bash.em
|
||||
|
||||
# This script extends the environment for this package.
|
||||
|
||||
# a bash script is able to determine its own path if necessary
|
||||
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||
# the prefix is two levels up from the package specific share directory
|
||||
_colcon_package_bash_COLCON_CURRENT_PREFIX="$(builtin cd "`dirname "${BASH_SOURCE[0]}"`/../.." > /dev/null && pwd)"
|
||||
else
|
||||
_colcon_package_bash_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
|
||||
fi
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
# additional arguments: arguments to the script
|
||||
_colcon_package_bash_source_script() {
|
||||
if [ -f "$1" ]; then
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
echo "# . \"$1\""
|
||||
fi
|
||||
. "$@"
|
||||
else
|
||||
echo "not found: \"$1\"" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
# source sh script of this package
|
||||
_colcon_package_bash_source_script "$_colcon_package_bash_COLCON_CURRENT_PREFIX/share/flexiv_robot_states_broadcaster/package.sh"
|
||||
|
||||
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced scripts
|
||||
COLCON_CURRENT_PREFIX="$_colcon_package_bash_COLCON_CURRENT_PREFIX"
|
||||
|
||||
# source bash hooks
|
||||
_colcon_package_bash_source_script "$COLCON_CURRENT_PREFIX/share/flexiv_robot_states_broadcaster/local_setup.bash"
|
||||
|
||||
unset COLCON_CURRENT_PREFIX
|
||||
|
||||
unset _colcon_package_bash_source_script
|
||||
unset _colcon_package_bash_COLCON_CURRENT_PREFIX
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
source;share/flexiv_robot_states_broadcaster/hook/cmake_prefix_path.ps1
|
||||
source;share/flexiv_robot_states_broadcaster/hook/cmake_prefix_path.dsv
|
||||
source;share/flexiv_robot_states_broadcaster/hook/cmake_prefix_path.sh
|
||||
source;share/flexiv_robot_states_broadcaster/hook/ld_library_path_lib.ps1
|
||||
source;share/flexiv_robot_states_broadcaster/hook/ld_library_path_lib.dsv
|
||||
source;share/flexiv_robot_states_broadcaster/hook/ld_library_path_lib.sh
|
||||
source;share/flexiv_robot_states_broadcaster/local_setup.bash
|
||||
source;share/flexiv_robot_states_broadcaster/local_setup.dsv
|
||||
source;share/flexiv_robot_states_broadcaster/local_setup.ps1
|
||||
source;share/flexiv_robot_states_broadcaster/local_setup.sh
|
||||
source;share/flexiv_robot_states_broadcaster/local_setup.zsh
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
# generated from colcon_powershell/shell/template/package.ps1.em
|
||||
|
||||
# function to append a value to a variable
|
||||
# which uses colons as separators
|
||||
# duplicates as well as leading separators are avoided
|
||||
# first argument: the name of the result variable
|
||||
# second argument: the value to be prepended
|
||||
function colcon_append_unique_value {
|
||||
param (
|
||||
$_listname,
|
||||
$_value
|
||||
)
|
||||
|
||||
# get values from variable
|
||||
if (Test-Path Env:$_listname) {
|
||||
$_values=(Get-Item env:$_listname).Value
|
||||
} else {
|
||||
$_values=""
|
||||
}
|
||||
$_duplicate=""
|
||||
# start with no values
|
||||
$_all_values=""
|
||||
# iterate over existing values in the variable
|
||||
if ($_values) {
|
||||
$_values.Split(":") | ForEach {
|
||||
# not an empty string
|
||||
if ($_) {
|
||||
# not a duplicate of _value
|
||||
if ($_ -eq $_value) {
|
||||
$_duplicate="1"
|
||||
}
|
||||
if ($_all_values) {
|
||||
$_all_values="${_all_values}:$_"
|
||||
} else {
|
||||
$_all_values="$_"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# append only non-duplicates
|
||||
if (!$_duplicate) {
|
||||
# avoid leading separator
|
||||
if ($_all_values) {
|
||||
$_all_values="${_all_values}:${_value}"
|
||||
} else {
|
||||
$_all_values="${_value}"
|
||||
}
|
||||
}
|
||||
|
||||
# export the updated variable
|
||||
Set-Item env:\$_listname -Value "$_all_values"
|
||||
}
|
||||
|
||||
# function to prepend a value to a variable
|
||||
# which uses colons as separators
|
||||
# duplicates as well as trailing separators are avoided
|
||||
# first argument: the name of the result variable
|
||||
# second argument: the value to be prepended
|
||||
function colcon_prepend_unique_value {
|
||||
param (
|
||||
$_listname,
|
||||
$_value
|
||||
)
|
||||
|
||||
# get values from variable
|
||||
if (Test-Path Env:$_listname) {
|
||||
$_values=(Get-Item env:$_listname).Value
|
||||
} else {
|
||||
$_values=""
|
||||
}
|
||||
# start with the new value
|
||||
$_all_values="$_value"
|
||||
# iterate over existing values in the variable
|
||||
if ($_values) {
|
||||
$_values.Split(":") | ForEach {
|
||||
# not an empty string
|
||||
if ($_) {
|
||||
# not a duplicate of _value
|
||||
if ($_ -ne $_value) {
|
||||
# keep non-duplicate values
|
||||
$_all_values="${_all_values}:$_"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# export the updated variable
|
||||
Set-Item env:\$_listname -Value "$_all_values"
|
||||
}
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
# additional arguments: arguments to the script
|
||||
function colcon_package_source_powershell_script {
|
||||
param (
|
||||
$_colcon_package_source_powershell_script
|
||||
)
|
||||
# source script with conditional trace output
|
||||
if (Test-Path $_colcon_package_source_powershell_script) {
|
||||
if ($env:COLCON_TRACE) {
|
||||
echo ". '$_colcon_package_source_powershell_script'"
|
||||
}
|
||||
. "$_colcon_package_source_powershell_script"
|
||||
} else {
|
||||
Write-Error "not found: '$_colcon_package_source_powershell_script'"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# a powershell script is able to determine its own path
|
||||
# the prefix is two levels up from the package specific share directory
|
||||
$env:COLCON_CURRENT_PREFIX=(Get-Item $PSCommandPath).Directory.Parent.Parent.FullName
|
||||
|
||||
colcon_package_source_powershell_script "$env:COLCON_CURRENT_PREFIX/share/flexiv_robot_states_broadcaster/hook/cmake_prefix_path.ps1"
|
||||
colcon_package_source_powershell_script "$env:COLCON_CURRENT_PREFIX/share/flexiv_robot_states_broadcaster/hook/ld_library_path_lib.ps1"
|
||||
colcon_package_source_powershell_script "$env:COLCON_CURRENT_PREFIX/share/flexiv_robot_states_broadcaster/local_setup.ps1"
|
||||
|
||||
Remove-Item Env:\COLCON_CURRENT_PREFIX
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
# generated from colcon_core/shell/template/package.sh.em
|
||||
|
||||
# This script extends the environment for this package.
|
||||
|
||||
# function to prepend a value to a variable
|
||||
# which uses colons as separators
|
||||
# duplicates as well as trailing separators are avoided
|
||||
# first argument: the name of the result variable
|
||||
# second argument: the value to be prepended
|
||||
_colcon_prepend_unique_value() {
|
||||
# arguments
|
||||
_listname="$1"
|
||||
_value="$2"
|
||||
|
||||
# get values from variable
|
||||
eval _values=\"\$$_listname\"
|
||||
# backup the field separator
|
||||
_colcon_prepend_unique_value_IFS=$IFS
|
||||
IFS=":"
|
||||
# start with the new value
|
||||
_all_values="$_value"
|
||||
# workaround SH_WORD_SPLIT not being set in zsh
|
||||
if [ "$(command -v colcon_zsh_convert_to_array)" ]; then
|
||||
colcon_zsh_convert_to_array _values
|
||||
fi
|
||||
# iterate over existing values in the variable
|
||||
for _item in $_values; do
|
||||
# ignore empty strings
|
||||
if [ -z "$_item" ]; then
|
||||
continue
|
||||
fi
|
||||
# ignore duplicates of _value
|
||||
if [ "$_item" = "$_value" ]; then
|
||||
continue
|
||||
fi
|
||||
# keep non-duplicate values
|
||||
_all_values="$_all_values:$_item"
|
||||
done
|
||||
unset _item
|
||||
# restore the field separator
|
||||
IFS=$_colcon_prepend_unique_value_IFS
|
||||
unset _colcon_prepend_unique_value_IFS
|
||||
# export the updated variable
|
||||
eval export $_listname=\"$_all_values\"
|
||||
unset _all_values
|
||||
unset _values
|
||||
|
||||
unset _value
|
||||
unset _listname
|
||||
}
|
||||
|
||||
# since a plain shell script can't determine its own path when being sourced
|
||||
# either use the provided COLCON_CURRENT_PREFIX
|
||||
# or fall back to the build time prefix (if it exists)
|
||||
_colcon_package_sh_COLCON_CURRENT_PREFIX="/home/cc/ros2/install/flexiv_robot_states_broadcaster"
|
||||
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||
if [ ! -d "$_colcon_package_sh_COLCON_CURRENT_PREFIX" ]; then
|
||||
echo "The build time path \"$_colcon_package_sh_COLCON_CURRENT_PREFIX\" doesn't exist. Either source a script for a different shell or set the environment variable \"COLCON_CURRENT_PREFIX\" explicitly." 1>&2
|
||||
unset _colcon_package_sh_COLCON_CURRENT_PREFIX
|
||||
return 1
|
||||
fi
|
||||
COLCON_CURRENT_PREFIX="$_colcon_package_sh_COLCON_CURRENT_PREFIX"
|
||||
fi
|
||||
unset _colcon_package_sh_COLCON_CURRENT_PREFIX
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
# additional arguments: arguments to the script
|
||||
_colcon_package_sh_source_script() {
|
||||
if [ -f "$1" ]; then
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
echo "# . \"$1\""
|
||||
fi
|
||||
. "$@"
|
||||
else
|
||||
echo "not found: \"$1\"" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
# source sh hooks
|
||||
_colcon_package_sh_source_script "$COLCON_CURRENT_PREFIX/share/flexiv_robot_states_broadcaster/hook/cmake_prefix_path.sh"
|
||||
_colcon_package_sh_source_script "$COLCON_CURRENT_PREFIX/share/flexiv_robot_states_broadcaster/hook/ld_library_path_lib.sh"
|
||||
_colcon_package_sh_source_script "$COLCON_CURRENT_PREFIX/share/flexiv_robot_states_broadcaster/local_setup.sh"
|
||||
|
||||
unset _colcon_package_sh_source_script
|
||||
unset COLCON_CURRENT_PREFIX
|
||||
|
||||
# do not unset _colcon_prepend_unique_value since it might be used by non-primary shell hooks
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<?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_robot_states_broadcaster</name>
|
||||
<version>1.9.1</version>
|
||||
<description>The robot states broadcaster publishes the Flexiv robot states.</description>
|
||||
<maintainer email="munseng.phoon@flexiv.com">Mun Seng Phoon</maintainer>
|
||||
<license>Apache License 2.0</license>
|
||||
<author email="munseng.phoon@flexiv.com">Mun Seng Phoon</author>
|
||||
|
||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||
|
||||
<depend>controller_interface</depend>
|
||||
<depend>flexiv_hardware</depend>
|
||||
<depend>flexiv_msgs</depend>
|
||||
<depend>generate_parameter_library</depend>
|
||||
<depend>geometry_msgs</depend>
|
||||
<depend>hardware_interface</depend>
|
||||
<depend>pluginlib</depend>
|
||||
<depend>rclcpp</depend>
|
||||
<depend>rclcpp_lifecycle</depend>
|
||||
<depend>realtime_tools</depend>
|
||||
|
||||
<export>
|
||||
<build_type>ament_cmake</build_type>
|
||||
</export>
|
||||
</package>
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
# generated from colcon_zsh/shell/template/package.zsh.em
|
||||
|
||||
# This script extends the environment for this package.
|
||||
|
||||
# a zsh script is able to determine its own path if necessary
|
||||
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||
# the prefix is two levels up from the package specific share directory
|
||||
_colcon_package_zsh_COLCON_CURRENT_PREFIX="$(builtin cd -q "`dirname "${(%):-%N}"`/../.." > /dev/null && pwd)"
|
||||
else
|
||||
_colcon_package_zsh_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
|
||||
fi
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
# additional arguments: arguments to the script
|
||||
_colcon_package_zsh_source_script() {
|
||||
if [ -f "$1" ]; then
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
echo "# . \"$1\""
|
||||
fi
|
||||
. "$@"
|
||||
else
|
||||
echo "not found: \"$1\"" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
# function to convert array-like strings into arrays
|
||||
# to workaround SH_WORD_SPLIT not being set
|
||||
colcon_zsh_convert_to_array() {
|
||||
local _listname=$1
|
||||
local _dollar="$"
|
||||
local _split="{="
|
||||
local _to_array="(\"$_dollar$_split$_listname}\")"
|
||||
eval $_listname=$_to_array
|
||||
}
|
||||
|
||||
# source sh script of this package
|
||||
_colcon_package_zsh_source_script "$_colcon_package_zsh_COLCON_CURRENT_PREFIX/share/flexiv_robot_states_broadcaster/package.sh"
|
||||
unset convert_zsh_to_array
|
||||
|
||||
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced scripts
|
||||
COLCON_CURRENT_PREFIX="$_colcon_package_zsh_COLCON_CURRENT_PREFIX"
|
||||
|
||||
# source zsh hooks
|
||||
_colcon_package_zsh_source_script "$COLCON_CURRENT_PREFIX/share/flexiv_robot_states_broadcaster/local_setup.zsh"
|
||||
|
||||
unset COLCON_CURRENT_PREFIX
|
||||
|
||||
unset _colcon_package_zsh_source_script
|
||||
unset _colcon_package_zsh_COLCON_CURRENT_PREFIX
|
||||
Reference in New Issue
Block a user