32 if (!first || !second)
33 throw std::logic_error(
"Cascade: empty Systems not allowed.");
35 const int out1 = first->get_num_output_ports();
36 const int in2 = second->get_num_input_ports();
39 throw std::logic_error(
40 "Cascade3: first System has " 45 auto first_system = this->
AddSubsystem(std::move(first));
46 auto second_system = this->
AddSubsystem(std::move(second));
49 for (
int port = 0; port < first_system->get_num_input_ports(); ++port) {
55 for (
int port = 0; port < out1; ++port)
56 this->
Connect(first_system, port, second_system, port);
59 for (
int port = 0; port < second_system->get_num_output_ports(); ++port) {
A superclass template for systems that use a specified scalar type T for numerical values...
Definition: system3.h:481
void Connect(AbstractSystem3 *source_subsystem, int output_port_num, AbstractSystem3 *sink_subsystem, int input_port_num)
Connect the given output port of subsystem 1 into the given input port of subsystem 2...
Definition: system3.h:224
Definition: constants.h:3
int InheritInputPort(AbstractSystem3 *child_subsystem, int input_port_num)
The given subsystem's InputPort3 becomes the next InputPort3 of this system diagram.
Definition: system3.h:194
ConcreteSystem * AddSubsystem(std::unique_ptr< ConcreteSystem > subsystem)
Takes ownership of the given system and returns an unowned, raw pointer to the concrete type for conv...
Definition: system3.h:183
Cascade3(const std::string &name, std::unique_ptr< System3< T >> first, std::unique_ptr< System3< T >> second)
Takes over ownership of the two System objects and connects the outputs of first to the inputs of sec...
Definition: cascade3.h:29
#define DRAKE_ABORT_UNLESS(condition)
Evaluates condition and iff the value is false will ::abort() the program with a message showing at l...
Definition: drake_assert.h:39
A Diagram is a concrete System that contains other System objects as subsystems and wires them togeth...
Definition: diagram3.h:23
std::string to_string(const Eigen::MatrixBase< Derived > &a)
Definition: testUtil.h:29
int InheritOutputPort(AbstractSystem3 *child_subsystem, int output_port_num)
The given subsystem's OutputPort3 becomes the next OutputPort3 of this system diagram.
Definition: system3.h:208
A Cascade is a concrete SystemDiagram containing exactly two compatible subsystems with the output of...
Definition: cascade3.h:20