-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Here is an example of some of the generated code:
namespace admittance_controller_parameters {
struct Params {
std::vector<std::string> joints_ ;
std::vector<std::string> command_interfaces_ ;
std::vector<std::string> state_interfaces_ ;
std::vector<std::string> chainable_command_interfaces_ ;
struct kinematics {
std::string plugin_name_;
std::string plugin_package_;
std::string base_;
std::string tip_;
double alpha_ = 0.0005;
std::string group_name_;
} kinematics_;
struct ft_sensor {
std::string name_;
struct frame {
std::string id_;
bool external_;
} frame_;
double filter_coefficient_ = 0.005;
} ft_sensor_;
struct control {
struct frame {
std::string id_;
bool external_;
} frame_;
} control_;
struct fixed_world_frame {
struct frame {
std::string id_;
bool external_;
} frame_;
} fixed_world_frame_;
struct gravity_compensation {
struct frame {
std::string id_;
bool external_;
} frame_;
struct CoG {
std::vector<double> pos_ ;
double force_ = std::numeric_limits<double>::quiet_NaN();
} CoG_;
} gravity_compensation_;
struct admittance {
std::vector<bool> selected_axes_ ;
std::vector<double> mass_ ;
std::vector<double> damping_ratio_ ;
std::vector<double> stiffness_ ;
} admittance_;
bool enable_parameter_update_without_reactivation_ = true;
bool use_feedforward_commanded_input_ = true;
// for detecting if the parameter struct has been updated
rclcpp::Time __stamp;
};
class ParamListener{
public:
// throws rclcpp::exceptions::InvalidParameterValueException on initialization if invalid parameter are loaded
ParamListener(rclcpp::Node::SharedPtr node)
: ParamListener(node->get_node_parameters_interface()) {}
ParamListener(rclcpp_lifecycle::LifecycleNode::SharedPtr node)
: ParamListener(node->get_node_parameters_interface()) {}
ParamListener(const std::shared_ptr<rclcpp::node_interfaces::NodeParametersInterface>& parameters_interface){
declare_params(parameters_interface);
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{
return params_;
}The generated code doesn't need to be perfect like what clang-format would do with this but it should also be consistent in some way.
Metadata
Metadata
Assignees
Labels
No labels