23 template <
class System>
26 template <
typename ScalarType>
28 template <
typename ScalarType>
29 using InputVector =
typename System::template StateVector<ScalarType>;
30 template <
typename ScalarType>
34 template <
typename DerivedA,
typename DerivedB>
36 const Eigen::MatrixBase<DerivedB>& Kd)
37 : sys(sys), Kp(Kp), Kd(Kd) {
39 "Kp must have the same number of rows as the system has" 42 "Kd must have the same number of rows as Kp");
44 "Kp and Kd must match the number of states");
47 template <
typename ScalarType>
48 StateVector<ScalarType>
dynamics(
const ScalarType&
t,
49 const StateVector<ScalarType>&
x,
54 return sys->dynamics(t, x, system_u);
57 template <
typename ScalarType>
58 OutputVector<ScalarType>
output(
const ScalarType&
t,
59 const StateVector<ScalarType>&
x,
64 return sys->output(t, x, system_u);
74 const SystemPtr&
getSys()
const {
return sys; }
82 Eigen::MatrixXd Kp, Kd;
typename System::template StateVector< ScalarType > StateVector
Definition: pd_control_system.h:27
size_t getNumOutputs() const
Definition: pd_control_system.h:71
PDControlSystem<System>
Definition: pd_control_system.h:24
std::vector< Number > x
Definition: IpoptSolver.cpp:169
NOTE: The contents of this class are for the most part direct ports of drake/systems/plants//inverseK...
Definition: Function.h:14
std::size_t getNumOutputs(const System &sys)
getNumOutputs()
Definition: System.h:162
typename System::template StateVector< ScalarType > InputVector
Definition: pd_control_system.h:29
static double * t
Definition: inverseKinSnoptBackend.cpp:62
size_t getNumInputs() const
Definition: pd_control_system.h:70
size_t getNumStates() const
Definition: pd_control_system.h:69
#define DRAKE_ASSERT(condition)
DRAKE_ASSERT(condition) is similar to the built-in assert(condition) from the C++ system header <cas...
Definition: drake_assert.h:35
bool isDirectFeedthrough() const
Definition: pd_control_system.h:68
std::shared_ptr< System > SystemPtr
Definition: pd_control_system.h:32
const SystemPtr & getSys() const
Definition: pd_control_system.h:74
Provides Drake's assertion implementation.
std::size_t getNumStates(const System &sys)
getNumStates()
Definition: System.h:108
PDControlSystem(const SystemPtr &sys, const Eigen::MatrixBase< DerivedA > &Kp, const Eigen::MatrixBase< DerivedB > &Kd)
Definition: pd_control_system.h:35
friend StateVector< double > getInitialState(const PDControlSystem< System > &sys)
Definition: pd_control_system.h:75
std::size_t getNumInputs(const System &sys)
getNumInputs()
Definition: System.h:135
bool isTimeVarying() const
Definition: pd_control_system.h:67
OutputVector< ScalarType > output(const ScalarType &t, const StateVector< ScalarType > &x, const InputVector< ScalarType > &u) const
Definition: pd_control_system.h:58
StateVector< ScalarType > dynamics(const ScalarType &t, const StateVector< ScalarType > &x, const InputVector< ScalarType > &u) const
Definition: pd_control_system.h:48
typename System::template OutputVector< ScalarType > OutputVector
Definition: pd_control_system.h:31
const Eigen::Matrix< ScalarType, Rows, 1 > & toEigen(const Eigen::Matrix< ScalarType, Rows, 1 > &vec)
Definition: Vector.h:61