Drake
Drake C++ Documentation
drake::systems Namespace Reference

Namespaces

 analysis
 
 analysis_test
 
 controllers
 
 controllers_test
 
 estimators
 
 implicit_integrator_test
 
 lcm
 
 rendering
 
 scalar_conversion
 
 sensors
 
 test
 

Classes

class  AbstractValues
 AbstractValues is a container for non-numerical state and parameters. More...
 
class  Adder
 An adder for arbitrarily many inputs of equal size. More...
 
class  AffineSystem
 A discrete OR continuous affine system (with constant coefficients). More...
 
class  AntiderivativeFunction
 A thin wrapper of the ScalarInitialValueProblem class that, in concert with Drake's ODE initial value problem solvers ("integrators"), provide the ability to perform quadrature on an arbitrary scalar integrable function. More...
 
class  BarycentricMeshSystem
 A (stateless) vector system implemented as a multi-linear (barycentric) interpolation on a mesh over the inputs. More...
 
class  BasicVector
 BasicVector is a semantics-free wrapper around an Eigen vector that satisfies VectorBase. More...
 
class  BogackiShampine3Integrator
 A third-order, four-stage, first-same-as-last (FSAL) Runge-Kutta integrator with a second order error estimate. More...
 
class  Cache
 (Advanced) Stores all the CacheEntryValue objects owned by a particular Context, organized to allow fast access using a CacheIndex as an index. More...
 
class  CacheEntry
 A CacheEntry belongs to a System and represents the properties of one of that System's cached computations. More...
 
class  CacheEntryValue
 (Advanced) This is the representation in the Context for the value of one of a System's CacheEntry objects. More...
 
class  CompositeEventCollection
 This class bundles an instance of each EventCollection<EventType> into one object that stores the heterogeneous collection. More...
 
class  ConstantValueSource
 A source block that always outputs a constant value. More...
 
class  ConstantVectorSource
 A source block with a constant output port at all times. More...
 
class  Context
 Context is an abstract class template that represents all the typed values that are used in a System's computations: time, numeric-valued input ports, numerical state, and numerical parameters. More...
 
class  ContextBase
 Provides non-templatized Context functionality shared by the templatized derived classes. More...
 
class  ContinuousState
 ContinuousState is a view of, and optionally a container for, all the continuous state variables xc of a Drake System. More...
 
class  Demultiplexer
 This system splits a vector valued signal on its input into multiple outputs. More...
 
class  DenseOutput
 An interface for dense output of ODE solutions, to efficiently approximate them at arbitrarily many points when solving them numerically (see IntegratorBase class documentation). More...
 
class  DependencyGraph
 Represents the portion of the complete dependency graph that is a subgraph centered on the owning subcontext, plus some edges leading to other subcontexts. More...
 
class  DependencyTracker
 Manages value interdependencies for a particular value or set of values in a Context. More...
 
class  Diagram
 Diagram is a System composed of one or more constituent Systems, arranged in a directed graph where the vertices are the constituent Systems themselves, and the edges connect the output of one constituent System to the input of another. More...
 
class  DiagramBuilder
 DiagramBuilder is a factory class for Diagram. More...
 
class  DiagramCompositeEventCollection
 CompositeEventCollection for a Diagram. More...
 
class  DiagramContext
 The DiagramContext is a container for all of the data necessary to uniquely determine the computations performed by a Diagram. More...
 
class  DiagramContinuousState
 DiagramContinuousState is a ContinuousState consisting of Supervectors xc, q, v, z over the corresponding entries in a set of referenced ContinuousState objects, which may or may not be owned by this DiagramContinuousState. More...
 
class  DiagramDiscreteValues
 DiagramDiscreteValues is a DiscreteValues container comprised recursively of a sequence of child DiscreteValues objects. More...
 
class  DiagramEventCollection
 A concrete class that holds all simultaneous homogeneous events for a Diagram. More...
 
class  DiagramOutputPort
 (Advanced.) Holds information about a subsystem output port that has been exported to become one of this Diagram's output ports. More...
 
class  DiagramState
 DiagramState is a State, annotated with pointers to all the mutable substates that it spans. More...
 
class  DiscreteDerivative
 System that outputs the discrete-time derivative of its input: y(t) = (u[n] - u[n-1])/h, where n = floor(t/h), where h is the time period. More...
 
class  DiscreteTimeDelay
 A discrete time delay block with input u, which is vector-valued (discrete or continuous) or abstract, and output delayed_u which is previously received input, delayed by the given amount. More...
 
class  DiscreteUpdateEvent
 This class represents a discrete update event. More...
 
class  DiscreteValues
 DiscreteValues is a container for numerical but non-continuous state and parameters. More...
 
class  Event
 Abstract base class that represents an event. More...
 
class  EventCollection
 There are three concrete event types for any System: publish, discrete state update, and unrestricted state update, listed in order of increasing ability to change the state (i.e., zero to all). More...
 
class  EventStatus
 Holds the return status from execution of an event handler function, or the effective status after a series of handler executions due to dispatching of simultaneous events. More...
 
class  ExplicitEulerIntegrator
 A first-order, explicit Euler integrator. More...
 
class  ExternalSystemConstraint
 An "external" constraint on a System. More...
 
class  FirstOrderLowPassFilter
 An element-wise first order low pass filter system that filters the i-th input uᵢ into the i-th output zᵢ. More...
 
class  FixedInputPortValue
 A FixedInputPortValue encapsulates a vector or abstract value for use as an internal value source for one of a System's input ports. More...
 
class  Gain
 An element-wise gain block with input u and output y = k * u with k a constant vector. More...
 
class  HermitianDenseOutput
 A StepwiseDenseOutput class implementation using Hermitian interpolators, and therefore a continuous extension of the solution 𝐱(t) (see [Engquist, 2105]). More...
 
class  ImplicitEulerIntegrator
 A first-order, fully implicit integrator with second order error estimation. More...
 
class  ImplicitIntegrator
 An abstract class providing methods shared by implicit integrators. More...
 
class  InitializationTestSystem
 A LeafSystem which declares all possible initialization events, and records information (in mutable variables and in the context) about whether the events have been processed. More...
 
struct  InitializeParams
 Parameters for fine control of simulator initialization. More...
 
class  InitialValueProblem
 A general initial value problem (or IVP) representation class, that allows evaluating the 𝐱(t; 𝐤) solution function to the given ODE d𝐱/dt = f(t, 𝐱; 𝐤), where f : t ⨯ 𝐱 → ℝⁿ, t ∈ ℝ, 𝐱 ∈ ℝⁿ, 𝐤 ∈ ℝᵐ, provided an initial condition 𝐱(t₀; 𝐤) = 𝐱₀. More...
 
class  InputPort
 An InputPort is a System resource that describes the kind of input a System accepts, on a given port. More...
 
class  InputPortBase
 An InputPort is a System resource that describes the kind of input a System accepts, on a given port. More...
 
class  Integrator
 An integrator for a continuous vector input. More...
 
class  IntegratorBase
 An abstract class for an integrator for ODEs and DAEs as represented by a Drake System. More...
 
class  LeafCompositeEventCollection
 A CompositeEventCollection for a LeafSystem. More...
 
class  LeafContext
 LeafContext contains all prerequisite data necessary to uniquely determine the results of computations performed by the associated LeafSystem. More...
 
class  LeafEventCollection
 A concrete class that holds all simultaneous homogeneous events for a LeafSystem. More...
 
class  LeafOutputPort
 (Advanced.) Implements an output port whose value is managed by a cache entry in the same LeafSystem as the port. More...
 
class  LeafSystem
 A superclass template that extends System with some convenience utilities that are not applicable to Diagrams. More...
 
class  LinearSystem
 A discrete OR continuous linear system. More...
 
class  LinearTransformDensity
 Performs linear transformation on the random signal w_in as w_out = A*w_in + b. More...
 
class  MatrixGain
 A system that specializes LinearSystem by setting coefficient matrices A, B, and C to all be zero. More...
 
class  MultilayerPerceptron
 The MultilayerPerceptron (MLP) is one of the most common forms of neural networks used in reinforcement learning (RL) today. More...
 
class  Multiplexer
 This system combines multiple vector-valued inputs into a vector-valued output. More...
 
class  MyVector
 A simple subclass of BasicVector<T> for testing, particularly for cases where BasicVector subtyping must be preserved through the framework. More...
 
class  OutputPort
 An OutputPort belongs to a System and represents the properties of one of that System's output ports. More...
 
class  OutputPortBase
 OutputPortBase handles the scalar type-independent aspects of an OutputPort. More...
 
class  Parameters
 Parameters is a container for variables that parameterize a System so that it can represent a family of related models. More...
 
class  PassThrough
 A pass through system with input u and output y = u. More...
 
class  PeriodicEventData
 An event data variant describing an event that recurs on a fixed period. More...
 
struct  PeriodicEventDataComparator
 Structure for comparing two PeriodicEventData objects for use in a map container, using an arbitrary comparison method. More...
 
class  PidControlledSpringMassSystem
 A model of a one-dimensional spring-mass system controlled to achieve a given target position using a PID controller. More...
 
class  PortBase
 A PortBase is base class for System ports; users will typically use the InputPort<T> or OutputPort<T> types, not this base class. More...
 
class  PortSwitch
 A simple system that passes through the value from just one of its input ports to the output. More...
 
class  PublishEvent
 This class represents a publish event. More...
 
class  RadauIntegrator
 A selectable order (third- or first-order), fully implicit integrator with error estimation. More...
 
class  RandomSource
 A source block which generates random numbers at a fixed sampling interval, with a zero-order hold between samples. More...
 
class  RungeKutta2Integrator
 A second-order, explicit Runge Kutta integrator. More...
 
class  RungeKutta3Integrator
 A third-order Runge Kutta integrator with a third order error estimate. More...
 
class  RungeKutta5Integrator
 A fifth-order, seven-stage, first-same-as-last (FSAL) Runge Kutta integrator with a fourth order error estimate. More...
 
class  Saturation
 An element-wise hard saturation block with inputs signal u, saturation values \( u_{min} \) and/or \( u_{max} \), and output y respectively as in: More...
 
class  ScalarDenseOutput
 A DenseOutput class interface extension to deal with scalar ODE solutions. More...
 
class  ScalarInitialValueProblem
 A thin wrapper of the InitialValueProblem class to provide a simple interface when solving scalar initial value problems i.e. More...
 
class  ScalarViewDenseOutput
 A ScalarDenseOutput class implementation that wraps a DenseOutput class instance and behaves as a view to one of its elements. More...
 
class  SemiExplicitEulerIntegrator
 A first-order, semi-explicit Euler integrator. More...
 
class  SharedPointerSystem
 SharedPointerSystem holds a single shared_ptr that will be released at System deletion time (i.e., the end of a Diagram lifespan). More...
 
class  Simulator
 A class for advancing the state of hybrid dynamic systems, represented by System<T> objects, forward in time. More...
 
struct  SimulatorConfig
 The set of all configurable properties on a Simulator and IntegratorBase. More...
 
class  SimulatorStatus
 Holds the status return value from a call to Simulator::AdvanceTo() and related methods. More...
 
class  Sine
 A sine system which outputs y = a * sin(f * t + p) and first and second derivatives w.r.t. More...
 
class  SingleOutputVectorSource
 A base class that specializes LeafSystem for use with no input ports, and only a single, vector output port. More...
 
class  SpringMassStateVector
 The state of a one-dimensional spring-mass system, consisting of the position and velocity of the mass, in meters and meters/s. More...
 
class  SpringMassSystem
 A model of a one-dimensional spring-mass system. More...
 
class  State
 State is a container for all the data comprising the complete state of a particular System at a particular moment. More...
 
class  StateInterpolatorWithDiscreteDerivative
 Supports the common pattern of combining a (feed-through) position with a velocity estimated with the DiscreteDerivative into a single output vector with positions and velocities stacked. More...
 
class  StepwiseDenseOutput
 A DenseOutput class interface extension, geared towards step-wise construction procedures. More...
 
class  Subvector
 Subvector is a concrete class template that implements VectorBase by providing a sliced view of a VectorBase. More...
 
class  Supervector
 Supervector is a concrete class template that implements VectorBase by concatenating multiple VectorBases, which it does not own. More...
 
class  SymbolicVectorSystem
 A LeafSystem that is defined by vectors of symbolic::Expression representing the dynamics and output. More...
 
class  System
 Base class for all System functionality that is dependent on the templatized scalar type T for input, state, parameters, and outputs. More...
 
class  SystemBase
 Provides non-templatized functionality shared by the templatized System classes. More...
 
class  SystemConstraint
 A SystemConstraint is a generic base-class for constraints on Systems. More...
 
class  SystemConstraintAdapter
 This class is a factory class to generate SystemConstraintWrapper. More...
 
class  SystemConstraintBounds
 The bounds of a SystemConstraint. More...
 
class  SystemConstraintWrapper
 This wrapper class wraps a SystemConstraint object to the format of solvers::Constraint. More...
 
class  SystemOutput
 Conveniently stores a snapshot of the values of every output port of a System. More...
 
class  SystemScalarConverter
 Helper class to convert a System into a System<T>, intended for internal use by the System framework, not directly by users. More...
 
class  SystemSymbolicInspector
 The SystemSymbolicInspector uses symbolic::Expressions to analyze various properties of the System, such as time invariance and input-to-output sparsity, along with many others. More...
 
struct  SystemTypeTag
 A tag object that denotes a System subclass S in function signatures. More...
 
class  SystemVisitor
 Provides a "Visitor Pattern" for System and Diagram. More...
 
class  TimeVaryingAffineSystem
 Base class for a discrete- or continuous-time, time-varying affine system, with potentially time-varying coefficients. More...
 
class  TimeVaryingLinearSystem
 Base class for a discrete or continuous linear time-varying (LTV) system. More...
 
class  TrajectoryAffineSystem
 A continuous- or discrete-time Affine Time-Varying system with system matrices described by trajectories. More...
 
class  TrajectoryLinearSystem
 A continuous- or discrete-time Linear Time-Varying system with system matrices described by trajectories. More...
 
class  TrajectorySource
 Given a Trajectory, this System provides an output port with the value of the trajectory evaluated at the current time. More...
 
class  TransferFunction
 Represents a linear-time-invariant (LTI) system in transfer function form, e.g. More...
 
class  UnrestrictedUpdateEvent
 This class represents an unrestricted update event. More...
 
struct  UseDefaultName
 (Advanced.) Tag type that indicates a system or port should use a default name, instead of a user-provided name. More...
 
class  ValueProducer
 ValueProducer computes an AbstractValue output based on a ContextBase input. More...
 
class  VectorBase
 VectorBase is an abstract base class that real-valued signals between Systems and real-valued System state vectors must implement. More...
 
class  VectorLog
 This utility class serves as an in-memory cache of time-dependent vector values. More...
 
class  VectorLogSink
 A discrete sink block which logs its vector-valued input to per-context memory. More...
 
class  VectorSystem
 A base class that specializes LeafSystem for use with only zero or one vector input ports, and only zero or one vector output ports. More...
 
class  VelocityImplicitEulerIntegrator
 A first-order, fully implicit integrator optimized for second-order systems, with a second-order error estimate. More...
 
class  WitnessFunction
 Class that stores a function that is able to help determine the time and state at which a step of the initial value problem integration of a System should end, which may be done for any number of purposes, including publishing or state reinitialization (i.e., event handling). More...
 
class  WitnessTriggeredEventData
 An event data variant for storing data from a witness function triggering to be passed to event handlers. More...
 
class  WrapToSystem
 An element-wise wrapping block that transforms the specified indices of the input signal u into the interval [low, high). More...
 
class  ZeroOrderHold
 A zero order hold block with input u, which may be vector-valued (discrete or continuous) or abstract, and discrete output y, where the y is sampled from u with a fixed period (and optional offset). More...
 

Typedefs

template<typename T >
using Radau3Integrator = RadauIntegrator< T, 2 >
 A third-order fully implicit integrator with error estimation. More...
 
template<typename T >
using Radau1Integrator = RadauIntegrator< T, 1 >
 A first-order fully implicit integrator with error estimation. More...
 
using TriggerTypeSet = std::unordered_set< TriggerType, DefaultHash >
 This set-type alias provides a convenient API vocabulary for systems to specify multiple trigger types. More...
 
using DependencyTicket = TypeSafeIndex< class DependencyTag >
 Identifies a particular source value or computation for purposes of declaring and managing dependencies. More...
 
using CacheIndex = TypeSafeIndex< class CacheTag >
 Serves as a unique identifier for a particular CacheEntry in a System and the corresponding CacheEntryValue in that System's Context. More...
 
using SubsystemIndex = TypeSafeIndex< class SubsystemIndexTag >
 Serves as a local index for a child subsystem within a parent Diagram, or a child subcontext within a parent DiagramContext. More...
 
using InputPortIndex = TypeSafeIndex< class InputPortTag >
 Serves as the local index for the input ports of a given System. More...
 
using OutputPortIndex = TypeSafeIndex< class OutputPortTag >
 Serves as the local index for the output ports of a given System. More...
 
using ContinuousStateIndex = TypeSafeIndex< class ContinuousStateTag >
 Placeholder for future use. More...
 
using DiscreteStateIndex = TypeSafeIndex< class DiscreteStateTag >
 Serves as the local index for discrete state groups within a given System and its corresponding Context. More...
 
using AbstractStateIndex = TypeSafeIndex< class AbstractStateTag >
 Serves as the local index for abstract state variables within a given System and its corresponding Context. More...
 
using NumericParameterIndex = TypeSafeIndex< class NumericParameterTag >
 Serves as the local index for numeric parameter groups within a given System and its corresponding Context. More...
 
using AbstractParameterIndex = TypeSafeIndex< class AbstractParameterTag >
 Serves as the local index for abstract parameters within a given System and its corresponding Context. More...
 
using SystemConstraintIndex = TypeSafeIndex< class SystemConstraintTag >
 Serves as the local index for constraints declared on a given System. More...
 
template<typename T >
using ContextConstraintCalc = std::function< void(const Context< T > &, VectorX< T > *value)>
 This is the signature of a stateless function that evaluates the value of the constraint function f: value = f(context) More...
 
template<typename T >
using SystemConstraintCalc = std::function< void(const System< T > &, const Context< T > &, VectorX< T > *value)>
 This is the signature of a stateless function that evaluates the value of the constraint function f: value = f(system, context) More...
 
using MyVector1d = MyVector< double, 1 >
 
using MyVector2d = MyVector< double, 2 >
 
using MyVector3d = MyVector< double, 3 >
 
using MyVector4d = MyVector< double, 4 >
 
template<typename T >
using UpdateContextFromDecisionVariablesFunction = std::function< void(const System< T > &, const Eigen::Ref< const VectorX< T > > &, Context< T > *)>
 Given the decision variable values x (as in SystemConstraintWrapper.Eval(x, &y)), update part of the context with the value of x. More...
 

Enumerations

enum  TriggerType {
  kUnknown, kInitialization, kForced, kTimed,
  kPeriodic, kPerStep, kWitness
}
 Predefined types of triggers for events. More...
 
enum  PortDataType { kVectorValued = 0, kAbstractValued = 1 }
 All system ports are either vectors of Eigen scalars, or black-box AbstractValues which may contain any type. More...
 
enum  InputPortSelection { kNoInput = -1, kUseFirstInputIfItExists = -2 }
 Intended for use in e.g. More...
 
enum  OutputPortSelection { kNoOutput = -1, kUseFirstOutputIfItExists }
 Intended for use in e.g. More...
 
enum  SystemConstraintType { kEquality = 0, kInequality }
 The form of a SystemConstraint. More...
 
enum  WitnessFunctionDirection { kNone, kPositiveThenNonPositive, kNegativeThenNonNegative, kCrossesZero }
 
enum  PerceptronActivationType { kIdentity, kReLU, kTanh }
 Specifies one of the common activation functions in a neural network. More...
 

Functions

template<typename T >
MatrixX< T > BatchEvalUniquePeriodicDiscreteUpdate (const System< T > &system, const Context< T > &context, const Eigen::Ref< const RowVectorX< T >> &times, const Eigen::Ref< const MatrixX< T >> &states, const Eigen::Ref< const MatrixX< T >> &inputs, int num_time_steps=1, std::variant< InputPortSelection, InputPortIndex > input_port_index=InputPortSelection::kUseFirstInputIfItExists, Parallelism parallelize=Parallelism::Max())
 Evaluates the dynamics of a difference equation system at many times, states, and inputs. More...
 
template<typename T >
MatrixX< T > BatchEvalTimeDerivatives (const System< T > &system, const Context< T > &context, const Eigen::Ref< const RowVectorX< T >> &times, const Eigen::Ref< const MatrixX< T >> &states, const Eigen::Ref< const MatrixX< T >> &inputs, std::variant< InputPortSelection, InputPortIndex > input_port_index=InputPortSelection::kUseFirstInputIfItExists, Parallelism parallelize=Parallelism::Max())
 Evaluates the time derivatives of a system at many times, states, and inputs. More...
 
template<typename T >
IntegratorBase< T > & ResetIntegratorFromFlags (Simulator< T > *simulator, const std::string &scheme, const T &max_step_size)
 Resets the integrator used to advanced the continuous time dynamics of the system associated with simulator according to the given arguments. More...
 
const std::vector< std::string > & GetIntegrationSchemes ()
 Returns the allowed string values for the scheme parameter in ResetIntegratorFromFlags() and SimulatorConfig::integration_scheme. More...
 
template<typename T >
void ApplySimulatorConfig (const SimulatorConfig &config, drake::systems::Simulator< T > *simulator)
 Modifies the simulator based on the given config. More...
 
template<typename T >
SimulatorConfig ExtractSimulatorConfig (const drake::systems::Simulator< T > &simulator)
 Reports the simulator's current configuration, including the configuration of the integrator. More...
 
template<typename T >
void PrintSimulatorStatistics (const Simulator< T > &simulator)
 This method outputs to stdout relevant simulation statistics for a simulator that advanced the state of a system forward in time. More...
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const Context< T > &context)
 
bool operator== (const std::variant< std::string, UseDefaultName > &value, const UseDefaultName &)
 (Advanced.) Sugar that compares a variant against kUseDefaultName. More...
 
template<typename T >
std::unique_ptr< AbstractValuePackValue (T value)
 Makes a new AbstractValue containing the value. More...
 
template<typename T >
UnpackValue (const AbstractValue &value)
 Extracts data of type T from the given value, or throws if the value does not contain type T. More...
 
int UnpackIntValue (const AbstractValue *value)
 Extracts an integer from the given value, or aborts if the value does not contain an integer. More...
 
int UnpackIntValue (const AbstractValue &value)
 Extracts an integer from the given value, or aborts if the value does not contain an integer. More...
 
template<template< typename > class S, typename Callback >
::testing::AssertionResult is_autodiffxd_convertible (const S< double > &dut, Callback callback)
 Tests whether the given device under test of type S<double> can be converted to use AutoDiffXd as its scalar type. More...
 
template<template< typename > class S>
::testing::AssertionResult is_autodiffxd_convertible (const S< double > &dut)
 Tests whether the given device under test of type S<double> can be converted to use AutoDiffXd as its scalar type. More...
 
template<template< typename > class S, typename Callback >
::testing::AssertionResult is_symbolic_convertible (const S< double > &dut, Callback callback)
 Tests whether the given device under test of type S<double> can be converted to use Expression as its scalar type. More...
 
template<template< typename > class S>
::testing::AssertionResult is_symbolic_convertible (const S< double > &dut)
 Tests whether the given device under test of type S<double> can be converted to use Expression as its scalar type. More...
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const VectorBase< T > &vec)
 Allows a VectorBase<T> to be streamed into a string as though it were a RowVectorX<T>. More...
 
std::unique_ptr< LinearSystem< double > > Linearize (const System< double > &system, const Context< double > &context, std::variant< InputPortSelection, InputPortIndex > input_port_index=InputPortSelection::kUseFirstInputIfItExists, std::variant< OutputPortSelection, OutputPortIndex > output_port_index=OutputPortSelection::kUseFirstOutputIfItExists, double equilibrium_check_tolerance=1e-6)
 Takes the first-order Taylor expansion of a System around a nominal operating point (defined by the Context). More...
 
std::unique_ptr< AffineSystem< double > > FirstOrderTaylorApproximation (const System< double > &system, const Context< double > &context, std::variant< InputPortSelection, InputPortIndex > input_port_index=InputPortSelection::kUseFirstInputIfItExists, std::variant< OutputPortSelection, OutputPortIndex > output_port_index=OutputPortSelection::kUseFirstOutputIfItExists)
 A first-order Taylor series approximation to a system in the neighborhood of an arbitrary point. More...
 
Eigen::MatrixXd ControllabilityMatrix (const LinearSystem< double > &sys)
 Returns the controllability matrix: R = [B, AB, ..., A^{n-1}B]. More...
 
bool IsControllable (const LinearSystem< double > &sys, std::optional< double > threshold=std::nullopt)
 Returns true iff the controllability matrix is full row rank. More...
 
Eigen::MatrixXd ObservabilityMatrix (const LinearSystem< double > &sys)
 Returns the observability matrix: O = [ C; CA; ...; CA^{n-1} ]. More...
 
bool IsObservable (const LinearSystem< double > &sys, std::optional< double > threshold=std::nullopt)
 Returns true iff the observability matrix is full column rank. More...
 
bool IsStabilizable (const LinearSystem< double > &sys, std::optional< double > threshold=std::nullopt)
 Returns true iff the system is stabilizable. More...
 
bool IsDetectable (const LinearSystem< double > &sys, std::optional< double > threshold=std::nullopt)
 Returns true iff the system is detectable. More...
 
template<typename T >
int AddRandomInputs (double sampling_interval_sec, DiagramBuilder< T > *builder)
 For each subsystem input port in builder that is (a) not yet connected and (b) labeled as random in the InputPort, this method will add a new RandomSource system of the appropriate type and connect it to the subsystem input port. More...
 
template<typename T >
VectorLogSink< T > * LogVectorOutput (const OutputPort< T > &src, DiagramBuilder< T > *builder, double publish_period=0.0)
 LogVectorOutput provides a convenience function for adding a VectorLogSink, initialized to the correct size, and connected to an output in a DiagramBuilder. More...
 
template<typename T >
VectorLogSink< T > * LogVectorOutput (const OutputPort< T > &src, DiagramBuilder< T > *builder, const TriggerTypeSet &publish_triggers, double publish_period=0.0)
 LogVectorOutput provides a convenience function for adding a VectorLogSink, initialized to the correct size, and connected to an output in a DiagramBuilder. More...
 

Variables

constexpr UseDefaultName kUseDefaultName = {}
 Name to use when you want a default one generated. More...
 

Typedef Documentation

◆ AbstractParameterIndex

using AbstractParameterIndex = TypeSafeIndex<class AbstractParameterTag>

Serves as the local index for abstract parameters within a given System and its corresponding Context.

◆ AbstractStateIndex

using AbstractStateIndex = TypeSafeIndex<class AbstractStateTag>

Serves as the local index for abstract state variables within a given System and its corresponding Context.

◆ CacheIndex

using CacheIndex = TypeSafeIndex<class CacheTag>

Serves as a unique identifier for a particular CacheEntry in a System and the corresponding CacheEntryValue in that System's Context.

This is an index providing extremely fast constant-time access to both.

◆ ContextConstraintCalc

using ContextConstraintCalc = std::function<void(const Context<T>&, VectorX<T>* value)>

This is the signature of a stateless function that evaluates the value of the constraint function f: value = f(context)

Note that in the std::function signature, the computed value is an output parameter, not a return value.

See also SystemConstraintCalc, which offers the System reference.

◆ ContinuousStateIndex

using ContinuousStateIndex = TypeSafeIndex<class ContinuousStateTag>

Placeholder for future use.

Currently, the only valid value is zero.

◆ DependencyTicket

using DependencyTicket = TypeSafeIndex<class DependencyTag>

Identifies a particular source value or computation for purposes of declaring and managing dependencies.

Unique only within a given subsystem and its corresponding subcontext.

◆ DiscreteStateIndex

using DiscreteStateIndex = TypeSafeIndex<class DiscreteStateTag>

Serves as the local index for discrete state groups within a given System and its corresponding Context.

◆ InputPortIndex

using InputPortIndex = TypeSafeIndex<class InputPortTag>

Serves as the local index for the input ports of a given System.

The indexes used by a subsystem and its corresponding subcontext are the same.

◆ MyVector1d

using MyVector1d = MyVector<double, 1>

◆ MyVector2d

using MyVector2d = MyVector<double, 2>

◆ MyVector3d

using MyVector3d = MyVector<double, 3>

◆ MyVector4d

using MyVector4d = MyVector<double, 4>

◆ NumericParameterIndex

using NumericParameterIndex = TypeSafeIndex<class NumericParameterTag>

Serves as the local index for numeric parameter groups within a given System and its corresponding Context.

◆ OutputPortIndex

using OutputPortIndex = TypeSafeIndex<class OutputPortTag>

Serves as the local index for the output ports of a given System.

The indexes used by a subsystem and its corresponding subcontext are the same.

◆ Radau1Integrator

A first-order fully implicit integrator with error estimation.

See RadauIntegrator with num_stages == 1 for details.

Template Parameters
TThe scalar type, which must be one of the default nonsymbolic scalars.

◆ Radau3Integrator

A third-order fully implicit integrator with error estimation.

See RadauIntegrator with num_stages == 2 for details.

Template Parameters
TThe scalar type, which must be one of the default nonsymbolic scalars.

◆ SubsystemIndex

using SubsystemIndex = TypeSafeIndex<class SubsystemIndexTag>

Serves as a local index for a child subsystem within a parent Diagram, or a child subcontext within a parent DiagramContext.

A subsystem and its matching subcontext have the same SubsystemIndex. Unique only within a given subsystem or subcontext.

◆ SystemConstraintCalc

using SystemConstraintCalc = std::function<void(const System<T>&, const Context<T>&, VectorX<T>* value)>

This is the signature of a stateless function that evaluates the value of the constraint function f: value = f(system, context)

Note that in the std::function signature, the computed value is an output parameter, not a return value.

Instances of this function type are expected to work with any instance of the class of System they are designed for. Specifically, they should not capture pointers into an instance of a System, OutputPort, etc. Instead, they should only use the System reference that is passed into this functor.

See also ContextConstraintCalc, which omits the System reference. A value of type ContextConstraintCalc is allowed to assume it's only ever applied to a specific System object.

◆ SystemConstraintIndex

using SystemConstraintIndex = TypeSafeIndex<class SystemConstraintTag>

Serves as the local index for constraints declared on a given System.

◆ TriggerTypeSet

using TriggerTypeSet = std::unordered_set<TriggerType, DefaultHash>

This set-type alias provides a convenient API vocabulary for systems to specify multiple trigger types.

◆ UpdateContextFromDecisionVariablesFunction

using UpdateContextFromDecisionVariablesFunction = std::function<void( const System<T>&, const Eigen::Ref<const VectorX<T> >&, Context<T>*)>

Given the decision variable values x (as in SystemConstraintWrapper.Eval(x, &y)), update part of the context with the value of x.

The user could define either a generic functor or using a generic lambda as UpdateContextFromDecisionVariablesFunction. For a generic functor, one example is

struct Foo {
template <typename T>
void operator()(const System<T>&, const Eigen::Ref<const VectorX<T>>&,
Context<T>*) {}
};

A generic lambda can take the form

auto foo = [](const auto& system, const auto& vars, auto* context) {}

The users can refer to system_constraint_wrapper_test.cc and system_constraint_adapter_test.cc for more details.

Enumeration Type Documentation

◆ InputPortSelection

enum InputPortSelection
strong

Intended for use in e.g.

variant<InputPortSelection, InputPortIndex> for algorithms that support optional and/or default port indices.

Enumerator
kNoInput 
kUseFirstInputIfItExists 

◆ OutputPortSelection

enum OutputPortSelection
strong

Intended for use in e.g.

variant<OutputPortSelection, OutputPortIndex> for algorithms that support optional and/or default port indices.

Enumerator
kNoOutput 
kUseFirstOutputIfItExists 

◆ PerceptronActivationType

Specifies one of the common activation functions in a neural network.

Enumerator
kIdentity 
kReLU 
kTanh 

◆ PortDataType

All system ports are either vectors of Eigen scalars, or black-box AbstractValues which may contain any type.

Enumerator
kVectorValued 
kAbstractValued 

◆ SystemConstraintType

enum SystemConstraintType
strong

The form of a SystemConstraint.

Enumerator
kEquality 

The constraint is of the form f(x)=0.

kInequality 

The constraint is of the form lower_bound <= f(x) <= upper_bound.

◆ TriggerType

enum TriggerType
strong

Predefined types of triggers for events.

Used at run time to determine why the associated event has occurred.

Enumerator
kUnknown 
kInitialization 

This trigger indicates that an associated event is triggered at system initialization.

kForced 

This trigger indicates that an associated event is triggered by directly calling the corresponding public system API for event handling (e.g.

Publish(context)).

kTimed 

This trigger indicates that an associated event is triggered by the system proceeding to a single, arbitrary time.

Timed events are commonly created in System::CalcNextUpdateTime().

kPeriodic 

This type indicates that an associated event is triggered by the system proceeding to a time t ∈ {tᵢ = t₀ + p * i} for some period p, time offset t₀, and i is a non-negative integer.

See also
PeriodicEventData. Periodic events are commonly created in System::CalcNextUpdateTime().
kPerStep 

This trigger indicates that an associated event is triggered whenever a solver takes a step.

A solver is an abstract construct that controls or tracks the time and state evolution of a System. A simulator is a solver- it advances time a finite duration by integrating a system, modifying its state accordingly- as is a process that receives some numeric state from IPC that is then used to, e.g., update abstract state. Steps may occur at irregular time intervals: a step typically coincides with a point in time where it is advantageous to poll for events, like immediately after an integrator has advanced time and state.

Per-step events are most commonly created in System::GetPerStepEvents(). A very common use of such per-step events is to update a discrete or abstract state variable that changes whenever the continuous state advances; examples are computing the "min" or "max" of some state variable, recording a signal in a delay buffer, or publishing. Per-step events are also useful to implement feedback controllers interfaced with physical devices; the controller can be implemented in the event handler, and the "step" would correspond to receiving sensory data from the hardware.

kWitness 

This trigger indicates that an associated event is triggered by the zero crossing of a witness function.

See also
WitnessTriggeredEventData.

◆ WitnessFunctionDirection

Enumerator
kNone 

This witness function will never be triggered.

kPositiveThenNonPositive 

Witness function triggers when the function crosses or touches zero after an initial positive evaluation.

kNegativeThenNonNegative 

Witness function triggers when the function crosses or touches zero after an initial negative evaluation.

kCrossesZero 

Witness function triggers any time the function crosses/touches zero, except when the witness function evaluates to zero at the beginning of the interval.

Conceptually equivalent to kPositiveThenNonNegative OR kNegativeThenNonNegative.

Function Documentation

◆ AddRandomInputs()

int drake::systems::AddRandomInputs ( double  sampling_interval_sec,
DiagramBuilder< T > *  builder 
)

For each subsystem input port in builder that is (a) not yet connected and (b) labeled as random in the InputPort, this method will add a new RandomSource system of the appropriate type and connect it to the subsystem input port.

Template Parameters
TThe scalar type, which must be one of the default nonsymbolic scalars.
Parameters
sampling_interval_secinterval to be used for all new sources.
Returns
the total number of RandomSource systems added.
See also
Stochastic Systems

◆ BatchEvalTimeDerivatives()

MatrixX<T> drake::systems::BatchEvalTimeDerivatives ( const System< T > &  system,
const Context< T > &  context,
const Eigen::Ref< const RowVectorX< T >> &  times,
const Eigen::Ref< const MatrixX< T >> &  states,
const Eigen::Ref< const MatrixX< T >> &  inputs,
std::variant< InputPortSelection, InputPortIndex input_port_index = InputPortSelection::kUseFirstInputIfItExists,
Parallelism  parallelize = Parallelism::Max() 
)

Evaluates the time derivatives of a system at many times, states, and inputs.

Each column of times, states, and inputs will be associated with a single evaluation of the dynamics. The return value will a matrix with the corresponding time derivatives in each column. Any discrete variables in context will be held constant across all evaluations.

Template Parameters
TThe scalar type of the system.
Parameters
systemThe system to evaluate.
contextA context associated with system, which can be used to pass system parameters and discrete/abstract state.
timesA 1 x N vector of times at which to evaluate the dynamics.
statesA system.num_continuous_states() x N matrix of continuous states at which to evaluate the dynamics.
inputsA num_inputs x N matrix of inputs at which to evaluate the dynamics, where num_inputs must match the size of the input port selected. If input_port_index is set to InputPortSelection::kNoInput, then the inputs argument will be ignored.
input_port_indexThe input port index to use for evaluating the dynamics. The default is to use the first input if there is one. A specific port index or kNoInput can be specified instead. The input port must be vector-valued and have the same size as the number of rows in inputs.
parallelizeThe parallelism to use for evaluating the dynamics.
Returns
A matrix with each column corresponding to the time derivatives.
Exceptions
std::exceptionif matrix shapes are inconsistent, with inputs required only if an input port is provided.

◆ BatchEvalUniquePeriodicDiscreteUpdate()

MatrixX<T> drake::systems::BatchEvalUniquePeriodicDiscreteUpdate ( const System< T > &  system,
const Context< T > &  context,
const Eigen::Ref< const RowVectorX< T >> &  times,
const Eigen::Ref< const MatrixX< T >> &  states,
const Eigen::Ref< const MatrixX< T >> &  inputs,
int  num_time_steps = 1,
std::variant< InputPortSelection, InputPortIndex input_port_index = InputPortSelection::kUseFirstInputIfItExists,
Parallelism  parallelize = Parallelism::Max() 
)

Evaluates the dynamics of a difference equation system at many times, states, and inputs.

See System<T>::EvalUniquePeriodicDiscreteUpdate().

Each column of times, states, and inputs will be associated with a single evaluation of the dynamics. The return value will be a matrix with each column corresponding to the next state of the system evaluated num_time_steps * time_step seconds after the provided time, using the time_step that is reported by System<T>::IsDifferenceEquationSystem().

Template Parameters
TThe scalar type of the system.
Parameters
systemThe system to evaluate.
contextA context associated with system, which can be used to pass system parameters.
timesA 1 x N vector of times at which to evaluate the dynamics.
statesA num_states x N matrix of states at which to evaluate the dynamics.
inputsA num_inputs x N matrix of inputs at which to evaluate the dynamics, where num_inputs must match the size of the input port selected. If input_port_index is set to InputPortSelection::kNoInput, then the inputs argument will be ignored.
num_time_stepsThe returned value will be the state at time + time_step*num_time_steps.
input_port_indexThe input port index to use for evaluating the dynamics. The default is to use the first input if there is one. A specific port index or kNoInput can be specified instead. The input port must be vector-valued and have the same size as the number of rows in inputs.
parallelizeThe parallelism to use for evaluating the dynamics.
Returns
A matrix with each column corresponding to the next state at time + num_time_steps * time_step.
Exceptions
std::exceptionif system.IsDifferenceEquationSystem() is not true.
std::exceptionif matrix shapes are inconsistent, with inputs required only if an input port is provided.

◆ is_autodiffxd_convertible() [1/2]

::testing::AssertionResult drake::systems::is_autodiffxd_convertible ( const S< double > &  dut,
Callback  callback 
)

Tests whether the given device under test of type S<double> can be converted to use AutoDiffXd as its scalar type.

If the test passes, additional checks on the converted object of type const S<AutoDiffXd>& can be passed via a lambda into callback. The Callback must take an const S<AutoDiffXd>& and return void; a typical value would be a lambda such as [](const auto& converted) { EXPECT_TRUE(converted.thing()); }.

◆ is_autodiffxd_convertible() [2/2]

::testing::AssertionResult drake::systems::is_autodiffxd_convertible ( const S< double > &  dut)

Tests whether the given device under test of type S<double> can be converted to use AutoDiffXd as its scalar type.

◆ is_symbolic_convertible() [1/2]

::testing::AssertionResult drake::systems::is_symbolic_convertible ( const S< double > &  dut,
Callback  callback 
)

Tests whether the given device under test of type S<double> can be converted to use Expression as its scalar type.

If the test passes, additional checks on the converted object of type const S<Expression>& can be passed via a lambda into callback. The Callback must take an const S<Expression>& and return void; a typical value would be a lambda such as [](const auto& converted) { EXPECT_TRUE(converted.thing()); }.

◆ is_symbolic_convertible() [2/2]

::testing::AssertionResult drake::systems::is_symbolic_convertible ( const S< double > &  dut)

Tests whether the given device under test of type S<double> can be converted to use Expression as its scalar type.

◆ LogVectorOutput() [1/2]

VectorLogSink<T>* drake::systems::LogVectorOutput ( const OutputPort< T > &  src,
DiagramBuilder< T > *  builder,
double  publish_period = 0.0 
)

LogVectorOutput provides a convenience function for adding a VectorLogSink, initialized to the correct size, and connected to an output in a DiagramBuilder.

This overload supports the default set of publish triggers. See default triggers description.

Parameters
srcthe output port to attach logging to.
builderthe diagram builder.
publish_periodPeriod that messages will be published (optional). If the publish period is zero, VectorLogSink will use per-step publishing instead; see LeafSystem::DeclarePerStepPublishEvent().
Precondition
publish_period is non-negative.

◆ LogVectorOutput() [2/2]

VectorLogSink<T>* drake::systems::LogVectorOutput ( const OutputPort< T > &  src,
DiagramBuilder< T > *  builder,
const TriggerTypeSet publish_triggers,
double  publish_period = 0.0 
)

LogVectorOutput provides a convenience function for adding a VectorLogSink, initialized to the correct size, and connected to an output in a DiagramBuilder.

This overload supports the full variety of publish trigger behavior.

Parameters
srcthe output port to attach logging to.
builderthe diagram builder.
publish_triggersSet of triggers that determine when messages will be published. Supported TriggerTypes are {kForced, kPeriodic, kPerStep}. Will throw an error if empty or if unsupported types are provided.
publish_periodPeriod that messages will be published (optional). publish_period should only be non-zero if one of the publish_triggers is kPeriodic.
Precondition
publish_period is non-negative.
publish_period > 0 if and only if publish_triggers contains kPeriodic.

◆ operator<<() [1/2]

std::ostream& drake::systems::operator<< ( std::ostream &  os,
const VectorBase< T > &  vec 
)

Allows a VectorBase<T> to be streamed into a string as though it were a RowVectorX<T>.

This is useful for debugging purposes.

◆ operator<<() [2/2]

std::ostream& drake::systems::operator<< ( std::ostream &  os,
const Context< T > &  context 
)

◆ operator==()

bool drake::systems::operator== ( const std::variant< std::string, UseDefaultName > &  value,
const UseDefaultName  
)

(Advanced.) Sugar that compares a variant against kUseDefaultName.

◆ PackValue()

std::unique_ptr<AbstractValue> drake::systems::PackValue ( value)

Makes a new AbstractValue containing the value.

◆ PrintSimulatorStatistics()

void drake::systems::PrintSimulatorStatistics ( const Simulator< T > &  simulator)

This method outputs to stdout relevant simulation statistics for a simulator that advanced the state of a system forward in time.

Parameters
[in]simulatorThe simulator to output statistics for.

◆ UnpackIntValue() [1/2]

int drake::systems::UnpackIntValue ( const AbstractValue value)

Extracts an integer from the given value, or aborts if the value does not contain an integer.

◆ UnpackIntValue() [2/2]

int drake::systems::UnpackIntValue ( const AbstractValue value)

Extracts an integer from the given value, or aborts if the value does not contain an integer.

◆ UnpackValue()

T drake::systems::UnpackValue ( const AbstractValue value)

Extracts data of type T from the given value, or throws if the value does not contain type T.

Variable Documentation

◆ kUseDefaultName

constexpr UseDefaultName kUseDefaultName = {}

Name to use when you want a default one generated.

You should normally give meaningful names to all Drake System entities you create rather than using this.