Drake
idm_planner_parameters.h
Go to the documentation of this file.
1 #pragma once
2 
3 // GENERATED FILE DO NOT EDIT
4 // See drake/tools/lcm_vector_gen.py.
5 
6 #include <cmath>
7 #include <stdexcept>
8 #include <string>
9 #include <vector>
10 
11 #include <Eigen/Core>
12 
15 
16 namespace drake {
17 namespace automotive {
18 
22  static const int kNumCoordinates = 9;
23 
24  // The index of each individual coordinate.
25  static const int kVRef = 0;
26  static const int kA = 1;
27  static const int kB = 2;
28  static const int kS0 = 3;
29  static const int kTimeHeadway = 4;
30  static const int kDelta = 5;
31  static const int kBloatDiameter = 6;
32  static const int kDistanceLowerLimit = 7;
33  static const int kScanAheadDistance = 8;
34 
39  static const std::vector<std::string>& GetCoordinateNames();
40 };
41 
43 template <typename T>
45  public:
48 
60  this->set_v_ref(10.0);
61  this->set_a(1.0);
62  this->set_b(3.0);
63  this->set_s_0(1.0);
64  this->set_time_headway(0.1);
65  this->set_delta(4.0);
66  this->set_bloat_diameter(4.5);
67  this->set_distance_lower_limit(1e-2);
68  this->set_scan_ahead_distance(100.0);
69  }
70 
71  IdmPlannerParameters<T>* DoClone() const override {
72  return new IdmPlannerParameters;
73  }
74 
76 
77  const T& v_ref() const { return this->GetAtIndex(K::kVRef); }
81  void set_v_ref(const T& v_ref) { this->SetAtIndex(K::kVRef, v_ref); }
85  const T& a() const { return this->GetAtIndex(K::kA); }
86  void set_a(const T& a) { this->SetAtIndex(K::kA, a); }
90  const T& b() const { return this->GetAtIndex(K::kB); }
91  void set_b(const T& b) { this->SetAtIndex(K::kB, b); }
95  const T& s_0() const { return this->GetAtIndex(K::kS0); }
96  void set_s_0(const T& s_0) { this->SetAtIndex(K::kS0, s_0); }
100  const T& time_headway() const { return this->GetAtIndex(K::kTimeHeadway); }
101  void set_time_headway(const T& time_headway) {
102  this->SetAtIndex(K::kTimeHeadway, time_headway);
103  }
107  const T& delta() const { return this->GetAtIndex(K::kDelta); }
108  void set_delta(const T& delta) { this->SetAtIndex(K::kDelta, delta); }
113  const T& bloat_diameter() const {
114  return this->GetAtIndex(K::kBloatDiameter);
115  }
116  void set_bloat_diameter(const T& bloat_diameter) {
117  this->SetAtIndex(K::kBloatDiameter, bloat_diameter);
118  }
123  const T& distance_lower_limit() const {
124  return this->GetAtIndex(K::kDistanceLowerLimit);
125  }
126  void set_distance_lower_limit(const T& distance_lower_limit) {
127  this->SetAtIndex(K::kDistanceLowerLimit, distance_lower_limit);
128  }
132  const T& scan_ahead_distance() const {
133  return this->GetAtIndex(K::kScanAheadDistance);
134  }
135  void set_scan_ahead_distance(const T& scan_ahead_distance) {
136  this->SetAtIndex(K::kScanAheadDistance, scan_ahead_distance);
137  }
139 
141  static const std::vector<std::string>& GetCoordinateNames() {
143  }
144 
146  decltype(T() < T()) IsValid() const {
147  using std::isnan;
148  auto result = (T(0) == T(0));
149  result = result && !isnan(v_ref());
150  result = result && (v_ref() >= T(0.0));
151  result = result && !isnan(a());
152  result = result && (a() >= T(0.0));
153  result = result && !isnan(b());
154  result = result && (b() >= T(0.0));
155  result = result && !isnan(s_0());
156  result = result && (s_0() >= T(0.0));
157  result = result && !isnan(time_headway());
158  result = result && (time_headway() >= T(0.0));
159  result = result && !isnan(delta());
160  result = result && (delta() >= T(0.0));
161  result = result && !isnan(bloat_diameter());
162  result = result && (bloat_diameter() >= T(0.0));
163  result = result && !isnan(distance_lower_limit());
164  result = result && (distance_lower_limit() >= T(0.0));
165  result = result && !isnan(scan_ahead_distance());
166  result = result && (scan_ahead_distance() >= T(0.0));
167  return result;
168  }
169 
170  // VectorBase override.
171  void CalcInequalityConstraint(VectorX<T>* value) const override {
172  value->resize(9);
173  (*value)[0] = v_ref() - T(0.0);
174  (*value)[1] = a() - T(0.0);
175  (*value)[2] = b() - T(0.0);
176  (*value)[3] = s_0() - T(0.0);
177  (*value)[4] = time_headway() - T(0.0);
178  (*value)[5] = delta() - T(0.0);
179  (*value)[6] = bloat_diameter() - T(0.0);
180  (*value)[7] = distance_lower_limit() - T(0.0);
181  (*value)[8] = scan_ahead_distance() - T(0.0);
182  }
183 };
184 
185 } // namespace automotive
186 } // namespace drake
IdmPlannerParametersIndices K
An abbreviation for our row index constants.
Definition: idm_planner_parameters.h:47
void set_b(const T &b)
Definition: idm_planner_parameters.h:91
const T & s_0() const
minimum desired net distance
Definition: idm_planner_parameters.h:95
void set_distance_lower_limit(const T &distance_lower_limit)
Definition: idm_planner_parameters.h:126
const T & time_headway() const
desired time headway to vehicle in front
Definition: idm_planner_parameters.h:100
void set_a(const T &a)
Definition: idm_planner_parameters.h:86
bool isnan(const Eigen::AutoDiffScalar< DerType > &x)
Overloads isnan to mimic std::isnan from <cmath>.
Definition: autodiff_overloads.h:48
const T & delta() const
free-road exponent
Definition: idm_planner_parameters.h:107
static const std::vector< std::string > & GetCoordinateNames()
See IdmPlannerParametersIndices::GetCoordinateNames().
Definition: idm_planner_parameters.h:141
Definition: automotive_demo.cc:88
static const int kDistanceLowerLimit
Definition: idm_planner_parameters.h:32
static const int kVRef
Definition: idm_planner_parameters.h:25
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > VectorX
A column vector of any size, templated on scalar type.
Definition: eigen_types.h:46
static const int kDelta
Definition: idm_planner_parameters.h:30
void set_delta(const T &delta)
Definition: idm_planner_parameters.h:108
int b
Definition: rgbd_camera.cc:91
std::vector< Number > result
Definition: ipopt_solver.cc:151
static const int kTimeHeadway
Definition: idm_planner_parameters.h:29
static const std::vector< std::string > & GetCoordinateNames()
Returns a vector containing the names of each coordinate within this class.
Definition: idm_planner_parameters.cc:21
const T & scan_ahead_distance() const
distance to scan ahead on road for a leading vehicle
Definition: idm_planner_parameters.h:132
static const int kB
Definition: idm_planner_parameters.h:27
const T & b() const
comfortable braking deceleration
Definition: idm_planner_parameters.h:90
static const int kS0
Definition: idm_planner_parameters.h:28
int value
Definition: copyable_unique_ptr_test.cc:61
void set_scan_ahead_distance(const T &scan_ahead_distance)
Definition: idm_planner_parameters.h:135
const T & a() const
max acceleration
Definition: idm_planner_parameters.h:85
static const int kA
Definition: idm_planner_parameters.h:26
void CalcInequalityConstraint(VectorX< T > *value) const override
Populates a vector value suitable for a SystemConstraint inequality constraint.
Definition: idm_planner_parameters.h:171
BasicVector is a semantics-free wrapper around an Eigen vector that satisfies VectorBase.
Definition: basic_vector.h:25
void set_s_0(const T &s_0)
Definition: idm_planner_parameters.h:96
IdmPlannerParameters< T > * DoClone() const override
Returns a new BasicVector containing a copy of the entire vector.
Definition: idm_planner_parameters.h:71
const T & distance_lower_limit() const
lower saturation bound on net distance to prevent near-singular IDM solutions
Definition: idm_planner_parameters.h:123
Specializes BasicVector with specific getters and setters.
Definition: idm_planner_parameters.h:44
const T & bloat_diameter() const
diameter of circle about the vehicle&#39;s pose that encloses its physical footprint
Definition: idm_planner_parameters.h:113
IdmPlannerParameters()
Default constructor.
Definition: idm_planner_parameters.h:59
static const int kBloatDiameter
Definition: idm_planner_parameters.h:31
Describes the row indices of a IdmPlannerParameters.
Definition: idm_planner_parameters.h:20
static const int kScanAheadDistance
Definition: idm_planner_parameters.h:33
void set_time_headway(const T &time_headway)
Definition: idm_planner_parameters.h:101
static const int kNumCoordinates
The total number of rows (coordinates).
Definition: idm_planner_parameters.h:22
void set_v_ref(const T &v_ref)
Definition: idm_planner_parameters.h:81
void set_bloat_diameter(const T &bloat_diameter)
Definition: idm_planner_parameters.h:116