dynamic_window.hpp
Go to the documentation of this file.
1 /*********************************************************************
2  * BSD 3-Clause License
3  *
4  * Copyright (c) 2020 Northwestern University
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * * Redistributions of source code must retain the above copyright notice, this
11  * list of conditions and the following disclaimer.
12  *
13  * * Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * * Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *********************************************************************/
38 #ifndef DYNAMIC_WINDOW_HPP
39 #define DYNAMIC_WINDOW_HPP
40 
41 #include <cmath>
42 
46 
47 namespace ergodic_exploration
48 {
49 using arma::mat;
50 
53 {
54 public:
75  DynamicWindow(const Collision& collision, double dt, double horizon, double acc_dt,
76  double acc_lim_x, double acc_lim_y, double acc_lim_th, double max_vel_x,
77  double min_vel_x, double max_vel_y, double min_vel_y, double max_rot_vel,
78  double min_rot_vel, unsigned int vx_samples, unsigned int vy_samples,
79  unsigned int vth_samples);
80 
90  tuple<bool, vec> control(const GridMap& grid, const vec& x0, const vec& vb,
91  const vec& vref) const;
92 
103  tuple<bool, vec> control(const GridMap& grid, const vec& x0, const vec& vb,
104  const mat& xt_ref, double dt_ref) const;
105 
107  double timeStep() const
108  {
109  return dt_;
110  }
111 
113  double horizon() const
114  {
115  return horizon_;
116  }
117 
119  unsigned int steps() const
120  {
121  return steps_;
122  }
123 
124 private:
130  tuple<vec, vec> window(const vec& vb) const;
131 
142  double objective(const GridMap& grid, const vec& x0, const vec& vref,
143  const vec& u) const;
144 
157  double objective(const GridMap& grid, const vec& x0, const vec& u, const mat& xt_ref,
158  double tf) const;
159 
160 private:
161  Collision collision_; // collision detection
162  double dt_; // time step in integration
163  double horizon_; // control horizon
164  double acc_dt_; // time acceleration limit is applied
165  double acc_lim_x_, acc_lim_y_, acc_lim_th_; // acceleration limits
166  double max_vel_x_, min_vel_x_; // velocity limits in x-direction
167  double max_vel_y_, min_vel_y_; // velocity limits in y-direction
168  double max_rot_vel_, min_rot_vel_; // rotational velocity limits
169  unsigned int vx_samples_; // number of velocity samples in x-direction
170  unsigned int vy_samples_; // number of velocity samples in y-direction
171  unsigned int vth_samples_; // number of angular velocity samples
172  unsigned int steps_; // number of steps in each rollout
173 };
174 } // namespace ergodic_exploration
175 #endif
ergodic_exploration::DynamicWindow::acc_lim_th_
double acc_lim_th_
Definition: dynamic_window.hpp:165
ergodic_exploration::DynamicWindow::vy_samples_
unsigned int vy_samples_
Definition: dynamic_window.hpp:170
collision.hpp
Collision checking in 2D.
ergodic_exploration::DynamicWindow::steps_
unsigned int steps_
Definition: dynamic_window.hpp:172
ergodic_exploration::DynamicWindow::acc_lim_y_
double acc_lim_y_
Definition: dynamic_window.hpp:165
ergodic_exploration::DynamicWindow::horizon_
double horizon_
Definition: dynamic_window.hpp:163
ergodic_exploration::DynamicWindow::min_rot_vel_
double min_rot_vel_
Definition: dynamic_window.hpp:168
ergodic_exploration::DynamicWindow
Dynamic window approach.
Definition: dynamic_window.hpp:52
ergodic_exploration::DynamicWindow::max_vel_x_
double max_vel_x_
Definition: dynamic_window.hpp:166
ergodic_exploration::DynamicWindow::acc_dt_
double acc_dt_
Definition: dynamic_window.hpp:164
ergodic_exploration::DynamicWindow::vth_samples_
unsigned int vth_samples_
Definition: dynamic_window.hpp:171
ergodic_exploration::DynamicWindow::steps
unsigned int steps() const
return number of steps in horizon
Definition: dynamic_window.hpp:119
ergodic_exploration
Definition: basis.hpp:43
ergodic_exploration::DynamicWindow::dt_
double dt_
Definition: dynamic_window.hpp:162
ergodic_exploration::GridMap
Constructs an 2D grid.
Definition: grid.hpp:79
ergodic_exploration::DynamicWindow::max_rot_vel_
double max_rot_vel_
Definition: dynamic_window.hpp:168
ergodic_exploration::DynamicWindow::window
tuple< vec, vec > window(const vec &vb) const
Compose window size and discretization.
Definition: dynamic_window.cpp:193
ergodic_exploration::DynamicWindow::control
tuple< bool, vec > control(const GridMap &grid, const vec &x0, const vec &vb, const vec &vref) const
Compose best control.
Definition: dynamic_window.cpp:92
numerics.hpp
Useful numerical utilities.
ergodic_exploration::DynamicWindow::timeStep
double timeStep() const
return time step
Definition: dynamic_window.hpp:107
ergodic_exploration::DynamicWindow::acc_lim_x_
double acc_lim_x_
Definition: dynamic_window.hpp:165
grid.hpp
2D grid represented in row major order
ergodic_exploration::DynamicWindow::max_vel_y_
double max_vel_y_
Definition: dynamic_window.hpp:167
ergodic_exploration::DynamicWindow::vx_samples_
unsigned int vx_samples_
Definition: dynamic_window.hpp:169
ergodic_exploration::DynamicWindow::objective
double objective(const GridMap &grid, const vec &x0, const vec &vref, const vec &u) const
Objective function for reference twist.
Definition: dynamic_window.cpp:237
ergodic_exploration::DynamicWindow::min_vel_x_
double min_vel_x_
Definition: dynamic_window.hpp:166
ergodic_exploration::DynamicWindow::min_vel_y_
double min_vel_y_
Definition: dynamic_window.hpp:167
tf
ergodic_exploration::DynamicWindow::collision_
Collision collision_
Definition: dynamic_window.hpp:161
ergodic_exploration::DynamicWindow::horizon
double horizon() const
return control horizon
Definition: dynamic_window.hpp:113
ergodic_exploration::DynamicWindow::DynamicWindow
DynamicWindow(const Collision &collision, double dt, double horizon, double acc_dt, double acc_lim_x, double acc_lim_y, double acc_lim_th, double max_vel_x, double min_vel_x, double max_vel_y, double min_vel_y, double max_rot_vel, double min_rot_vel, unsigned int vx_samples, unsigned int vy_samples, unsigned int vth_samples)
Constructor.
Definition: dynamic_window.cpp:46
ergodic_exploration::Collision
2D collision detection
Definition: collision.hpp:85


ergodic_exploration
Author(s): bostoncleek
autogenerated on Wed Mar 2 2022 00:17:13