recovery_behaviors.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2016,
6  * TU Dortmund - Institute of Control Theory and Systems Engineering.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of the institute nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  * Author: Christoph Rösmann
37  *********************************************************************/
38 
39 #ifndef RECOVERY_BEHAVIORS_H__
40 #define RECOVERY_BEHAVIORS_H__
41 
42 
43 #include <boost/circular_buffer.hpp>
44 #include <geometry_msgs/Twist.h>
45 #include <ros/ros.h>
46 
47 namespace teb_local_planner
48 {
49 
50 
59 {
60 public:
61 
66 
71 
76  void setBufferLength(int length) {buffer_.set_capacity(length);}
77 
87  void update(const geometry_msgs::Twist& twist, double v_max, double v_backwards_max, double omega_max, double v_eps, double omega_eps);
88 
96  bool isOscillating() const;
97 
103  void clear();
104 
105 protected:
106 
109  {
110  double v = 0;
111  double omega = 0;
112  };
113 
122  bool detect(double v_eps, double omega_eps);
123 
124 private:
125 
126  boost::circular_buffer<VelMeasurement> buffer_;
127  bool oscillating_ = false;
128 
129 };
130 
131 
132 } // namespace teb_local_planner
133 
134 #endif /* RECOVERY_BEHAVIORS_H__ */
bool detect(double v_eps, double omega_eps)
Detect if the robot got stucked based on the current buffer content.
FailureDetector()
Default constructor.
void setBufferLength(int length)
Set buffer length (measurement history)
void update(const geometry_msgs::Twist &twist, double v_max, double v_backwards_max, double omega_max, double v_eps, double omega_eps)
Add a new twist measurement to the internal buffer and compute a new decision.
boost::circular_buffer< VelMeasurement > buffer_
Circular buffer to store the last measurements.
void clear()
Clear the current internal state.
bool oscillating_
Current state: true if robot is oscillating.
This class implements methods in order to detect if the robot got stucked or is oscillating.
bool isOscillating() const
Check if the robot got stucked.


teb_local_planner
Author(s): Christoph Rösmann
autogenerated on Wed Jun 3 2020 04:03:08