velocity_smoother_nodelet.hpp
Go to the documentation of this file.
1 
9 /*****************************************************************************
10  ** Ifdefs
11  *****************************************************************************/
12 
13 #ifndef YUJIN_OCS_VELOCITY_SMOOTHER_HPP_
14 #define YUJIN_OCS_VELOCITY_SMOOTHER_HPP_
15 
16 /*****************************************************************************
17  ** Includes
18  *****************************************************************************/
19 
20 #include <ros/ros.h>
21 #include <nav_msgs/Odometry.h>
22 
23 /*****************************************************************************
24 ** Namespaces
25 *****************************************************************************/
26 
28 
29 /*****************************************************************************
30 ** VelocitySmoother
31 *****************************************************************************/
32 
34 {
35 public:
36  VelocitySmoother(const std::string &name);
37 
39  {
40  if (dynamic_reconfigure_server != NULL)
42  }
43 
44  bool init(ros::NodeHandle& nh);
45  void spin();
46  void shutdown() { shutdown_req = true; };
47 
48 private:
50  {
54  } robot_feedback;
56  std::string name;
57  bool quiet;
60  double decel_factor;
61 
62  double frequency;
63 
64  geometry_msgs::Twist last_cmd_vel;
65  geometry_msgs::Twist current_vel;
66  geometry_msgs::Twist target_vel;
67 
68  bool shutdown_req;
70  double cb_avg_time;
72  std::vector<double> period_record;
73  unsigned int pr_next;
80  void velocityCB(const geometry_msgs::Twist::ConstPtr& msg);
81  void robotVelCB(const geometry_msgs::Twist::ConstPtr& msg);
82  void odometryCB(const nav_msgs::Odometry::ConstPtr& msg);
83 
84  double sign(double x) { return x < 0.0 ? -1.0 : +1.0; };
85 
86  double median(std::vector<double> values) {
87  // Return the median element of an doubles vector
88  nth_element(values.begin(), values.begin() + values.size()/2, values.end());
89  return values[values.size()/2];
90  };
91 
92  /*********************
93  ** Dynamic Reconfigure
94  **********************/
95  dynamic_reconfigure::Server<yocs_velocity_smoother::paramsConfig> * dynamic_reconfigure_server;
96  dynamic_reconfigure::Server<yocs_velocity_smoother::paramsConfig>::CallbackType dynamic_reconfigure_callback;
97  void reconfigCB(yocs_velocity_smoother::paramsConfig &config, uint32_t unused_level);
98 };
99 
100 } // yocs_namespace velocity_smoother
101 
102 #endif /* YUJIN_OCS_VELOCITY_SMOOTHER_HPP_ */
void robotVelCB(const geometry_msgs::Twist::ConstPtr &msg)
void velocityCB(const geometry_msgs::Twist::ConstPtr &msg)
enum yocs_velocity_smoother::VelocitySmoother::RobotFeedbackType robot_feedback
void odometryCB(const nav_msgs::Odometry::ConstPtr &msg)
void reconfigCB(yocs_velocity_smoother::paramsConfig &config, uint32_t unused_level)
dynamic_reconfigure::Server< yocs_velocity_smoother::paramsConfig >::CallbackType dynamic_reconfigure_callback
dynamic_reconfigure::Server< yocs_velocity_smoother::paramsConfig > * dynamic_reconfigure_server
double median(std::vector< double > values)


yocs_velocity_smoother
Author(s): Jorge Santos Simon
autogenerated on Mon Jun 10 2019 15:54:03