8 ROS_FATAL_STREAM(
"RosReflexxesPositionInterface: Unable to initialize Reflexxes as no parameters could " 9 "be read. Please verify that all parameters exist on the given namespace '" 16 for (
int i=0; i<
n_dim_; i++) {
31 std::string param_name = ns +
"/dimensions";
33 ROS_ERROR_STREAM(
"Failed to getParam '" << param_name <<
"' (namespace: " << ns <<
").");
36 param_name = ns +
"/period";
38 ROS_ERROR_STREAM(
"Failed to getParam '" << param_name <<
"' (namespace: " << ns <<
").");
41 param_name = ns +
"/max_velocities";
43 ROS_ERROR_STREAM(
"Failed to getParam '" << param_name <<
"' (namespace: " << ns <<
").");
46 param_name = ns +
"/max_acceleration";
48 ROS_ERROR_STREAM(
"Failed to getParam '" << param_name <<
"' (namespace: " << ns <<
").");
51 param_name = ns +
"/max_jerk";
53 ROS_ERROR_STREAM(
"Failed to getParam '" << param_name <<
"' (namespace: " << ns <<
").");
56 param_name = ns +
"/sync_behavior";
59 ROS_ERROR_STREAM(
"Failed to getParam '" << param_name <<
"' (namespace: " << ns <<
").");
62 if (sync_behavior_ == 0) {
64 }
else if (sync_behavior_ == 1) {
66 }
else if (sync_behavior_ == 2) {
71 param_name = ns +
"/final_behavior";
74 ROS_ERROR_STREAM(
"Failed to getParam '" << param_name <<
"' (namespace: " << ns <<
").");
77 if (final_behavior_ == 0) {
82 ROS_DEBUG(
"RosReflexxesPositionInterface::load_params:\nPeriod:%f\nMaxVel:[%.2f, %.2f, %.2f, %.2f, %.2f, %.2f]\nMaxAcc:[%.2f, %.2f, %.2f, %.2f, %.2f, %.2f]\nMaxJerk:[%.2f, %.2f, %.2f, %.2f, %.2f, %.2f]\nSyncBehavior: %d\nFinalBehavior: %d",
93 if (c_pos.size() ==
n_dim_) {
94 for (
int i=0; i<
n_dim_; i++) {
99 ROS_WARN(
"RosReflexxesPositionInterface::starting is unable to execute the input because input dimensions (%d) don't match the reflexxes dimension (%d)", (
int) c_pos.size(),
n_dim_ );
109 ROS_DEBUG(
"Reflexxes::advance NEW CurrentPos:[%.2f, %.2f, %.2f, %.2f, %.2f, %.2f] \n",
input_params_->CurrentPositionVector->VecData[0],
input_params_->CurrentPositionVector->VecData[1],
input_params_->CurrentPositionVector->VecData[2],
input_params_->CurrentPositionVector->VecData[3],
input_params_->CurrentPositionVector->VecData[4],
input_params_->CurrentPositionVector->VecData[5] );
111 ROS_WARN(
"RosReflexxesPositionInterface::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!");
127 std::vector<double> c_acc(
n_dim_);
128 for (
int i=0; i<
n_dim_; i++) {
129 c_acc[i] =
input_params_->CurrentAccelerationVector->VecData[i];
137 std::vector<double> c_vel(
n_dim_);
138 for (
int i=0; i<
n_dim_; i++) {
146 std::vector<double> c_pos(
n_dim_);
147 for (
int i=0; i<
n_dim_; i++) {
155 std::vector<double> t_pos(
n_dim_);
156 for (
int i=0; i<
n_dim_; i++) {
174 if (
output_params_->WasACompleteComputationPerformedDuringTheLastCycle() ) {
184 if (t_pos.size() ==
n_dim_) {
185 for (
int i=0; i<
n_dim_; i++) {
189 ROS_WARN(
"RosReflexxesPositionInterface::set_target_position is unable to execute the input because input dimensions (%d) don't match the reflexxes dimension (%d)", (
int) t_pos.size(),
n_dim_ );
195 if (t_vel.size() ==
n_dim_) {
196 for (
int i=0; i<
n_dim_; i++) {
200 ROS_WARN(
"RosReflexxesPositionInterface::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_ );
std::vector< double > max_velocities_
std::vector< double > get_current_acceleration() override
boost::shared_ptr< RMLPositionInputParameters > input_params_
bool position_initialized_
std::vector< double > update() override
ros::Duration get_time_to_target_completedness()
void reset_to_previous_state(RMLPositionInputParameters previous_state)
std::vector< double > get_current_position() override
std::vector< double > max_jerk_
boost::shared_ptr< RMLPositionOutputParameters > output_params_
unsigned char SynchronizationBehavior
ONLY_TIME_SYNCHRONIZATION
int BehaviorAfterFinalStateOfMotionIsReached
#define ROS_FATAL_STREAM(args)
const std::string & getNamespace() const
ONLY_PHASE_SYNCHRONIZATION
std::vector< double > max_acceleration_
PHASE_SYNCHRONIZATION_IF_POSSIBLE
std::vector< double > get_current_velocity() override
bool getParam(const std::string &key, std::string &s) const
bool init(ros::NodeHandle nh) override
RMLPositionInputParameters get_current_state()
PLUGINLIB_EXPORT_CLASS(RosReflexxesPositionInterface, RosReflexxesInterface)
boost::shared_ptr< ReflexxesAPI > rml_
void starting(const std::vector< double > &c_pos) override
#define ROS_ERROR_STREAM(args)
std::vector< double > get_target_position()
void set_target_velocity(const std::vector< double > &t_vel) override
void set_target_position(const std::vector< double > &t_pos) override
bool load_parameters(std::string ns)