XBotInterface  2.4.1
XBotInterface provides a generic API to model and control a robot.
Utils.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 IIT-ADVR
3  * Author: Arturo Laurenzi, Luca Muratore
4  * email: arturo.laurenzi@iit.it, luca.muratore@iit.it
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>
18 */
19 
20 
21 #ifndef __XBOTINTERFACE_UTILS_H__
22 #define __XBOTINTERFACE_UTILS_H__
23 
24 #include <XBotInterface/RtLog.hpp>
26 #include <boost/filesystem.hpp>
27 #include <boost/algorithm/string.hpp>
28 #include <cstdlib>
29 #include <iostream>
30 #include <iomanip>
31 #include <string>
32 #include <fstream>
33 #include <streambuf>
34 #include <yaml-cpp/yaml.h>
35 #include <stdexcept>
36 #include <stdio.h>
37 
38 namespace XBot {
39 namespace Utils {
40 
47 inline Eigen::Matrix3d skewSymmetricMatrix(const Eigen::Vector3d& v){
48 
49  Eigen::Matrix3d S;
50 
51  S << 0, -v.z(), v.y(),
52  v.z(), 0, -v.x(),
53  -v.y(), v.x(), 0;
54 
55  return S;
56 }
57 
58 
68 inline void computeOrientationError(const Eigen::Matrix3d& ref,
69  const Eigen::Matrix3d& actual,
70  Eigen::Vector3d& error)
71 {
72 
73  Eigen::Quaterniond q(actual), q_d(ref);
74 
75  if(q.dot(q_d) < 0){
76  q.x() *= -1;
77  q.y() *= -1;
78  q.z() *= -1;
79  q.w() *= -1;
80  }
81 
82  error = q.w()*q_d.vec() - q_d.w()*q.vec() - q_d.vec().cross(q.vec());
83 
84 }
85 
86 
87 
88 
89 
90 inline void FifthOrderTrajectory(const double init_time,
91  const Eigen::VectorXd& _startPosture,
92  const Eigen::VectorXd& _targetPosture,
93  const double _max_vel,
94  const double traj_time,
95  Eigen::VectorXd& ref,
96  Eigen::VectorXd& ref_dot,
97  double& _duration_)
98 {
99  double _t1;
100  double duration_temp = 0.0;
101  int _vec_size = _startPosture.size();
102  // Find the trajectory duration
103  _duration_ = 0.0;
104  for (int i=0; i<_vec_size; i++)
105  {
106  _t1 = _targetPosture(i) - _startPosture(i);
107  duration_temp = 1.8750 * std::abs(_t1) / _max_vel;
108  if (duration_temp > _duration_)
109  _duration_ = duration_temp;
110  }
111  // Generate the trajectory
112  double _time_ = traj_time - init_time;
113  if (_time_>= 0 && _time_<= _duration_)
114  {
115  double tr = (_time_/_duration_);
116  double tr2 = tr * tr;
117  double tr3 = tr2 * tr;
118  double s = (6.0 * tr3 * tr2 - 15.0 * tr3 * tr + 10.0 * tr3);
119  double sd = (30.0 * tr3 * tr/_duration_ - 60.0 * tr3/_duration_ + 30.0 * tr2/_duration_);
120  //
121  ref = _startPosture + (_targetPosture - _startPosture) * s;
122  ref_dot = (_targetPosture - _startPosture) * sd;
123  }
124  else if (_time_<0) {
125  ref = _startPosture;
126  ref_dot = 0.0 * _startPosture;
127  }
128  else {
129  ref = _targetPosture;
130  ref_dot = 0.0 * _targetPosture;
131  }
132 }
133 
134 
135 
136 
137 
138 inline void ThirdOrderTrajectory(const double init_time,
139  const double init_pos,
140  const double final_pos,
141  const double max_vel,
142  const double traj_time,
143  double& ref,
144  double& ref_dot,
145  double& duration)
146 {
147  double time_t;
148  double length;
149  length = final_pos - init_pos;
150  time_t = traj_time - init_time;
151  duration = 1.5 * length / max_vel;
152  if (time_t>= 0 && time_t<= duration) {
153  ref = -2.0 * length * std::pow(time_t/duration,3) + 3.0 * length * std::pow(time_t/duration,2) + init_pos;
154  ref_dot = -6.0 * length * std::pow(time_t,2)/std::pow(duration,3) + 6.0 * length * time_t/std::pow(duration,2);
155  }
156  else if (time_t<0) {
157  ref = init_pos;
158  ref_dot = 0;
159  }
160  else {
161  ref = final_pos;
162  ref_dot = 0;
163  }
164 }
165 
166 
167 template <typename SignalType>
183 
184 public:
185 
186  typedef std::shared_ptr<SecondOrderFilter<SignalType>> Ptr;
187 
189  _omega(1.0),
190  _eps(0.8),
191  _ts(0.01),
192  _reset_has_been_called(false)
193  {
194  computeCoeff();
195  }
196 
197  SecondOrderFilter(double omega, double eps, double ts, const SignalType& initial_state):
198  _omega(omega),
199  _eps(eps),
200  _ts(ts),
201  _reset_has_been_called(false)
202  {
203  computeCoeff();
204  reset(initial_state);
205  }
206 
207  void reset(const SignalType& initial_state){
208  _reset_has_been_called = true;
209  _u = initial_state;
210  _y = initial_state;
211  _yd = initial_state;
212  _ydd = initial_state;
213  _udd = initial_state;
214  _ud = initial_state;
215  }
216 
217  const SignalType& process(const SignalType& input){
218 
219  if(!_reset_has_been_called) reset(input*0);
220 
221 
222  _ydd = _yd;
223  _yd = _y;
224  _udd = _ud;
225  _ud = _u;
226 
227 
228  _u = input;
229  _y = 1.0/_a0 * ( _u + _b1*_ud + _b2*_udd - _a1*_yd - _a2*_ydd );
230 
231  return _y;
232  }
233 
234  const SignalType& getOutput() const {
235  return _y;
236  }
237 
238  void setOmega(double omega){
239  _omega = omega;
240  computeCoeff();
241  }
242 
243  double getOmega()
244  {
245  return _omega;
246  }
247 
248  void setDamping(double eps){
249  _eps = eps;
250  computeCoeff();
251  }
252 
253  double getDamping()
254  {
255  return _eps;
256  }
257 
258  void setTimeStep(double ts){
259  _ts = ts;
260  computeCoeff();
261  }
262 
263  double getTimeStep()
264  {
265  return _ts;
266  }
267 
268 private:
269 
270  void computeCoeff()
271  {
272  _b1 = 2.0;
273  _b2 = 1.0;
274 
275  _a0 = 1.0 + 4.0*_eps/(_omega*_ts) + 4.0/std::pow(_omega*_ts, 2.0);
276  _a1 = 2 - 8.0/std::pow(_omega*_ts, 2.0);
277  _a2 = 1.0 + 4.0/std::pow(_omega*_ts, 2.0) - 4.0*_eps/(_omega*_ts);
278 
279  }
280 
281  double _omega;
282  double _eps;
283  double _ts;
284 
285  double _b1, _b2;
286  double _a0, _a1, _a2;
287 
288  bool _reset_has_been_called;
289 
290  SignalType _y, _yd, _ydd, _u, _ud, _udd;
291 
292 };
293 
294 template<class SignalType>
296 {
297 public:
298  SecondOrderFilterArray(const int channels):
299  _channels(channels)
300  {
302  SignalType tmp;
303  for(unsigned int i = 0; i < _channels; ++i){
304  _filters.push_back(filter);
305  _output.push_back(tmp);
306  }
307  }
308 
309  const std::vector<SignalType>& process(const std::vector<SignalType>& input)
310  {
311  if(input.size() != _channels)
312  throw std::runtime_error("input size != filters size");
313 
314  for(unsigned int i = 0; i < _channels; ++i){
315  _filters[i].process(input[i]);
316  _output[i] = _filters[i].getOutput();
317  }
318  return _output;
319  }
320 
321  const std::vector<SignalType>& getOutput() const {
322  return _output;
323  }
324 
325  void reset(const SignalType& init)
326  {
327  for(unsigned int i = 0; i < _channels; ++i){
328  _filters[i].reset(init);
329  _output[i] = init;
330  }
331  }
332 
333  bool setTimeStep(const double time_step, const int channel)
334  {
335  if(channel >= _channels)
336  return false;
337  else
338  _filters[channel].setTimeStep(time_step);
339  return true;
340  }
341 
342  double getTimeStep(const int channel)
343  {
344  if(channel >= _channels)
345  throw std::runtime_error("channel out of channels range!");
346  else
347  return _filters[channel].getTimeStep();
348  }
349 
350  bool setDamping(const double damping, const int channel)
351  {
352  if(channel >= _channels)
353  return false;
354  else
355  _filters[channel].setDamping(damping);
356  return true;
357  }
358 
359  double getDamping(const int channel)
360  {
361  if(channel >= _channels)
362  throw std::runtime_error("channel out of channels range!");
363  else
364  return _filters[channel].getDamping();
365  }
366 
367  bool setOmega(const double omega, const int channel)
368  {
369  if(channel >= _channels)
370  return false;
371  else
372  _filters[channel].setOmega(omega);
373  return true;
374  }
375 
376  double getOmega(const int channel)
377  {
378  if(channel >= _channels)
379  throw std::runtime_error("channel out of channels range!");
380  else
381  return _filters[channel].getOmega();
382  }
383 
385  {
386  return _channels;
387  }
388 
389 private:
390  std::vector<SecondOrderFilter<SignalType>> _filters;
391  std::vector<SignalType> _output;
392  int _channels;
393 
394 };
395 
399 inline std::string exec(const char* cmd)
400 {
401  FILE* pipe = popen(cmd, "r");
402 
403  if (!pipe)
404  {
405  throw std::runtime_error("popen() failed");
406  }
407 
408  std::string result;
409 
410  try
411  {
412  char buffer[128];
413 
414  while(fgets(buffer, sizeof buffer, pipe) != NULL)
415  {
416  result += buffer;
417  }
418  }
419  catch(...)
420  {
421  pclose(pipe);
422  throw;
423  }
424 
425  int retcode = pclose(pipe);
426 
427  if(retcode != 0)
428  {
429  throw std::runtime_error("child process '" + std::string(cmd) + "' exited with code " + std::to_string(retcode));
430  }
431 
432  return result;
433 }
434 
439 inline std::string computeAbsolutePath(const std::string& input_path)
440 {
441  // if not an absolute path
442  if(input_path == "" || !(input_path.at(0) == '/'))
443  {
444  // if you are working with the Robotology Superbuild
445  const char* env_p = std::getenv("XBOT_ROOT");
446 
447  // check the env, otherwise error
448  if(env_p)
449  {
450  std::string current_path(env_p);
451  // default relative path when working with the superbuild
452  current_path += "/";
453  current_path += input_path;
454  return current_path;
455  }
456  else
457  {
458  std::cerr << "ERROR in " << __func__ << " : the input path " << input_path << " is neither an absolute path nor related with the robotology superbuild. Download it!" << std::endl;
459  return "";
460  }
461  }
462 
463  // already an absolute path
464  return input_path;
465 }
466 
471 inline std::string computeAbsolutePathShell(std::string input_path, std::string wd = ".")
472 {
473  // define shell command
474  std::string cmd = "set -eu; cd " + wd + "; /bin/echo " + input_path;
475 
476  std::string cmd_output;
477 
478  try
479  {
480  cmd_output = XBot::Utils::exec(cmd.c_str());
481  }
482  catch(std::exception& e)
483  {
484  Logger::error("command '%s' failed: %s \n",
485  cmd.c_str(), e.what());
486  return "";
487  }
488 
489  // check for error from echo
490  if(cmd_output.empty())
491  {
492  return cmd_output;
493  }
494 
495  // strip trailing \n
496  cmd_output = cmd_output.substr(0, cmd_output.size() - 1);
497 
498  // further process via computeAbsolutePath()
499  return computeAbsolutePath(cmd_output);
500 }
501 
505 inline std::string getXBotConfig()
506 {
507  const char* env_p = std::getenv("XBOT_CONFIG");
508  // check the env, otherwise error
509  if(env_p) {
510  std::string xbot_config(env_p);
511  Logger::info(Logger::Severity::DEBUG) << "$XBOT_CONFIG" << " -> " << xbot_config << Logger::endl();
512  std::ifstream fcp(xbot_config, std::ifstream::in);
513  char xbot_config_path[300];
514  fcp.getline (xbot_config_path, 300);
515 
516  Logger::info(Logger::Severity::DEBUG) << __func__ << " -> " << std::string(xbot_config_path) << Logger::endl();
517  return std::string(xbot_config_path);
518  }
519  else {
520  Logger::warning() << "WARNING in " << __func__ << " : XBOT_CONFIG env variable not set." << Logger::endl();
521  return "";
522  }
523 }
524 
525 inline Eigen::Matrix6d GetAdjointFromRotation(const Eigen::Matrix3d& R){
526 
527  Eigen::Matrix6d I;
528  I.setZero();
529 
530  I.block<3,3>(0,0) = R;
531  I.block<3,3>(3,3) = R;
532 
533  return I;
534 
535 }
536 
537 
538 template <typename T>
540 
541 public:
542 
543  LimitedDeque(int N = 0);
544 
545  void push_back(const T& elem);
546  void push_back();
547  bool pop_back();
548 
549  T& back();
550  const T& back() const;
551 
552  int size() const;
553  int capacity() const { return N; }
554 
555  bool is_full() const;
556  bool is_empty() const;
557 
558  void reset();
559 
560 private:
561 
562  const int N;
563 
564  int decrement_mod(int idx);
565 
566  int _oldest;
567  int _newest;
568 
569  std::vector<T> _buffer;
570 
571 };
572 
573 template <typename T>
575  N(_N)
576 {
577  reset();
578 
579  _buffer.resize(N);
580 }
581 
582 template <typename T>
583 inline const T& LimitedDeque<T>::back() const
584 {
585  if(is_empty()){
586  throw std::out_of_range("back() called on a empty deque");
587  }
588  else{
589  int back_idx = decrement_mod(_newest);
590  return _buffer.at(back_idx);
591  }
592 
593 }
594 
595 template <typename T>
597 {
598  if(is_empty()){
599  throw std::out_of_range("back() called on a empty deque");
600  }
601  else{
602  int back_idx = decrement_mod(_newest);
603  return _buffer.at(back_idx);
604  }
605 }
606 
607 
608 template <typename T>
610 {
611  if(is_empty()){
612  return false;
613  }
614  else{
615  _newest = decrement_mod(_newest);
616  if( _newest == _oldest )
617  {
618  reset();
619  }
620 
621  return true;
622  }
623 }
624 
625 template <typename T>
626 inline void LimitedDeque<T>::push_back(const T& elem)
627 {
628  push_back();
629  back() = elem;
630 }
631 
632 template <typename T>
634 {
635  if(is_full()){
636 
637 
638  _oldest = ( _oldest + 1 ) % N;
639  _newest = _oldest;
640 
641  }
642  else{
643 
644  if(is_empty()){
645  _oldest = 0;
646  }
647 
648  _newest = ( _newest + 1 ) % N;
649 
650  }
651 }
652 
653 
654 template <typename T>
655 inline int LimitedDeque<T>::size() const
656 {
657  if ( is_full() ) {
658  return N;
659  }
660  else if ( is_empty() ) {
661  return 0;
662  }
663  else if ( _newest > _oldest ) {
664  return _newest - _oldest;
665  }
666  else {
667  return ( N - _oldest + _newest );
668  }
669 }
670 
671 template <typename T>
672 inline bool LimitedDeque<T>::is_full() const
673 {
674  return _oldest == _newest;
675 }
676 
677 template <typename T>
678 inline bool LimitedDeque<T>::is_empty() const
679 {
680  return !is_full() && _newest == 0 && _oldest == -1;
681 }
682 
683 template <typename T>
684 inline int LimitedDeque<T>::decrement_mod(int idx)
685 {
686  idx--;
687  return idx >= 0 ? idx : (idx + N);
688 }
689 
690 template <typename T>
692 {
693  _oldest = -1;
694  _newest = 0;
695 }
696 
697 
698 inline void FifthOrderPlanning(double x0, double dx0, double ddx0,
699  double goal, double start_time, double end_time,
700  double time, double& x, double& dx, double& ddx
701  )
702 {
703  Eigen::Matrix6d A;
704  A << 1.0000, 0, 0, 0, 0, 0,
705  0, 1.0000, 0, 0, 0, 0,
706  0, 0, 0.5000, 0, 0, 0,
707  -10.0000, -6.0000, -1.5000, 10.0000, -4.0000, 0.5000,
708  15.0000, 8.0000, 1.5000, -15.0000, 7.0000, -1.0000,
709  -6.0000, -3.0000, -0.5000, 6.0000, -3.0000, 0.5000;
710 
711  double alpha = (end_time-start_time);
712  alpha = std::max(1e-6, alpha);
713  double tau = (time - start_time)/alpha; // d/dt = d/d(alpha*tau)
714  tau = std::max(0.0, tau);
715  tau = std::min(tau, 1.0);
716 
717  Eigen::Vector6d b;
718  b << x0, dx0*alpha, ddx0*std::pow(alpha,2.0), goal, 0.0, 0.0;
719 
720  Eigen::Vector6d coeffs = A*b;
721 
722  Eigen::Vector6d t_v, dt_v, ddt_v;
723  for(int i = 0; i < 6; i++)
724  {
725  t_v(i) = std::pow(tau, i);
726  dt_v(i) = i > 0 ? std::pow(tau, i-1)*i : 0;
727  ddt_v(i) = i > 1 ? std::pow(tau, i-2)*i*(i-1) : 0;
728 
729  }
730 
731  x = coeffs.dot(t_v);
732  dx = coeffs.dot(dt_v)/alpha;
733  ddx = coeffs.dot(ddt_v)/(alpha*alpha);
734 }
735 
736 
737 inline bool ReadFile(std::string path_to_file, std::string& file)
738 {
739  std::ifstream t(path_to_file);
740 
741  if(t.fail())
742  {
743  return false;
744  }
745 
746  file = std::string((std::istreambuf_iterator<char>(t)),
747  std::istreambuf_iterator<char>());
748 
749  return true;
750 
751 }
752 
753 inline std::string GetTimeAsString()
754 {
755  time_t rawtime;
756  struct tm * timeinfo;
757  char buffer [80];
758  memset(buffer, 0, 80*sizeof(buffer[0]));
759 
760  std::time(&rawtime);
761  timeinfo = localtime(&rawtime);
762 
763  strftime(buffer, 80, "%Y_%m_%d__%H_%M_%S", timeinfo);
764 
765  return std::string(buffer);
766 }
767 
768 }
769 
770 }
771 
772 #endif
XBot::Utils::computeOrientationError
void computeOrientationError(const Eigen::Matrix3d &ref, const Eigen::Matrix3d &actual, Eigen::Vector3d &error)
Computes an orientation error between two frames such that an angular velocity K*e (K > 0) brings "ac...
Definition: Utils.h:68
XBot::Utils::SecondOrderFilterArray::reset
void reset(const SignalType &init)
Definition: Utils.h:325
XBot::Utils::SecondOrderFilter::getOutput
const SignalType & getOutput() const
Definition: Utils.h:234
XBot::Utils::SecondOrderFilter::getTimeStep
double getTimeStep()
Definition: Utils.h:263
XBot::Utils::skewSymmetricMatrix
Eigen::Matrix3d skewSymmetricMatrix(const Eigen::Vector3d &v)
Computes a matrix S such that S(a)b = a x b.
Definition: Utils.h:47
XBot::Utils::LimitedDeque::pop_back
bool pop_back()
Definition: Utils.h:609
XBot::Utils::SecondOrderFilter
SecondOrderFilter implements a canonical continuous-time second order filter with transfer function 1...
Definition: Utils.h:182
XBot::Logger::endl
static Endl & endl()
Closes the message and prints to screen.
Definition: RtLog.cpp:107
XBot::Logger::info
static std::ostream & info(Logger::Severity s=Logger::Severity::LOW)
Logs an information message (with bold [INFO] header).
Definition: RtLog.cpp:112
XBot::Utils::SecondOrderFilter::reset
void reset(const SignalType &initial_state)
Definition: Utils.h:207
XBot::Utils::LimitedDeque::capacity
int capacity() const
Definition: Utils.h:553
XBot::Utils::GetTimeAsString
std::string GetTimeAsString()
Definition: Utils.h:753
XBot::Logger::error
static std::ostream & error(Logger::Severity s=Logger::Severity::HIGH)
Logs an error message (in red, with bold [ERROR] header).
Definition: RtLog.cpp:41
Eigen::Matrix6d
Eigen::Matrix< double, 6, 6 > Matrix6d
Typedef for a 6-by-6 matrix of double.
Definition: TypedefAndEnums.h:138
XBot::Utils::FifthOrderPlanning
void FifthOrderPlanning(double x0, double dx0, double ddx0, double goal, double start_time, double end_time, double time, double &x, double &dx, double &ddx)
Definition: Utils.h:698
XBot::Utils::SecondOrderFilter::SecondOrderFilter
SecondOrderFilter(double omega, double eps, double ts, const SignalType &initial_state)
Definition: Utils.h:197
XBot::Logger::warning
static std::ostream & warning(Logger::Severity s=Logger::Severity::MID)
Logs a warning message (in yellow, with bold [warning] header).
Definition: RtLog.cpp:156
XBot::Utils::SecondOrderFilterArray::setTimeStep
bool setTimeStep(const double time_step, const int channel)
Definition: Utils.h:333
TypedefAndEnums.h
XBot::Utils::SecondOrderFilterArray::getOutput
const std::vector< SignalType > & getOutput() const
Definition: Utils.h:321
Eigen::Vector6d
Eigen::Matrix< double, 6, 1 > Vector6d
Typedef for a 6 element column vector of double.
Definition: TypedefAndEnums.h:132
XBot::Utils::SecondOrderFilter::SecondOrderFilter
SecondOrderFilter()
Definition: Utils.h:188
XBot::Utils::SecondOrderFilterArray::getTimeStep
double getTimeStep(const int channel)
Definition: Utils.h:342
XBot::Utils::SecondOrderFilter::setOmega
void setOmega(double omega)
Definition: Utils.h:238
XBot::Utils::SecondOrderFilterArray::getDamping
double getDamping(const int channel)
Definition: Utils.h:359
XBot::Utils::GetAdjointFromRotation
Eigen::Matrix6d GetAdjointFromRotation(const Eigen::Matrix3d &R)
Definition: Utils.h:525
XBot::Utils::ReadFile
bool ReadFile(std::string path_to_file, std::string &file)
Definition: Utils.h:737
XBot::Utils::ThirdOrderTrajectory
void ThirdOrderTrajectory(const double init_time, const double init_pos, const double final_pos, const double max_vel, const double traj_time, double &ref, double &ref_dot, double &duration)
Definition: Utils.h:138
XBot::Utils::SecondOrderFilterArray::SecondOrderFilterArray
SecondOrderFilterArray(const int channels)
Definition: Utils.h:298
XBot::Utils::LimitedDeque::reset
void reset()
Definition: Utils.h:691
XBot::Utils::getXBotConfig
std::string getXBotConfig()
getter for the default XBot config file set by the env variable $XBOT_CONFIG
Definition: Utils.h:505
XBot::Utils::computeAbsolutePath
std::string computeAbsolutePath(const std::string &input_path)
Computes the absolute path corresponging to a given path relative to the $XBOT_ROOT environment varia...
Definition: Utils.h:439
RtLog.hpp
XBot::Utils::SecondOrderFilter::getOmega
double getOmega()
Definition: Utils.h:243
XBot::Utils::SecondOrderFilterArray::getNumberOfChannels
int getNumberOfChannels()
Definition: Utils.h:384
XBot::Utils::SecondOrderFilter::setDamping
void setDamping(double eps)
Definition: Utils.h:248
XBot::Utils::SecondOrderFilterArray::process
const std::vector< SignalType > & process(const std::vector< SignalType > &input)
Definition: Utils.h:309
XBot::Utils::exec
std::string exec(const char *cmd)
exec runs a command inside the shell, and returns the output
Definition: Utils.h:399
XBot::Utils::SecondOrderFilter::process
const SignalType & process(const SignalType &input)
Definition: Utils.h:217
XBot::Utils::LimitedDeque::size
int size() const
Definition: Utils.h:655
XBot::Utils::LimitedDeque::back
T & back()
Definition: Utils.h:583
XBot::Utils::SecondOrderFilter::getDamping
double getDamping()
Definition: Utils.h:253
XBot::Utils::LimitedDeque::push_back
void push_back()
Definition: Utils.h:633
XBot::Utils::SecondOrderFilterArray
Definition: Utils.h:295
XBot::Utils::FifthOrderTrajectory
void FifthOrderTrajectory(const double init_time, const Eigen::VectorXd &_startPosture, const Eigen::VectorXd &_targetPosture, const double _max_vel, const double traj_time, Eigen::VectorXd &ref, Eigen::VectorXd &ref_dot, double &_duration_)
Definition: Utils.h:90
XBot::Utils::LimitedDeque::is_empty
bool is_empty() const
Definition: Utils.h:678
XBot::Utils::SecondOrderFilter::setTimeStep
void setTimeStep(double ts)
Definition: Utils.h:258
XBot::Utils::SecondOrderFilterArray::getOmega
double getOmega(const int channel)
Definition: Utils.h:376
XBot::Utils::computeAbsolutePathShell
std::string computeAbsolutePathShell(std::string input_path, std::string wd=".")
computeAbsolutePathShell expands the provided path by using the system shell before pre-pending the X...
Definition: Utils.h:471
XBot::Utils::SecondOrderFilterArray::setDamping
bool setDamping(const double damping, const int channel)
Definition: Utils.h:350
XBot::Utils::SecondOrderFilterArray::setOmega
bool setOmega(const double omega, const int channel)
Definition: Utils.h:367
XBot::Utils::LimitedDeque
Definition: Utils.h:539
XBot::Utils::LimitedDeque::is_full
bool is_full() const
Definition: Utils.h:672
XBot
Definition: IXBotModel.h:20
XBot::Utils::SecondOrderFilter::Ptr
std::shared_ptr< SecondOrderFilter< SignalType > > Ptr
Definition: Utils.h:186
XBot::Utils::LimitedDeque::LimitedDeque
LimitedDeque(int N=0)
Definition: Utils.h:574
XBot::Logger::Severity::DEBUG
@ DEBUG