Drake
pure_pursuit_params.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 = 1;
23 
24  // The index of each individual coordinate.
25  static const int kSLookahead = 0;
26 
31  static const std::vector<std::string>& GetCoordinateNames();
32 };
33 
35 template <typename T>
37  public:
40 
44  this->set_s_lookahead(15.0);
45  }
46 
47  PurePursuitParams<T>* DoClone() const override {
48  return new PurePursuitParams;
49  }
50 
52 
53  const T& s_lookahead() const { return this->GetAtIndex(K::kSLookahead); }
57  void set_s_lookahead(const T& s_lookahead) {
58  this->SetAtIndex(K::kSLookahead, s_lookahead);
59  }
61 
63  static const std::vector<std::string>& GetCoordinateNames() {
65  }
66 
68  decltype(T() < T()) IsValid() const {
69  using std::isnan;
70  auto result = (T(0) == T(0));
71  result = result && !isnan(s_lookahead());
72  result = result && (s_lookahead() >= T(0.0));
73  return result;
74  }
75 
76  // VectorBase override.
77  void CalcInequalityConstraint(VectorX<T>* value) const override {
78  value->resize(1);
79  (*value)[0] = s_lookahead() - T(0.0);
80  }
81 };
82 
83 } // namespace automotive
84 } // namespace drake
bool isnan(const Eigen::AutoDiffScalar< DerType > &x)
Overloads isnan to mimic std::isnan from <cmath>.
Definition: autodiff_overloads.h:48
static const int kNumCoordinates
The total number of rows (coordinates).
Definition: pure_pursuit_params.h:22
PurePursuitParamsIndices K
An abbreviation for our row index constants.
Definition: pure_pursuit_params.h:39
Definition: automotive_demo.cc:88
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > VectorX
A column vector of any size, templated on scalar type.
Definition: eigen_types.h:46
PurePursuitParams()
Default constructor.
Definition: pure_pursuit_params.h:43
std::vector< Number > result
Definition: ipopt_solver.cc:151
void CalcInequalityConstraint(VectorX< T > *value) const override
Populates a vector value suitable for a SystemConstraint inequality constraint.
Definition: pure_pursuit_params.h:77
int value
Definition: copyable_unique_ptr_test.cc:61
PurePursuitParams< T > * DoClone() const override
Returns a new BasicVector containing a copy of the entire vector.
Definition: pure_pursuit_params.h:47
static const std::vector< std::string > & GetCoordinateNames()
See PurePursuitParamsIndices::GetCoordinateNames().
Definition: pure_pursuit_params.h:63
BasicVector is a semantics-free wrapper around an Eigen vector that satisfies VectorBase.
Definition: basic_vector.h:25
static const int kSLookahead
Definition: pure_pursuit_params.h:25
Specializes BasicVector with specific getters and setters.
Definition: pure_pursuit_params.h:36
static const std::vector< std::string > & GetCoordinateNames()
Returns a vector containing the names of each coordinate within this class.
Definition: pure_pursuit_params.cc:12
void set_s_lookahead(const T &s_lookahead)
Definition: pure_pursuit_params.h:57
Describes the row indices of a PurePursuitParams.
Definition: pure_pursuit_params.h:20