Drake
maliput_railcar_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 = 4;
23 
24  // The index of each individual coordinate.
25  static const int kR = 0;
26  static const int kH = 1;
27  static const int kMaxSpeed = 2;
28  static const int kVelocityLimitKp = 3;
29 
34  static const std::vector<std::string>& GetCoordinateNames();
35 };
36 
38 template <typename T>
40  public:
43 
50  this->set_r(0.0);
51  this->set_h(0.0);
52  this->set_max_speed(45.0);
53  this->set_velocity_limit_kp(10.0);
54  }
55 
56  MaliputRailcarParams<T>* DoClone() const override {
57  return new MaliputRailcarParams;
58  }
59 
61 
62  const T& r() const { return this->GetAtIndex(K::kR); }
65  void set_r(const T& r) { this->SetAtIndex(K::kR, r); }
68  const T& h() const { return this->GetAtIndex(K::kH); }
69  void set_h(const T& h) { this->SetAtIndex(K::kH, h); }
73  const T& max_speed() const { return this->GetAtIndex(K::kMaxSpeed); }
74  void set_max_speed(const T& max_speed) {
75  this->SetAtIndex(K::kMaxSpeed, max_speed);
76  }
80  const T& velocity_limit_kp() const {
81  return this->GetAtIndex(K::kVelocityLimitKp);
82  }
83  void set_velocity_limit_kp(const T& velocity_limit_kp) {
84  this->SetAtIndex(K::kVelocityLimitKp, velocity_limit_kp);
85  }
87 
89  static const std::vector<std::string>& GetCoordinateNames() {
91  }
92 
94  decltype(T() < T()) IsValid() const {
95  using std::isnan;
96  auto result = (T(0) == T(0));
97  result = result && !isnan(r());
98  result = result && !isnan(h());
99  result = result && !isnan(max_speed());
100  result = result && !isnan(velocity_limit_kp());
101  return result;
102  }
103 };
104 
105 } // namespace automotive
106 } // namespace drake
bool isnan(const Eigen::AutoDiffScalar< DerType > &x)
Overloads isnan to mimic std::isnan from <cmath>.
Definition: autodiff_overloads.h:48
MaliputRailcarParams()
Default constructor.
Definition: maliput_railcar_params.h:49
Definition: automotive_demo.cc:88
void set_velocity_limit_kp(const T &velocity_limit_kp)
Definition: maliput_railcar_params.h:83
static const int kMaxSpeed
Definition: maliput_railcar_params.h:27
static const int kR
Definition: maliput_railcar_params.h:25
void set_h(const T &h)
Definition: maliput_railcar_params.h:69
std::vector< Number > result
Definition: ipopt_solver.cc:151
void set_max_speed(const T &max_speed)
Definition: maliput_railcar_params.h:74
const T & velocity_limit_kp() const
The smoothing constant for min/max velocity limits; this element must be positive.
Definition: maliput_railcar_params.h:80
const T & h() const
The vehicle&#39;s height above the lane&#39;s surface.
Definition: maliput_railcar_params.h:68
void set_r(const T &r)
Definition: maliput_railcar_params.h:65
BasicVector is a semantics-free wrapper around an Eigen vector that satisfies VectorBase.
Definition: basic_vector.h:25
static const int kVelocityLimitKp
Definition: maliput_railcar_params.h:28
MaliputRailcarParams< T > * DoClone() const override
Returns a new BasicVector containing a copy of the entire vector.
Definition: maliput_railcar_params.h:56
Describes the row indices of a MaliputRailcarParams.
Definition: maliput_railcar_params.h:20
static const std::vector< std::string > & GetCoordinateNames()
See MaliputRailcarParamsIndices::GetCoordinateNames().
Definition: maliput_railcar_params.h:89
Specializes BasicVector with specific getters and setters.
Definition: maliput_railcar_params.h:39
MaliputRailcarParamsIndices K
An abbreviation for our row index constants.
Definition: maliput_railcar_params.h:42
int r
Definition: rgbd_camera.cc:89
static const int kH
Definition: maliput_railcar_params.h:26
static const std::vector< std::string > & GetCoordinateNames()
Returns a vector containing the names of each coordinate within this class.
Definition: maliput_railcar_params.cc:16
static const int kNumCoordinates
The total number of rows (coordinates).
Definition: maliput_railcar_params.h:22
const T & max_speed() const
The limit on the vehicle&#39;s forward speed, in meters per second; this element must be positive...
Definition: maliput_railcar_params.h:73