20 template <
class System1,
class System2>
23 template <
typename ScalarType>
25 template <
typename ScalarType>
26 using StateVector2 =
typename System2::template StateVector<ScalarType>;
28 template <
typename ScalarType>
30 template <
typename ScalarType>
32 template <
typename ScalarType>
35 template <
typename ScalarType>
36 using OutputVector =
typename System2::template OutputVector<ScalarType>;
43 "System 2 input vector must match System 1 output vector");
46 : sys1(_sys1), sys2(_sys2) {}
48 template <
typename ScalarType>
49 StateVector<ScalarType>
dynamics(
const ScalarType&
t,
50 const StateVector<ScalarType>&
x,
51 const InputVector<ScalarType>& u)
const {
55 StateVector<ScalarType> xdot =
56 util::combine(sys1->dynamics(t, x1, u), sys2->dynamics(t, x2, y1));
60 template <
typename ScalarType>
61 OutputVector<ScalarType>
output(
const ScalarType&
t,
62 const StateVector<ScalarType>&
x,
63 const InputVector<ScalarType>& u)
const {
67 OutputVector<ScalarType> y2 = sys2->output(t, x2, y1);
72 return sys1->isTimeVarying() || sys2->isTimeVarying();
75 return sys1->isDirectFeedthrough() && sys2->isDirectFeedthrough();
103 template <
typename System1,
typename System2>
104 std::shared_ptr<CascadeSystem<System1, System2>>
cascade(
105 const std::shared_ptr<System1>& sys1,
106 const std::shared_ptr<System2>& sys2) {
107 return std::make_shared<CascadeSystem<System1, System2>>(sys1, sys2);
std::shared_ptr< System1 > System1Ptr
Definition: cascade_system.h:37
OutputVector< ScalarType > output(const ScalarType &t, const StateVector< ScalarType > &x, const InputVector< ScalarType > &u) const
Definition: cascade_system.h:61
StateVector< ScalarType > dynamics(const ScalarType &t, const StateVector< ScalarType > &x, const InputVector< ScalarType > &u) const
Definition: cascade_system.h:49
std::vector< Number > x
Definition: IpoptSolver.cpp:169
typename System1::template OutputVector< ScalarType > System1OutputVector
Definition: cascade_system.h:34
typename System1::template InputVector< ScalarType > InputVector
Definition: cascade_system.h:31
size_t getNumStates() const
Definition: cascade_system.h:77
std::shared_ptr< System2 > System2Ptr
Definition: cascade_system.h:38
NOTE: The contents of this class are for the most part direct ports of drake/systems/plants//inverseK...
Definition: Function.h:14
const System2Ptr & getSys2() const
Definition: cascade_system.h:86
CascadeSystem<System1,System2>
Definition: cascade_system.h:21
bool isTimeVarying() const
Definition: cascade_system.h:71
std::size_t getNumOutputs(const System &sys)
getNumOutputs()
Definition: System.h:162
static Vector1< ScalarType > first(const typename helper::template type< ScalarType > &vec)
Definition: Vector.h:292
std::shared_ptr< CascadeSystem< System1, System2 > > cascade(const std::shared_ptr< System1 > &sys1, const std::shared_ptr< System2 > &sys2)
cascade(sys1, sys2)
Definition: cascade_system.h:104
typename System2::template StateVector< ScalarType > StateVector2
Definition: cascade_system.h:26
typename util::template type< ScalarType > StateVector
Definition: cascade_system.h:29
static double * t
Definition: inverseKinSnoptBackend.cpp:62
static helper::template type< ScalarType > combine(const Vector1< ScalarType > &vec1, const Vector2< ScalarType > &vec2)
Definition: Vector.h:304
std::size_t getNumStates(const System &sys)
getNumStates()
Definition: System.h:108
typename System1::template StateVector< ScalarType > StateVector1
Definition: cascade_system.h:24
std::size_t getNumInputs(const System &sys)
getNumInputs()
Definition: System.h:135
size_t getNumOutputs() const
Definition: cascade_system.h:81
CombinedVectorUtil.
Definition: Vector.h:284
static Vector2< ScalarType > second(const typename helper::template type< ScalarType > &vec)
Definition: Vector.h:298
size_t getNumInputs() const
Definition: cascade_system.h:80
const System1Ptr & getSys1() const
Definition: cascade_system.h:84
bool isDirectFeedthrough() const
Definition: cascade_system.h:74
CascadeSystem(const System1Ptr &_sys1, const System2Ptr &_sys2)
Definition: cascade_system.h:45
friend StateVector< double > getInitialState(const CascadeSystem< System1, System2 > &sys)
Definition: cascade_system.h:88
typename System2::template OutputVector< ScalarType > OutputVector
Definition: cascade_system.h:36