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 /// - double
24 /// - AutoDiffXd
25 /// - symbolic::Expression
26 ///
27 /// They are already available to link against in the containing library.
28 /// Currently, no other values for `T` are supported.
29 ///
30 /// @ingroup automotive_systems
31 template <typename T>
33  public:
35 
36  /// Constructs a %DrivingCommandMux with two scalar-valued input ports, and
37  /// one output port containing a DrivingCommand<T>.
39 
40  /// Scalar-converting copy constructor. See @ref system_scalar_conversion.
41  template <typename U>
42  explicit DrivingCommandMux(const DrivingCommandMux<U>&);
43 
44  /// See the class description for details on the following input ports.
45  /// @{
48  /// @}
49 
50  private:
51  // Packs a DrivingCommand based on the values seen at the input ports.
52  void CombineInputsToOutput(const systems::Context<T>& context,
53  DrivingCommand<T>* output) const;
54 
55  const int steering_port_index_{};
56  const int acceleration_port_index_{};
57 };
58 
59 } // namespace automotive
60 } // namespace drake
A special-purpose multiplexer that packs two scalar inputs, steering angle (in units rad) and acceler...
Definition: driving_command_mux.h:32
DrivingCommandMux()
Constructs a DrivingCommandMux with two scalar-valued input ports, and one output port containing a D...
Definition: driving_command_mux.cc:12
Definition: automotive_demo.cc:105
Context is an abstract class template that represents all the typed values that are used in a System&#39;...
Definition: context.h:40
const systems::InputPort< T > & steering_input() const
See the class description for details on the following input ports.
Definition: driving_command_mux.cc:29
A superclass template that extends System with some convenience utilities that are not applicable to ...
Definition: leaf_system.h:84
const systems::InputPort< T > & acceleration_input() const
Definition: driving_command_mux.cc:36
#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:20
Provides careful macros to selectively enable or disable the special member functions for copy-constr...