Drake
continuous_system_interface.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 
9 
10 namespace drake {
11 namespace systems {
12 
14 template <typename T>
16  public:
20  virtual std::unique_ptr<ContinuousState<T>> AllocateTimeDerivatives()
21  const = 0;
22 
34  virtual void EvalTimeDerivatives(const Context<T>& context,
35  ContinuousState<T>* derivatives) const = 0;
36 
53  const Context<T>& context, const StateVector<T>& generalized_velocity,
54  StateVector<T>* configuration_derivatives) const = 0;
55 
56  // TODO(david-german-tri): Add MapConfigurationDerivativesToVelocity.
57 
58  // TODO(sherm): these two power methods should be present only for continuous
59  // systems that represent some kind of physical system that can inject or
60  // dissipate energy into the simulation. Consider whether to introduce
61  // a class like PhysicalSystemInterface that could add these methods only
62  // when appropriate; that is awkward to mix with ContinuousSystemInterface
63  // so for now I'm breaking the no-code-in-interface rule to provide
64  // zero defaults so that these don't have to be implemented in non-physical
65  // systems.
66 
75  virtual T EvalConservativePower(const Context<T>& context) const {
76  return T(0);
77  }
78 
86  virtual T EvalNonConservativePower(const Context<T>& context) const {
87  return T(0);
88  }
89 
90  protected:
92 
93  private:
94  // ContinuousSystemInterface objects are neither copyable nor moveable.
96  ContinuousSystemInterface& operator=(
97  const ContinuousSystemInterface<T>& other) = delete;
100  delete;
101 };
102 
103 } // namespace systems
104 } // namespace drake
virtual void EvalTimeDerivatives(const Context< T > &context, ContinuousState< T > *derivatives) const =0
Produces the derivatives of the continuous state xc with respect to time.
Definition: constants.h:3
StateVector is an abstract base class template for vector quantities within the state of a System...
Definition: state_vector.h:20
The Context is a container for all of the data necessary to uniquely determine the computations perfo...
Definition: context.h:38
virtual T EvalNonConservativePower(const Context< T > &context) const
Return the rate at which mechanical energy is being generated (positive) or dissipated (negative) oth...
Definition: continuous_system_interface.h:86
A superclass template for systems that receive input, maintain state, and produce numerical output us...
Definition: system_interface.h:46
A template interface for Systems that have continuous dynamics.
Definition: continuous_system_interface.h:15
virtual T EvalConservativePower(const Context< T > &context) const
Return the rate at which mechanical energy is being converted from potential energy to kinetic energy...
Definition: continuous_system_interface.h:75
virtual std::unique_ptr< ContinuousState< T > > AllocateTimeDerivatives() const =0
Returns a ContinuousState of the same size as the continuous_state allocated in CreateDefaultContext...
ContinuousSystemInterface()
Definition: continuous_system_interface.h:91
virtual void MapVelocityToConfigurationDerivatives(const Context< T > &context, const StateVector< T > &generalized_velocity, StateVector< T > *configuration_derivatives) const =0
Transforms the velocity (v) in the given Context state to the derivative of the configuration (qdot)...
The ContinuousState is a container for all the State variables that are unique to continuous Systems...
Definition: state.h:22