6 ROS_FATAL_STREAM(
"Unable to initialize Reflexxes as no parameters could be read. Please verify that all " 7 "parameters exist on the given namespace '" <<
15 for (
int i=0; i<
n_dim_; i++) {
29 std::string param_name = ns +
"/dimensions";
31 ROS_ERROR_STREAM(
"Failed to getParam '" << param_name <<
"' (namespace: " << ns <<
").");
34 param_name = ns +
"/period";
36 ROS_ERROR_STREAM(
"Failed to getParam '" << param_name <<
"' (namespace: " << ns <<
").");
39 param_name = ns +
"/max_velocities";
41 ROS_ERROR_STREAM(
"Failed to getParam '" << param_name <<
"' (namespace: " << ns <<
").");
44 param_name = ns +
"/max_acceleration";
46 ROS_ERROR_STREAM(
"Failed to getParam '" << param_name <<
"' (namespace: " << ns <<
").");
49 param_name = ns +
"/max_jerk";
51 ROS_ERROR_STREAM(
"Failed to getParam '" << param_name <<
"' (namespace: " << ns <<
").");
54 param_name = ns +
"/sync_behavior";
57 ROS_ERROR_STREAM(
"Failed to getParam '" << param_name <<
"' (namespace: " << ns <<
").");
60 if (sync_behavior_ == 0) {
62 }
else if (sync_behavior_ == 1) {
64 }
else if (sync_behavior_ == 2) {
74 if (c_pos.size() ==
n_dim_) {
75 for (
int i=0; i<
n_dim_; i++) {
78 ROS_INFO(
"RosReflexxesVelocityInterface::starting successful");
81 ROS_WARN(
"RosReflexxesVelocityInterface::starting is unable to execute the input because input dimensions (%d) don't match the reflexxes dimension (%d)", (
int) c_pos.size(),
n_dim_ );
92 ROS_WARN(
"RosReflexxesVelocityInterface::update is unable to advance as the current position is not initialized yet. Please define the current position by using 'set_current_position' setter function first!");
109 std::vector<double> c_acc(
n_dim_);
110 for (
int i=0; i<
n_dim_; i++) {
111 c_acc[i] =
input_params_->CurrentAccelerationVector->VecData[i];
117 std::vector<double> c_vel(
n_dim_);
118 for (
int i=0; i<
n_dim_; i++) {
125 std::vector<double> c_pos(
n_dim_);
126 for (
int i=0; i<
n_dim_; i++) {
133 std::vector<double> t_vel(
n_dim_);
134 for (
int i=0; i<
n_dim_; i++) {
157 if (t_vel.size() ==
n_dim_) {
158 for (
int i=0; i<
n_dim_; i++) {
162 ROS_WARN(
"RosReflexxesVelocityInterface::set_target_velocity is unable to execute the input because input dimensions (%d) don't match the reflexxes dimension (%d)", (
int) t_vel.size(),
n_dim_ );
boost::shared_ptr< RMLVelocityOutputParameters > output_params_
bool load_parameters(std::string ns)
std::vector< double > max_acceleration_
std::vector< double > update() override
std::vector< double > get_current_acceleration() override
std::vector< double > get_current_position() override
void starting(const std::vector< double > &initial_command) override
void reset_to_previous_state(RMLVelocityInputParameters previous_state)
boost::shared_ptr< RMLVelocityInputParameters > input_params_
RMLVelocityInputParameters get_current_state()
std::vector< double > max_jerk_
unsigned char SynchronizationBehavior
ONLY_TIME_SYNCHRONIZATION
#define ROS_FATAL_STREAM(args)
void set_target_velocity(const std::vector< double > &t_vel) override
boost::shared_ptr< ReflexxesAPI > rml_
const std::string & getNamespace() const
ONLY_PHASE_SYNCHRONIZATION
PLUGINLIB_EXPORT_CLASS(RosReflexxesVelocityInterface, RosReflexxesInterface)
PHASE_SYNCHRONIZATION_IF_POSSIBLE
bool init(ros::NodeHandle nh) override
std::vector< double > get_current_velocity() override
bool getParam(const std::string &key, std::string &s) const
bool position_initialized_
#define ROS_ERROR_STREAM(args)
std::vector< double > max_velocities_
std::vector< double > get_target_velocity()