Drake
driving_command_mux.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "drake/automotive/gen/driving_command.h"
6 
7 namespace drake {
8 namespace automotive {
9 
10 /// A special-purpose multiplexer that packs two scalar inputs, steering angle
11 /// (in units rad) and acceleration (in units m/s^2), into a vector-valued
12 /// output of type DrivingCommand<T>, where the inputs feed directly through to
13 /// the output.
14 ///
15 /// This class differs from systems::Multiplexer<T> constructed with a
16 /// DrivingCommand<T> model vector because a BasicVector (and notably any of its
17 /// subclasses) stored as T=double cannot yet be converted to another type. See
18 /// #8921.
19 ///
20 /// @tparam T The vector element type, which must be a valid Eigen scalar.
21 ///
22 /// Instantiated templates for the following `T` values are provided:
23 ///
24 /// - double
25 /// - AutoDiffXd
26 /// - symbolic::Expression
27 ///
28 /// They are already available to link against in the containing library.
29 /// Currently, no other values for `T` are supported.
30 ///
31 /// @ingroup automotive_systems
32 template <typename T>
34  public:
36 
37  /// Constructs a %DrivingCommandMux with two scalar-valued input ports, and
38  /// one output port containing a DrivingCommand<T>.
40 
41  /// Scalar-converting copy constructor. See @ref system_scalar_conversion.
42  template <typename U>
43  explicit DrivingCommandMux(const DrivingCommandMux<U>&);
44 
45  /// See the class description for details on the following input ports.
46  /// @{
49  /// @}
50 
51  private:
52  // Packs a DrivingCommand based on the values seen at the input ports.
53  void CombineInputsToOutput(const systems::Context<T>& context,
54  DrivingCommand<T>* output) const;
55 
56  const int steering_port_index_{};
57  const int acceleration_port_index_{};
58 };
59 
60 } // namespace automotive
61 } // namespace drake
A special-purpose multiplexer that packs two scalar inputs, steering angle (in units rad) and acceler...
Definition: driving_command_mux.h:33
DrivingCommandMux()
Constructs a DrivingCommandMux with two scalar-valued input ports, and one output port containing a D...
Definition: driving_command_mux.cc:12
Definition: bullet_model.cc:22
const systems::InputPort< T > & acceleration_input() const
Definition: driving_command_mux.cc:36
Context is an abstract class template that represents all the typed values that are used in a System&#39;...
Definition: context.h:40
A superclass template that extends System with some convenience utilities that are not applicable to ...
Definition: leaf_system.h:81
const systems::InputPort< T > & steering_input() const
See the class description for details on the following input ports.
Definition: driving_command_mux.cc:29
#define DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(Classname)
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN deletes the special member functions for copy-construction, copy-assignment, move-construction, and move-assignment.
Definition: drake_copyable.h:33
This extends InputPortBase with some scalar type-dependent methods.
Definition: input_port.h:23
Provides careful macros to selectively enable or disable the special member functions for copy-constr...