pydrake.systems.framework

Bindings for the core Systems framework.

class pydrake.systems.framework.AbstractParameterIndex
__init__(self: pydrake.systems.framework.AbstractParameterIndex, arg0: int) → None

Default constructor; the result is an invalid index. This only exists to serve applications which require a default constructor.

is_valid(self: pydrake.systems.framework.AbstractParameterIndex) → bool

Reports if the index is valid–the only operation on an invalid index that doesn’t throw an exception in Debug builds.

class pydrake.systems.framework.AbstractStateIndex
__init__(self: pydrake.systems.framework.AbstractStateIndex, arg0: int) → None

Default constructor; the result is an invalid index. This only exists to serve applications which require a default constructor.

is_valid(self: pydrake.systems.framework.AbstractStateIndex) → bool

Reports if the index is valid–the only operation on an invalid index that doesn’t throw an exception in Debug builds.

class pydrake.systems.framework.AbstractValues

AbstractValues is a container for non-numerical state and parameters. It may or may not own the underlying data, and therefore is suitable for both leaf Systems and diagrams.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.AbstractValues) -> None

Constructs an empty AbstractValues.

  1. __init__(self: pydrake.systems.framework.AbstractValues, arg0: List[pydrake.common.value.AbstractValue]) -> None

Constructs an AbstractValues that does not own the underlying data.

Clone(self: pydrake.systems.framework.AbstractValues) → pydrake.systems.framework.AbstractValues
get_mutable_value(self: pydrake.systems.framework.AbstractValues, index: int) → pydrake.common.value.AbstractValue

Returns the element of AbstractValues at the given index, or aborts if the index is out-of-bounds.

get_value(self: pydrake.systems.framework.AbstractValues, index: int) → pydrake.common.value.AbstractValue

Returns the element of AbstractValues at the given index, or aborts if the index is out-of-bounds.

SetFrom(self: pydrake.systems.framework.AbstractValues, arg0: pydrake.systems.framework.AbstractValues) → None

Copies all of the AbstractValues in other into this. Asserts if the two are not equal in size.

Raises:RuntimeError if any of the elements are of incompatible type.
size(self: pydrake.systems.framework.AbstractValues) → int

Returns the number of elements of AbstractValues.

pydrake.systems.framework.BasicVector

alias of pydrake.systems.framework.BasicVector_[float]

template pydrake.systems.framework.BasicVector_

Instantiations: BasicVector_[float], BasicVector_[AutoDiffXd], BasicVector_[Expression]

class BasicVector_[float]

Bases: pydrake.systems.framework.VectorBase_[float]

BasicVector is a semantics-free wrapper around an Eigen vector that satisfies VectorBase. Once constructed, its size is fixed.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.BasicVector_[float], data: numpy.ndarray[numpy.float64[m, 1]]) -> None

Constructs a BasicVector with the specified vec data.

  1. __init__(self: pydrake.systems.framework.BasicVector_[float], size: int) -> None

Initializes with the given size using the drake::dummy_value<T>, which is NaN when T = double.

Clone(self: pydrake.systems.framework.BasicVector_[float]) → pydrake.systems.framework.BasicVector_[float]
get_mutable_value(self: pydrake.systems.framework.BasicVector_[float]) → numpy.ndarray[numpy.float64[m, 1], flags.writeable]

Returns the entire vector as a mutable Eigen::VectorBlock, which allows mutation of the values, but does not allow resizing the vector itself.

get_value(self: pydrake.systems.framework.BasicVector_[float]) → numpy.ndarray[numpy.float64[m, 1]]

Returns the entire vector as a const Eigen::VectorBlock.

set_value(self: pydrake.systems.framework.BasicVector_[float], arg0: numpy.ndarray[numpy.float64[m, 1]]) → None

Sets the vector to the given value. After a.set_value(b.get_value()), a must be identical to b.

Raises:RuntimeError if the new value has different dimensions.
class pydrake.systems.framework.BasicVector_[AutoDiffXd]

Bases: pydrake.systems.framework.VectorBase_[AutoDiffXd]

BasicVector is a semantics-free wrapper around an Eigen vector that satisfies VectorBase. Once constructed, its size is fixed.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.BasicVector_[AutoDiffXd], data: numpy.ndarray[object[m, 1]]) -> None

Constructs a BasicVector with the specified vec data.

  1. __init__(self: pydrake.systems.framework.BasicVector_[AutoDiffXd], size: int) -> None

Initializes with the given size using the drake::dummy_value<T>, which is NaN when T = double.

Clone(self: pydrake.systems.framework.BasicVector_[AutoDiffXd]) → pydrake.systems.framework.BasicVector_[AutoDiffXd]
get_mutable_value(self: pydrake.systems.framework.BasicVector_[AutoDiffXd]) → numpy.ndarray[object[m, 1], flags.writeable]

Returns the entire vector as a mutable Eigen::VectorBlock, which allows mutation of the values, but does not allow resizing the vector itself.

get_value(self: pydrake.systems.framework.BasicVector_[AutoDiffXd]) → numpy.ndarray[object[m, 1]]

Returns the entire vector as a const Eigen::VectorBlock.

set_value(self: pydrake.systems.framework.BasicVector_[AutoDiffXd], arg0: numpy.ndarray[object[m, 1]]) → None

Sets the vector to the given value. After a.set_value(b.get_value()), a must be identical to b.

Raises:RuntimeError if the new value has different dimensions.
class pydrake.systems.framework.BasicVector_[Expression]

Bases: pydrake.systems.framework.VectorBase_[Expression]

BasicVector is a semantics-free wrapper around an Eigen vector that satisfies VectorBase. Once constructed, its size is fixed.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.BasicVector_[Expression], data: numpy.ndarray[object[m, 1]]) -> None

Constructs a BasicVector with the specified vec data.

  1. __init__(self: pydrake.systems.framework.BasicVector_[Expression], size: int) -> None

Initializes with the given size using the drake::dummy_value<T>, which is NaN when T = double.

Clone(self: pydrake.systems.framework.BasicVector_[Expression]) → pydrake.systems.framework.BasicVector_[Expression]
get_mutable_value(self: pydrake.systems.framework.BasicVector_[Expression]) → numpy.ndarray[object[m, 1], flags.writeable]

Returns the entire vector as a mutable Eigen::VectorBlock, which allows mutation of the values, but does not allow resizing the vector itself.

get_value(self: pydrake.systems.framework.BasicVector_[Expression]) → numpy.ndarray[object[m, 1]]

Returns the entire vector as a const Eigen::VectorBlock.

set_value(self: pydrake.systems.framework.BasicVector_[Expression], arg0: numpy.ndarray[object[m, 1]]) → None

Sets the vector to the given value. After a.set_value(b.get_value()), a must be identical to b.

Raises:RuntimeError if the new value has different dimensions.
class pydrake.systems.framework.BasicVector_[float]

Bases: pydrake.systems.framework.VectorBase_[float]

BasicVector is a semantics-free wrapper around an Eigen vector that satisfies VectorBase. Once constructed, its size is fixed.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.BasicVector_[float], data: numpy.ndarray[numpy.float64[m, 1]]) -> None

Constructs a BasicVector with the specified vec data.

  1. __init__(self: pydrake.systems.framework.BasicVector_[float], size: int) -> None

Initializes with the given size using the drake::dummy_value<T>, which is NaN when T = double.

Clone(self: pydrake.systems.framework.BasicVector_[float]) → pydrake.systems.framework.BasicVector_[float]
get_mutable_value(self: pydrake.systems.framework.BasicVector_[float]) → numpy.ndarray[numpy.float64[m, 1], flags.writeable]

Returns the entire vector as a mutable Eigen::VectorBlock, which allows mutation of the values, but does not allow resizing the vector itself.

get_value(self: pydrake.systems.framework.BasicVector_[float]) → numpy.ndarray[numpy.float64[m, 1]]

Returns the entire vector as a const Eigen::VectorBlock.

set_value(self: pydrake.systems.framework.BasicVector_[float], arg0: numpy.ndarray[numpy.float64[m, 1]]) → None

Sets the vector to the given value. After a.set_value(b.get_value()), a must be identical to b.

Raises:RuntimeError if the new value has different dimensions.
class pydrake.systems.framework.CacheIndex
__init__(self: pydrake.systems.framework.CacheIndex, arg0: int) → None

Default constructor; the result is an invalid index. This only exists to serve applications which require a default constructor.

is_valid(self: pydrake.systems.framework.CacheIndex) → bool

Reports if the index is valid–the only operation on an invalid index that doesn’t throw an exception in Debug builds.

pydrake.systems.framework.Context

alias of pydrake.systems.framework.Context_[float]

template pydrake.systems.framework.Context_

Instantiations: Context_[float], Context_[AutoDiffXd], Context_[Expression]

class Context_[float]

%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. There are also type-erased abstract state variables, abstract-valued input ports, abstract parameters, and a double accuracy setting. The framework provides two concrete subclasses of Context: LeafContext (for leaf Systems) and DiagramContext (for composite System Diagrams). Users are forbidden to extend DiagramContext and are discouraged from subclassing LeafContext.

A Context is designed to be used only with the System that created it. State and Parameter data can be copied between contexts for compatible systems as necessary.

__init__

Initialize self. See help(type(self)) for accurate signature.

Clone(self: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.Context_[float]

Returns a deep copy of this Context.

Raises:RuntimeError if this is not the root context.
DisableCaching(self: pydrake.systems.framework.Context_[float]) → None

(Debugging) Disables caching recursively for this context and all its subcontexts. Disabling forces every Eval() method to perform a full calculation rather than returning the cached one. Results should be identical with or without caching, except for performance. If they are not, there is likely a problem with (a) the specified dependencies for some calculation, or (b) a misuse of references into cached values that hides modifications from the caching system, or (c) a bug in the caching system. The is_disabled flags are independent of the out_of_date flags, which continue to be maintained even when caching is disabled (though they are ignored).

EnableCaching(self: pydrake.systems.framework.Context_[float]) → None

(Debugging) Re-enables caching recursively for this context and all its subcontexts. The is_disabled flags are independent of the out_of_date flags, which continue to be maintained even when caching is disabled (though they are ignored). Hence re-enabling the cache with this method may result in some entries being already considered up to date. See SetAllCacheEntriesOutOfDate() if you want to ensure that caching restarts with everything out of date. You might want to do that, for example, for repeatability or because you modified something in the debugger and want to make sure it gets used.

FreezeCache(self: pydrake.systems.framework.Context_[float]) → None

(Advanced) Freezes the cache at its current contents, preventing any further cache updates. When frozen, accessing an out-of-date cache entry causes an exception to be throw. This is applied recursively to this Context and all its subcontexts, but not to its parent or siblings so it is most useful when called on the root Context. If the cache was already frozen this method does nothing but waste a little time.

get_abstract_parameter(self: pydrake.systems.framework.Context_[float], index: int) → pydrake.common.value.AbstractValue

Returns a const reference to the vector-valued parameter at index.

Precondition:
index must identify an existing parameter.
get_abstract_state(*args, **kwargs)

Overloaded function.

  1. get_abstract_state(self: pydrake.systems.framework.Context_[float]) -> pydrake.systems.framework.AbstractValues

Returns a const reference to the abstract component of the state, which may be of size zero.

  1. get_abstract_state(self: pydrake.systems.framework.Context_[float], index: int) -> pydrake.common.value.AbstractValue

Returns a const reference to the abstract component of the state at index.

Precondition:
index must identify an existing element.
Precondition:
the abstract state’s type must match the template argument.
get_accuracy(self: pydrake.systems.framework.Context_[float]) → Optional[float]

Returns the accuracy setting (if any). Note that the return type is optional<double> rather than the double value itself.

See also

SetAccuracy() for details.

get_continuous_state(self: pydrake.systems.framework.Context_[float]) → drake::systems::ContinuousState<double>

Returns a const reference to the continuous component of the state, which may be of size zero.

get_continuous_state_vector(self: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a reference to the continuous state vector, devoid of second-order structure. The vector may be of size zero.

get_discrete_state(*args, **kwargs)

Overloaded function.

  1. get_discrete_state(self: pydrake.systems.framework.Context_[float]) -> drake::systems::DiscreteValues<double>

Returns a reference to the entire discrete state, which may consist of multiple discrete state vectors (groups).

  1. get_discrete_state(self: pydrake.systems.framework.Context_[float], arg0: int) -> pydrake.systems.framework.BasicVector_[float]

Returns a const reference to group (vector) index of the discrete state.

Precondition:
index must identify an existing group.
get_discrete_state_vector(self: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.BasicVector_[float]

Returns a reference to the only discrete state vector. The vector may be of size zero.

Precondition:
There is only one discrete state group.
get_mutable_abstract_parameter(self: pydrake.systems.framework.Context_[float], index: int) → pydrake.common.value.AbstractValue

Returns a mutable reference to element index of the abstract-valued parameters. Sends out of date notifications for all computations dependent on this parameter.

Precondition:
index must identify an existing abstract parameter.

Note

Currently notifies dependents of all abstract parameters.

get_mutable_abstract_state(*args, **kwargs)

Overloaded function.

  1. get_mutable_abstract_state(self: pydrake.systems.framework.Context_[float]) -> pydrake.systems.framework.AbstractValues

Returns a mutable reference to the abstract component of the state, which may be of size zero. Sends out of date notifications for all abstract-state-dependent computations.

  1. get_mutable_abstract_state(self: pydrake.systems.framework.Context_[float], index: int) -> pydrake.common.value.AbstractValue

Returns a mutable reference to element index of the abstract state. Sends out of date notifications for all computations that depend on this abstract state variable.

Precondition:
index must identify an existing element.
Precondition:
the abstract state’s type must match the template argument.

Note

Currently notifies dependents of any abstract state variable.

get_mutable_continuous_state(self: pydrake.systems.framework.Context_[float]) → drake::systems::ContinuousState<double>

Returns a mutable reference to the continuous component of the state, which may be of size zero. Sends out of date notifications for all continuous-state-dependent computations.

get_mutable_continuous_state_vector(self: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a mutable reference to the continuous state vector, devoid of second-order structure. The vector may be of size zero. Sends out of date notifications for all continuous-state-dependent computations.

get_mutable_discrete_state(*args, **kwargs)

Overloaded function.

  1. get_mutable_discrete_state(self: pydrake.systems.framework.Context_[float]) -> drake::systems::DiscreteValues<double>

Returns a mutable reference to the discrete component of the state, which may be of size zero. Sends out of date notifications for all discrete-state-dependent computations.

  1. get_mutable_discrete_state(self: pydrake.systems.framework.Context_[float], arg0: int) -> pydrake.systems.framework.BasicVector_[float]

Returns a mutable reference to group (vector) index of the discrete state. Sends out of date notifications for all computations that depend on this discrete state group.

Precondition:
index must identify an existing group.

Note

Currently notifies dependents of all groups.

get_mutable_discrete_state_vector(self: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.BasicVector_[float]

Returns a mutable reference to the only discrete state vector. Sends out of date notifications for all discrete-state-dependent computations.

See also

get_discrete_state_vector().

Precondition:
There is only one discrete state group.
get_mutable_numeric_parameter(self: pydrake.systems.framework.Context_[float], index: int) → pydrake.systems.framework.BasicVector_[float]

Returns a mutable reference to element index of the vector-valued (numeric) parameters. Sends out of date notifications for all computations dependent on this parameter.

Precondition:
index must identify an existing numeric parameter.

Note

Currently notifies dependents of all numeric parameters.

get_mutable_parameters(self: pydrake.systems.framework.Context_[float]) → drake::systems::Parameters<double>

Returns a mutable reference to this Context’s parameters. Sends out of date notifications for all parameter-dependent computations. If you don’t mean to change all the parameters, use the indexed methods to modify only some of the parameters so that fewer computations are invalidated and fewer notifications need be sent.

get_mutable_state(self: pydrake.systems.framework.Context_[float]) → drake::systems::State<double>

Returns a mutable reference to the whole State, potentially invalidating all state-dependent computations so requiring out of date notifications to be made for all such computations. If you don’t mean to change the whole state, use more focused methods to modify only a portion of the state. See class documentation for more information.

get_numeric_parameter(self: pydrake.systems.framework.Context_[float], index: int) → pydrake.systems.framework.BasicVector_[float]

Returns a const reference to the vector-valued parameter at index.

Precondition:
index must identify an existing parameter.
get_parameters(self: pydrake.systems.framework.Context_[float]) → drake::systems::Parameters<double>

Returns a const reference to this Context’s parameters.

get_state(self: pydrake.systems.framework.Context_[float]) → drake::systems::State<double>

Returns a const reference to the whole State.

get_time(self: pydrake.systems.framework.Context_[float]) → float

Returns the current time in seconds.

See also

SetTime()

has_only_continuous_state(self: pydrake.systems.framework.Context_[float]) → bool

Returns true if the Context has continuous state, but no discrete or abstract state.

has_only_discrete_state(self: pydrake.systems.framework.Context_[float]) → bool

Returns true if the Context has discrete state, but no continuous or abstract state.

is_cache_frozen(self: pydrake.systems.framework.Context_[float]) → bool

(Advanced) Reports whether this Context’s cache is currently frozen. This checks only locally; it is possible that parent, child, or sibling subcontext caches are in a different state than this one.

is_stateless(self: pydrake.systems.framework.Context_[float]) → bool

Returns true if the Context has no state.

num_abstract_parameters(self: pydrake.systems.framework.Context_[float]) → int

Returns the number of abstract-valued parameters.

num_abstract_states(self: pydrake.systems.framework.Context_[float]) → int

Returns the number of elements in the abstract state.

num_continuous_states(self: pydrake.systems.framework.Context_[float]) → int

Returns the number of continuous state variables xc = {q, v, z}.

num_discrete_state_groups(self: pydrake.systems.framework.Context_[float]) → int

Returns the number of vectors (groups) in the discrete state.

num_input_ports(self: pydrake.systems.framework.Context_[float]) → int

Returns the number of input ports in this context.

num_numeric_parameter_groups(self: pydrake.systems.framework.Context_[float]) → int

Returns the number of vector-valued parameters.

num_output_ports(self: pydrake.systems.framework.Context_[float]) → int

Returns the number of output ports represented in this context.

num_total_states(self: pydrake.systems.framework.Context_[float]) → int

Returns the total dimension of all of the basic vector states (as if they were muxed).

Raises:RuntimeError if the system contains any abstract state.
SetAbstractState(self: object, index: int, value: object) → None

Sets the value of the abstract state variable selected by index. Sends out of date notifications for all computations that depend on that abstract state variable. The template type will be inferred and need not be specified explicitly.

Precondition:
index must identify an existing abstract state variable.
Precondition:
the abstract state’s type must match the template argument.

Note

Currently notifies dependents of any abstract state variable.

SetAccuracy(self: pydrake.systems.framework.Context_[float], accuracy: Optional[float]) → None

Records the user’s requested accuracy, which is a unit-less quantity designed for use with simulation and other numerical studies. Since accuracy is unit-less, algorithms and systems are free to interpret this quantity as they wish. The intention is that more computational work is acceptable as the accuracy setting is tightened (set closer to zero). If no accuracy is requested, computations are free to choose suitable defaults, or to refuse to proceed without an explicit accuracy setting. The accuracy of a complete simulation or other numerical study depends on the accuracy of all contributing computations, so it is important that each computation is done in accordance with the requested accuracy. Some examples of where this is needed: - Error-controlled numerical integrators use the accuracy setting to decide what step sizes to take. - The Simulator employs a numerical integrator, but also uses accuracy to decide how precisely to isolate witness function zero crossings. - Iterative calculations reported as results or cached internally depend on accuracy to decide how strictly to converge the results. Examples of these are: constraint projection, calculation of distances between smooth shapes, and deformation calculations for soft contact.

The common thread among these examples is that they all share the same Context, so by keeping accuracy here it can be used effectively to control all accuracy-dependent computations.

Any accuracy-dependent computation in this Context and its subcontexts may be invalidated by a change to the accuracy setting, so out of date notifications are sent to all such computations (at least if the accuracy setting has actually changed). Accuracy must have the same value in every subcontext within the same context tree so may only be modified at the root context of a tree.

Requested accuracy is stored in the Context for two reasons: - It permits all computations performed over a System to see the same accuracy request since accuracy is stored in one shared place, and - it allows us to notify accuracy-dependent cached results that they are out of date when the accuracy setting changes.

Raises:RuntimeError if this is not the root context.
SetAllCacheEntriesOutOfDate(self: pydrake.systems.framework.Context_[float]) → None

(Debugging) Marks all cache entries out of date, recursively for this context and all its subcontexts. This forces the next Eval() request for each cache entry to perform a full calculation rather than returning the cached one. After that first recalculation, normal caching behavior resumes (assuming the cache is not disabled). Results should be identical whether this is called or not, since the caching system should be maintaining this flag correctly. If they are not, see the documentation for SetIsCacheDisabled() for suggestions.

SetContinuousState(self: pydrake.systems.framework.Context_[float], arg0: numpy.ndarray[numpy.float64[m, 1]]) → None

Sets the continuous state to xc, including q, v, and z partitions. The supplied vector must be the same size as the existing continuous state. Sends out of date notifications for all continuous-state-dependent computations.

SetDiscreteState(*args, **kwargs)

Overloaded function.

  1. SetDiscreteState(self: pydrake.systems.framework.Context_[float], xd: numpy.ndarray[numpy.float64[m, 1]]) -> None

Sets the discrete state to xd, assuming there is just one discrete state group. The supplied vector must be the same size as the existing discrete state. Sends out of date notifications for all discrete-state-dependent computations. Use the other signature for this method if you have multiple discrete state groups.

Precondition:
There is exactly one discrete state group.
  1. SetDiscreteState(self: pydrake.systems.framework.Context_[float], group_index: int, xd: numpy.ndarray[numpy.float64[m, 1]]) -> None

Sets the discrete state group indicated by group_index to xd. The supplied vector xd must be the same size as the existing discrete state group. Sends out of date notifications for all computations that depend on this discrete state group.

Precondition:
group_index identifies an existing group.

Note

Currently notifies dependents of all groups.

SetTime(self: pydrake.systems.framework.Context_[float], time_sec: float) → None

Sets the current time in seconds. Sends out of date notifications for all time-dependent computations (at least if the time has actually changed). Time must have the same value in every subcontext within the same Diagram context tree so may only be modified at the root context of the tree.

Raises:RuntimeError if this is not the root context.
SetTimeAndContinuousState(self: pydrake.systems.framework.Context_[float], arg0: float, arg1: numpy.ndarray[numpy.float64[m, 1]]) → None

Sets time to time_sec and continuous state to xc. Performs a single notification sweep to avoid duplicate notifications for computations that depend on both time and state.

Raises:RuntimeError if this is not the root context.
SetTimeStateAndParametersFrom(*args, **kwargs)

Overloaded function.

  1. SetTimeStateAndParametersFrom(self: pydrake.systems.framework.Context_[float], source: pydrake.systems.framework.Context_[float]) -> None

Copies time, accuracy, all state and all parameters in source, where numerical values are of type U, to this context. This method can only be called on root contexts because time and accuracy are copied. Sends out of date notifications for all dependent computations in this context.

Raises:RuntimeError if this is not the root context.

Note

Currently does not copy fixed input port values from source. See System::FixInputPortsFrom() if you want to copy those.

See also

SetStateAndParametersFrom() if you want to copy state and parameters to a non-root context.

  1. SetTimeStateAndParametersFrom(self: pydrake.systems.framework.Context_[float], source: drake::systems::Context<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >) -> None

Copies time, accuracy, all state and all parameters in source, where numerical values are of type U, to this context. This method can only be called on root contexts because time and accuracy are copied. Sends out of date notifications for all dependent computations in this context.

Raises:RuntimeError if this is not the root context.

Note

Currently does not copy fixed input port values from source. See System::FixInputPortsFrom() if you want to copy those.

See also

SetStateAndParametersFrom() if you want to copy state and parameters to a non-root context.

  1. SetTimeStateAndParametersFrom(self: pydrake.systems.framework.Context_[float], source: drake::systems::Context<drake::symbolic::Expression>) -> None

Copies time, accuracy, all state and all parameters in source, where numerical values are of type U, to this context. This method can only be called on root contexts because time and accuracy are copied. Sends out of date notifications for all dependent computations in this context.

Raises:RuntimeError if this is not the root context.

Note

Currently does not copy fixed input port values from source. See System::FixInputPortsFrom() if you want to copy those.

See also

SetStateAndParametersFrom() if you want to copy state and parameters to a non-root context.

UnfreezeCache(self: pydrake.systems.framework.Context_[float]) → None

(Advanced) Unfreezes the cache if it was previously frozen. This is applied recursively to this Context and all its subcontexts, but not to its parent or siblings. If the cache was not frozen, this does nothing but waste a little time.

class pydrake.systems.framework.Context_[AutoDiffXd]

%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. There are also type-erased abstract state variables, abstract-valued input ports, abstract parameters, and a double accuracy setting. The framework provides two concrete subclasses of Context: LeafContext (for leaf Systems) and DiagramContext (for composite System Diagrams). Users are forbidden to extend DiagramContext and are discouraged from subclassing LeafContext.

A Context is designed to be used only with the System that created it. State and Parameter data can be copied between contexts for compatible systems as necessary.

__init__

Initialize self. See help(type(self)) for accurate signature.

Clone(self: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.systems.framework.Context_[AutoDiffXd]

Returns a deep copy of this Context.

Raises:RuntimeError if this is not the root context.
DisableCaching(self: pydrake.systems.framework.Context_[AutoDiffXd]) → None

(Debugging) Disables caching recursively for this context and all its subcontexts. Disabling forces every Eval() method to perform a full calculation rather than returning the cached one. Results should be identical with or without caching, except for performance. If they are not, there is likely a problem with (a) the specified dependencies for some calculation, or (b) a misuse of references into cached values that hides modifications from the caching system, or (c) a bug in the caching system. The is_disabled flags are independent of the out_of_date flags, which continue to be maintained even when caching is disabled (though they are ignored).

EnableCaching(self: pydrake.systems.framework.Context_[AutoDiffXd]) → None

(Debugging) Re-enables caching recursively for this context and all its subcontexts. The is_disabled flags are independent of the out_of_date flags, which continue to be maintained even when caching is disabled (though they are ignored). Hence re-enabling the cache with this method may result in some entries being already considered up to date. See SetAllCacheEntriesOutOfDate() if you want to ensure that caching restarts with everything out of date. You might want to do that, for example, for repeatability or because you modified something in the debugger and want to make sure it gets used.

FreezeCache(self: pydrake.systems.framework.Context_[AutoDiffXd]) → None

(Advanced) Freezes the cache at its current contents, preventing any further cache updates. When frozen, accessing an out-of-date cache entry causes an exception to be throw. This is applied recursively to this Context and all its subcontexts, but not to its parent or siblings so it is most useful when called on the root Context. If the cache was already frozen this method does nothing but waste a little time.

get_abstract_parameter(self: pydrake.systems.framework.Context_[AutoDiffXd], index: int) → pydrake.common.value.AbstractValue

Returns a const reference to the vector-valued parameter at index.

Precondition:
index must identify an existing parameter.
get_abstract_state(*args, **kwargs)

Overloaded function.

  1. get_abstract_state(self: pydrake.systems.framework.Context_[AutoDiffXd]) -> pydrake.systems.framework.AbstractValues

Returns a const reference to the abstract component of the state, which may be of size zero.

  1. get_abstract_state(self: pydrake.systems.framework.Context_[AutoDiffXd], index: int) -> pydrake.common.value.AbstractValue

Returns a const reference to the abstract component of the state at index.

Precondition:
index must identify an existing element.
Precondition:
the abstract state’s type must match the template argument.
get_accuracy(self: pydrake.systems.framework.Context_[AutoDiffXd]) → Optional[float]

Returns the accuracy setting (if any). Note that the return type is optional<double> rather than the double value itself.

See also

SetAccuracy() for details.

get_continuous_state(self: pydrake.systems.framework.Context_[AutoDiffXd]) → drake::systems::ContinuousState<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Returns a const reference to the continuous component of the state, which may be of size zero.

get_continuous_state_vector(self: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.systems.framework.VectorBase_[AutoDiffXd]

Returns a reference to the continuous state vector, devoid of second-order structure. The vector may be of size zero.

get_discrete_state(*args, **kwargs)

Overloaded function.

  1. get_discrete_state(self: pydrake.systems.framework.Context_[AutoDiffXd]) -> drake::systems::DiscreteValues<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Returns a reference to the entire discrete state, which may consist of multiple discrete state vectors (groups).

  1. get_discrete_state(self: pydrake.systems.framework.Context_[AutoDiffXd], arg0: int) -> pydrake.systems.framework.BasicVector_[AutoDiffXd]

Returns a const reference to group (vector) index of the discrete state.

Precondition:
index must identify an existing group.
get_discrete_state_vector(self: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.systems.framework.BasicVector_[AutoDiffXd]

Returns a reference to the only discrete state vector. The vector may be of size zero.

Precondition:
There is only one discrete state group.
get_mutable_abstract_parameter(self: pydrake.systems.framework.Context_[AutoDiffXd], index: int) → pydrake.common.value.AbstractValue

Returns a mutable reference to element index of the abstract-valued parameters. Sends out of date notifications for all computations dependent on this parameter.

Precondition:
index must identify an existing abstract parameter.

Note

Currently notifies dependents of all abstract parameters.

get_mutable_abstract_state(*args, **kwargs)

Overloaded function.

  1. get_mutable_abstract_state(self: pydrake.systems.framework.Context_[AutoDiffXd]) -> pydrake.systems.framework.AbstractValues

Returns a mutable reference to the abstract component of the state, which may be of size zero. Sends out of date notifications for all abstract-state-dependent computations.

  1. get_mutable_abstract_state(self: pydrake.systems.framework.Context_[AutoDiffXd], index: int) -> pydrake.common.value.AbstractValue

Returns a mutable reference to element index of the abstract state. Sends out of date notifications for all computations that depend on this abstract state variable.

Precondition:
index must identify an existing element.
Precondition:
the abstract state’s type must match the template argument.

Note

Currently notifies dependents of any abstract state variable.

get_mutable_continuous_state(self: pydrake.systems.framework.Context_[AutoDiffXd]) → drake::systems::ContinuousState<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Returns a mutable reference to the continuous component of the state, which may be of size zero. Sends out of date notifications for all continuous-state-dependent computations.

get_mutable_continuous_state_vector(self: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.systems.framework.VectorBase_[AutoDiffXd]

Returns a mutable reference to the continuous state vector, devoid of second-order structure. The vector may be of size zero. Sends out of date notifications for all continuous-state-dependent computations.

get_mutable_discrete_state(*args, **kwargs)

Overloaded function.

  1. get_mutable_discrete_state(self: pydrake.systems.framework.Context_[AutoDiffXd]) -> drake::systems::DiscreteValues<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Returns a mutable reference to the discrete component of the state, which may be of size zero. Sends out of date notifications for all discrete-state-dependent computations.

  1. get_mutable_discrete_state(self: pydrake.systems.framework.Context_[AutoDiffXd], arg0: int) -> pydrake.systems.framework.BasicVector_[AutoDiffXd]

Returns a mutable reference to group (vector) index of the discrete state. Sends out of date notifications for all computations that depend on this discrete state group.

Precondition:
index must identify an existing group.

Note

Currently notifies dependents of all groups.

get_mutable_discrete_state_vector(self: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.systems.framework.BasicVector_[AutoDiffXd]

Returns a mutable reference to the only discrete state vector. Sends out of date notifications for all discrete-state-dependent computations.

See also

get_discrete_state_vector().

Precondition:
There is only one discrete state group.
get_mutable_numeric_parameter(self: pydrake.systems.framework.Context_[AutoDiffXd], index: int) → pydrake.systems.framework.BasicVector_[AutoDiffXd]

Returns a mutable reference to element index of the vector-valued (numeric) parameters. Sends out of date notifications for all computations dependent on this parameter.

Precondition:
index must identify an existing numeric parameter.

Note

Currently notifies dependents of all numeric parameters.

get_mutable_parameters(self: pydrake.systems.framework.Context_[AutoDiffXd]) → drake::systems::Parameters<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Returns a mutable reference to this Context’s parameters. Sends out of date notifications for all parameter-dependent computations. If you don’t mean to change all the parameters, use the indexed methods to modify only some of the parameters so that fewer computations are invalidated and fewer notifications need be sent.

get_mutable_state(self: pydrake.systems.framework.Context_[AutoDiffXd]) → drake::systems::State<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Returns a mutable reference to the whole State, potentially invalidating all state-dependent computations so requiring out of date notifications to be made for all such computations. If you don’t mean to change the whole state, use more focused methods to modify only a portion of the state. See class documentation for more information.

get_numeric_parameter(self: pydrake.systems.framework.Context_[AutoDiffXd], index: int) → pydrake.systems.framework.BasicVector_[AutoDiffXd]

Returns a const reference to the vector-valued parameter at index.

Precondition:
index must identify an existing parameter.
get_parameters(self: pydrake.systems.framework.Context_[AutoDiffXd]) → drake::systems::Parameters<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Returns a const reference to this Context’s parameters.

get_state(self: pydrake.systems.framework.Context_[AutoDiffXd]) → drake::systems::State<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Returns a const reference to the whole State.

get_time(self: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.autodiffutils.AutoDiffXd

Returns the current time in seconds.

See also

SetTime()

has_only_continuous_state(self: pydrake.systems.framework.Context_[AutoDiffXd]) → bool

Returns true if the Context has continuous state, but no discrete or abstract state.

has_only_discrete_state(self: pydrake.systems.framework.Context_[AutoDiffXd]) → bool

Returns true if the Context has discrete state, but no continuous or abstract state.

is_cache_frozen(self: pydrake.systems.framework.Context_[AutoDiffXd]) → bool

(Advanced) Reports whether this Context’s cache is currently frozen. This checks only locally; it is possible that parent, child, or sibling subcontext caches are in a different state than this one.

is_stateless(self: pydrake.systems.framework.Context_[AutoDiffXd]) → bool

Returns true if the Context has no state.

num_abstract_parameters(self: pydrake.systems.framework.Context_[AutoDiffXd]) → int

Returns the number of abstract-valued parameters.

num_abstract_states(self: pydrake.systems.framework.Context_[AutoDiffXd]) → int

Returns the number of elements in the abstract state.

num_continuous_states(self: pydrake.systems.framework.Context_[AutoDiffXd]) → int

Returns the number of continuous state variables xc = {q, v, z}.

num_discrete_state_groups(self: pydrake.systems.framework.Context_[AutoDiffXd]) → int

Returns the number of vectors (groups) in the discrete state.

num_input_ports(self: pydrake.systems.framework.Context_[AutoDiffXd]) → int

Returns the number of input ports in this context.

num_numeric_parameter_groups(self: pydrake.systems.framework.Context_[AutoDiffXd]) → int

Returns the number of vector-valued parameters.

num_output_ports(self: pydrake.systems.framework.Context_[AutoDiffXd]) → int

Returns the number of output ports represented in this context.

num_total_states(self: pydrake.systems.framework.Context_[AutoDiffXd]) → int

Returns the total dimension of all of the basic vector states (as if they were muxed).

Raises:RuntimeError if the system contains any abstract state.
SetAbstractState(self: object, index: int, value: object) → None

Sets the value of the abstract state variable selected by index. Sends out of date notifications for all computations that depend on that abstract state variable. The template type will be inferred and need not be specified explicitly.

Precondition:
index must identify an existing abstract state variable.
Precondition:
the abstract state’s type must match the template argument.

Note

Currently notifies dependents of any abstract state variable.

SetAccuracy(self: pydrake.systems.framework.Context_[AutoDiffXd], accuracy: Optional[float]) → None

Records the user’s requested accuracy, which is a unit-less quantity designed for use with simulation and other numerical studies. Since accuracy is unit-less, algorithms and systems are free to interpret this quantity as they wish. The intention is that more computational work is acceptable as the accuracy setting is tightened (set closer to zero). If no accuracy is requested, computations are free to choose suitable defaults, or to refuse to proceed without an explicit accuracy setting. The accuracy of a complete simulation or other numerical study depends on the accuracy of all contributing computations, so it is important that each computation is done in accordance with the requested accuracy. Some examples of where this is needed: - Error-controlled numerical integrators use the accuracy setting to decide what step sizes to take. - The Simulator employs a numerical integrator, but also uses accuracy to decide how precisely to isolate witness function zero crossings. - Iterative calculations reported as results or cached internally depend on accuracy to decide how strictly to converge the results. Examples of these are: constraint projection, calculation of distances between smooth shapes, and deformation calculations for soft contact.

The common thread among these examples is that they all share the same Context, so by keeping accuracy here it can be used effectively to control all accuracy-dependent computations.

Any accuracy-dependent computation in this Context and its subcontexts may be invalidated by a change to the accuracy setting, so out of date notifications are sent to all such computations (at least if the accuracy setting has actually changed). Accuracy must have the same value in every subcontext within the same context tree so may only be modified at the root context of a tree.

Requested accuracy is stored in the Context for two reasons: - It permits all computations performed over a System to see the same accuracy request since accuracy is stored in one shared place, and - it allows us to notify accuracy-dependent cached results that they are out of date when the accuracy setting changes.

Raises:RuntimeError if this is not the root context.
SetAllCacheEntriesOutOfDate(self: pydrake.systems.framework.Context_[AutoDiffXd]) → None

(Debugging) Marks all cache entries out of date, recursively for this context and all its subcontexts. This forces the next Eval() request for each cache entry to perform a full calculation rather than returning the cached one. After that first recalculation, normal caching behavior resumes (assuming the cache is not disabled). Results should be identical whether this is called or not, since the caching system should be maintaining this flag correctly. If they are not, see the documentation for SetIsCacheDisabled() for suggestions.

SetContinuousState(self: pydrake.systems.framework.Context_[AutoDiffXd], arg0: numpy.ndarray[object[m, 1]]) → None

Sets the continuous state to xc, including q, v, and z partitions. The supplied vector must be the same size as the existing continuous state. Sends out of date notifications for all continuous-state-dependent computations.

SetDiscreteState(*args, **kwargs)

Overloaded function.

  1. SetDiscreteState(self: pydrake.systems.framework.Context_[AutoDiffXd], xd: numpy.ndarray[object[m, 1]]) -> None

Sets the discrete state to xd, assuming there is just one discrete state group. The supplied vector must be the same size as the existing discrete state. Sends out of date notifications for all discrete-state-dependent computations. Use the other signature for this method if you have multiple discrete state groups.

Precondition:
There is exactly one discrete state group.
  1. SetDiscreteState(self: pydrake.systems.framework.Context_[AutoDiffXd], group_index: int, xd: numpy.ndarray[object[m, 1]]) -> None

Sets the discrete state group indicated by group_index to xd. The supplied vector xd must be the same size as the existing discrete state group. Sends out of date notifications for all computations that depend on this discrete state group.

Precondition:
group_index identifies an existing group.

Note

Currently notifies dependents of all groups.

SetTime(self: pydrake.systems.framework.Context_[AutoDiffXd], time_sec: pydrake.autodiffutils.AutoDiffXd) → None

Sets the current time in seconds. Sends out of date notifications for all time-dependent computations (at least if the time has actually changed). Time must have the same value in every subcontext within the same Diagram context tree so may only be modified at the root context of the tree.

Raises:RuntimeError if this is not the root context.
SetTimeAndContinuousState(self: pydrake.systems.framework.Context_[AutoDiffXd], arg0: pydrake.autodiffutils.AutoDiffXd, arg1: numpy.ndarray[object[m, 1]]) → None

Sets time to time_sec and continuous state to xc. Performs a single notification sweep to avoid duplicate notifications for computations that depend on both time and state.

Raises:RuntimeError if this is not the root context.
SetTimeStateAndParametersFrom(*args, **kwargs)

Overloaded function.

  1. SetTimeStateAndParametersFrom(self: pydrake.systems.framework.Context_[AutoDiffXd], source: pydrake.systems.framework.Context_[float]) -> None

Copies time, accuracy, all state and all parameters in source, where numerical values are of type U, to this context. This method can only be called on root contexts because time and accuracy are copied. Sends out of date notifications for all dependent computations in this context.

Raises:RuntimeError if this is not the root context.

Note

Currently does not copy fixed input port values from source. See System::FixInputPortsFrom() if you want to copy those.

See also

SetStateAndParametersFrom() if you want to copy state and parameters to a non-root context.

  1. SetTimeStateAndParametersFrom(self: pydrake.systems.framework.Context_[AutoDiffXd], source: pydrake.systems.framework.Context_[AutoDiffXd]) -> None

Copies time, accuracy, all state and all parameters in source, where numerical values are of type U, to this context. This method can only be called on root contexts because time and accuracy are copied. Sends out of date notifications for all dependent computations in this context.

Raises:RuntimeError if this is not the root context.

Note

Currently does not copy fixed input port values from source. See System::FixInputPortsFrom() if you want to copy those.

See also

SetStateAndParametersFrom() if you want to copy state and parameters to a non-root context.

  1. SetTimeStateAndParametersFrom(self: pydrake.systems.framework.Context_[AutoDiffXd], source: drake::systems::Context<drake::symbolic::Expression>) -> None

Copies time, accuracy, all state and all parameters in source, where numerical values are of type U, to this context. This method can only be called on root contexts because time and accuracy are copied. Sends out of date notifications for all dependent computations in this context.

Raises:RuntimeError if this is not the root context.

Note

Currently does not copy fixed input port values from source. See System::FixInputPortsFrom() if you want to copy those.

See also

SetStateAndParametersFrom() if you want to copy state and parameters to a non-root context.

UnfreezeCache(self: pydrake.systems.framework.Context_[AutoDiffXd]) → None

(Advanced) Unfreezes the cache if it was previously frozen. This is applied recursively to this Context and all its subcontexts, but not to its parent or siblings. If the cache was not frozen, this does nothing but waste a little time.

class pydrake.systems.framework.Context_[Expression]

%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. There are also type-erased abstract state variables, abstract-valued input ports, abstract parameters, and a double accuracy setting. The framework provides two concrete subclasses of Context: LeafContext (for leaf Systems) and DiagramContext (for composite System Diagrams). Users are forbidden to extend DiagramContext and are discouraged from subclassing LeafContext.

A Context is designed to be used only with the System that created it. State and Parameter data can be copied between contexts for compatible systems as necessary.

__init__

Initialize self. See help(type(self)) for accurate signature.

Clone(self: pydrake.systems.framework.Context_[Expression]) → pydrake.systems.framework.Context_[Expression]

Returns a deep copy of this Context.

Raises:RuntimeError if this is not the root context.
DisableCaching(self: pydrake.systems.framework.Context_[Expression]) → None

(Debugging) Disables caching recursively for this context and all its subcontexts. Disabling forces every Eval() method to perform a full calculation rather than returning the cached one. Results should be identical with or without caching, except for performance. If they are not, there is likely a problem with (a) the specified dependencies for some calculation, or (b) a misuse of references into cached values that hides modifications from the caching system, or (c) a bug in the caching system. The is_disabled flags are independent of the out_of_date flags, which continue to be maintained even when caching is disabled (though they are ignored).

EnableCaching(self: pydrake.systems.framework.Context_[Expression]) → None

(Debugging) Re-enables caching recursively for this context and all its subcontexts. The is_disabled flags are independent of the out_of_date flags, which continue to be maintained even when caching is disabled (though they are ignored). Hence re-enabling the cache with this method may result in some entries being already considered up to date. See SetAllCacheEntriesOutOfDate() if you want to ensure that caching restarts with everything out of date. You might want to do that, for example, for repeatability or because you modified something in the debugger and want to make sure it gets used.

FreezeCache(self: pydrake.systems.framework.Context_[Expression]) → None

(Advanced) Freezes the cache at its current contents, preventing any further cache updates. When frozen, accessing an out-of-date cache entry causes an exception to be throw. This is applied recursively to this Context and all its subcontexts, but not to its parent or siblings so it is most useful when called on the root Context. If the cache was already frozen this method does nothing but waste a little time.

get_abstract_parameter(self: pydrake.systems.framework.Context_[Expression], index: int) → pydrake.common.value.AbstractValue

Returns a const reference to the vector-valued parameter at index.

Precondition:
index must identify an existing parameter.
get_abstract_state(*args, **kwargs)

Overloaded function.

  1. get_abstract_state(self: pydrake.systems.framework.Context_[Expression]) -> pydrake.systems.framework.AbstractValues

Returns a const reference to the abstract component of the state, which may be of size zero.

  1. get_abstract_state(self: pydrake.systems.framework.Context_[Expression], index: int) -> pydrake.common.value.AbstractValue

Returns a const reference to the abstract component of the state at index.

Precondition:
index must identify an existing element.
Precondition:
the abstract state’s type must match the template argument.
get_accuracy(self: pydrake.systems.framework.Context_[Expression]) → Optional[float]

Returns the accuracy setting (if any). Note that the return type is optional<double> rather than the double value itself.

See also

SetAccuracy() for details.

get_continuous_state(self: pydrake.systems.framework.Context_[Expression]) → drake::systems::ContinuousState<drake::symbolic::Expression>

Returns a const reference to the continuous component of the state, which may be of size zero.

get_continuous_state_vector(self: pydrake.systems.framework.Context_[Expression]) → pydrake.systems.framework.VectorBase_[Expression]

Returns a reference to the continuous state vector, devoid of second-order structure. The vector may be of size zero.

get_discrete_state(*args, **kwargs)

Overloaded function.

  1. get_discrete_state(self: pydrake.systems.framework.Context_[Expression]) -> drake::systems::DiscreteValues<drake::symbolic::Expression>

Returns a reference to the entire discrete state, which may consist of multiple discrete state vectors (groups).

  1. get_discrete_state(self: pydrake.systems.framework.Context_[Expression], arg0: int) -> pydrake.systems.framework.BasicVector_[Expression]

Returns a const reference to group (vector) index of the discrete state.

Precondition:
index must identify an existing group.
get_discrete_state_vector(self: pydrake.systems.framework.Context_[Expression]) → pydrake.systems.framework.BasicVector_[Expression]

Returns a reference to the only discrete state vector. The vector may be of size zero.

Precondition:
There is only one discrete state group.
get_mutable_abstract_parameter(self: pydrake.systems.framework.Context_[Expression], index: int) → pydrake.common.value.AbstractValue

Returns a mutable reference to element index of the abstract-valued parameters. Sends out of date notifications for all computations dependent on this parameter.

Precondition:
index must identify an existing abstract parameter.

Note

Currently notifies dependents of all abstract parameters.

get_mutable_abstract_state(*args, **kwargs)

Overloaded function.

  1. get_mutable_abstract_state(self: pydrake.systems.framework.Context_[Expression]) -> pydrake.systems.framework.AbstractValues

Returns a mutable reference to the abstract component of the state, which may be of size zero. Sends out of date notifications for all abstract-state-dependent computations.

  1. get_mutable_abstract_state(self: pydrake.systems.framework.Context_[Expression], index: int) -> pydrake.common.value.AbstractValue

Returns a mutable reference to element index of the abstract state. Sends out of date notifications for all computations that depend on this abstract state variable.

Precondition:
index must identify an existing element.
Precondition:
the abstract state’s type must match the template argument.

Note

Currently notifies dependents of any abstract state variable.

get_mutable_continuous_state(self: pydrake.systems.framework.Context_[Expression]) → drake::systems::ContinuousState<drake::symbolic::Expression>

Returns a mutable reference to the continuous component of the state, which may be of size zero. Sends out of date notifications for all continuous-state-dependent computations.

get_mutable_continuous_state_vector(self: pydrake.systems.framework.Context_[Expression]) → pydrake.systems.framework.VectorBase_[Expression]

Returns a mutable reference to the continuous state vector, devoid of second-order structure. The vector may be of size zero. Sends out of date notifications for all continuous-state-dependent computations.

get_mutable_discrete_state(*args, **kwargs)

Overloaded function.

  1. get_mutable_discrete_state(self: pydrake.systems.framework.Context_[Expression]) -> drake::systems::DiscreteValues<drake::symbolic::Expression>

Returns a mutable reference to the discrete component of the state, which may be of size zero. Sends out of date notifications for all discrete-state-dependent computations.

  1. get_mutable_discrete_state(self: pydrake.systems.framework.Context_[Expression], arg0: int) -> pydrake.systems.framework.BasicVector_[Expression]

Returns a mutable reference to group (vector) index of the discrete state. Sends out of date notifications for all computations that depend on this discrete state group.

Precondition:
index must identify an existing group.

Note

Currently notifies dependents of all groups.

get_mutable_discrete_state_vector(self: pydrake.systems.framework.Context_[Expression]) → pydrake.systems.framework.BasicVector_[Expression]

Returns a mutable reference to the only discrete state vector. Sends out of date notifications for all discrete-state-dependent computations.

See also

get_discrete_state_vector().

Precondition:
There is only one discrete state group.
get_mutable_numeric_parameter(self: pydrake.systems.framework.Context_[Expression], index: int) → pydrake.systems.framework.BasicVector_[Expression]

Returns a mutable reference to element index of the vector-valued (numeric) parameters. Sends out of date notifications for all computations dependent on this parameter.

Precondition:
index must identify an existing numeric parameter.

Note

Currently notifies dependents of all numeric parameters.

get_mutable_parameters(self: pydrake.systems.framework.Context_[Expression]) → drake::systems::Parameters<drake::symbolic::Expression>

Returns a mutable reference to this Context’s parameters. Sends out of date notifications for all parameter-dependent computations. If you don’t mean to change all the parameters, use the indexed methods to modify only some of the parameters so that fewer computations are invalidated and fewer notifications need be sent.

get_mutable_state(self: pydrake.systems.framework.Context_[Expression]) → drake::systems::State<drake::symbolic::Expression>

Returns a mutable reference to the whole State, potentially invalidating all state-dependent computations so requiring out of date notifications to be made for all such computations. If you don’t mean to change the whole state, use more focused methods to modify only a portion of the state. See class documentation for more information.

get_numeric_parameter(self: pydrake.systems.framework.Context_[Expression], index: int) → pydrake.systems.framework.BasicVector_[Expression]

Returns a const reference to the vector-valued parameter at index.

Precondition:
index must identify an existing parameter.
get_parameters(self: pydrake.systems.framework.Context_[Expression]) → drake::systems::Parameters<drake::symbolic::Expression>

Returns a const reference to this Context’s parameters.

get_state(self: pydrake.systems.framework.Context_[Expression]) → drake::systems::State<drake::symbolic::Expression>

Returns a const reference to the whole State.

get_time(self: pydrake.systems.framework.Context_[Expression]) → pydrake.symbolic.Expression

Returns the current time in seconds.

See also

SetTime()

has_only_continuous_state(self: pydrake.systems.framework.Context_[Expression]) → bool

Returns true if the Context has continuous state, but no discrete or abstract state.

has_only_discrete_state(self: pydrake.systems.framework.Context_[Expression]) → bool

Returns true if the Context has discrete state, but no continuous or abstract state.

is_cache_frozen(self: pydrake.systems.framework.Context_[Expression]) → bool

(Advanced) Reports whether this Context’s cache is currently frozen. This checks only locally; it is possible that parent, child, or sibling subcontext caches are in a different state than this one.

is_stateless(self: pydrake.systems.framework.Context_[Expression]) → bool

Returns true if the Context has no state.

num_abstract_parameters(self: pydrake.systems.framework.Context_[Expression]) → int

Returns the number of abstract-valued parameters.

num_abstract_states(self: pydrake.systems.framework.Context_[Expression]) → int

Returns the number of elements in the abstract state.

num_continuous_states(self: pydrake.systems.framework.Context_[Expression]) → int

Returns the number of continuous state variables xc = {q, v, z}.

num_discrete_state_groups(self: pydrake.systems.framework.Context_[Expression]) → int

Returns the number of vectors (groups) in the discrete state.

num_input_ports(self: pydrake.systems.framework.Context_[Expression]) → int

Returns the number of input ports in this context.

num_numeric_parameter_groups(self: pydrake.systems.framework.Context_[Expression]) → int

Returns the number of vector-valued parameters.

num_output_ports(self: pydrake.systems.framework.Context_[Expression]) → int

Returns the number of output ports represented in this context.

num_total_states(self: pydrake.systems.framework.Context_[Expression]) → int

Returns the total dimension of all of the basic vector states (as if they were muxed).

Raises:RuntimeError if the system contains any abstract state.
SetAbstractState(self: object, index: int, value: object) → None

Sets the value of the abstract state variable selected by index. Sends out of date notifications for all computations that depend on that abstract state variable. The template type will be inferred and need not be specified explicitly.

Precondition:
index must identify an existing abstract state variable.
Precondition:
the abstract state’s type must match the template argument.

Note

Currently notifies dependents of any abstract state variable.

SetAccuracy(self: pydrake.systems.framework.Context_[Expression], accuracy: Optional[float]) → None

Records the user’s requested accuracy, which is a unit-less quantity designed for use with simulation and other numerical studies. Since accuracy is unit-less, algorithms and systems are free to interpret this quantity as they wish. The intention is that more computational work is acceptable as the accuracy setting is tightened (set closer to zero). If no accuracy is requested, computations are free to choose suitable defaults, or to refuse to proceed without an explicit accuracy setting. The accuracy of a complete simulation or other numerical study depends on the accuracy of all contributing computations, so it is important that each computation is done in accordance with the requested accuracy. Some examples of where this is needed: - Error-controlled numerical integrators use the accuracy setting to decide what step sizes to take. - The Simulator employs a numerical integrator, but also uses accuracy to decide how precisely to isolate witness function zero crossings. - Iterative calculations reported as results or cached internally depend on accuracy to decide how strictly to converge the results. Examples of these are: constraint projection, calculation of distances between smooth shapes, and deformation calculations for soft contact.

The common thread among these examples is that they all share the same Context, so by keeping accuracy here it can be used effectively to control all accuracy-dependent computations.

Any accuracy-dependent computation in this Context and its subcontexts may be invalidated by a change to the accuracy setting, so out of date notifications are sent to all such computations (at least if the accuracy setting has actually changed). Accuracy must have the same value in every subcontext within the same context tree so may only be modified at the root context of a tree.

Requested accuracy is stored in the Context for two reasons: - It permits all computations performed over a System to see the same accuracy request since accuracy is stored in one shared place, and - it allows us to notify accuracy-dependent cached results that they are out of date when the accuracy setting changes.

Raises:RuntimeError if this is not the root context.
SetAllCacheEntriesOutOfDate(self: pydrake.systems.framework.Context_[Expression]) → None

(Debugging) Marks all cache entries out of date, recursively for this context and all its subcontexts. This forces the next Eval() request for each cache entry to perform a full calculation rather than returning the cached one. After that first recalculation, normal caching behavior resumes (assuming the cache is not disabled). Results should be identical whether this is called or not, since the caching system should be maintaining this flag correctly. If they are not, see the documentation for SetIsCacheDisabled() for suggestions.

SetContinuousState(self: pydrake.systems.framework.Context_[Expression], arg0: numpy.ndarray[object[m, 1]]) → None

Sets the continuous state to xc, including q, v, and z partitions. The supplied vector must be the same size as the existing continuous state. Sends out of date notifications for all continuous-state-dependent computations.

SetDiscreteState(*args, **kwargs)

Overloaded function.

  1. SetDiscreteState(self: pydrake.systems.framework.Context_[Expression], xd: numpy.ndarray[object[m, 1]]) -> None

Sets the discrete state to xd, assuming there is just one discrete state group. The supplied vector must be the same size as the existing discrete state. Sends out of date notifications for all discrete-state-dependent computations. Use the other signature for this method if you have multiple discrete state groups.

Precondition:
There is exactly one discrete state group.
  1. SetDiscreteState(self: pydrake.systems.framework.Context_[Expression], group_index: int, xd: numpy.ndarray[object[m, 1]]) -> None

Sets the discrete state group indicated by group_index to xd. The supplied vector xd must be the same size as the existing discrete state group. Sends out of date notifications for all computations that depend on this discrete state group.

Precondition:
group_index identifies an existing group.

Note

Currently notifies dependents of all groups.

SetTime(self: pydrake.systems.framework.Context_[Expression], time_sec: pydrake.symbolic.Expression) → None

Sets the current time in seconds. Sends out of date notifications for all time-dependent computations (at least if the time has actually changed). Time must have the same value in every subcontext within the same Diagram context tree so may only be modified at the root context of the tree.

Raises:RuntimeError if this is not the root context.
SetTimeAndContinuousState(self: pydrake.systems.framework.Context_[Expression], arg0: pydrake.symbolic.Expression, arg1: numpy.ndarray[object[m, 1]]) → None

Sets time to time_sec and continuous state to xc. Performs a single notification sweep to avoid duplicate notifications for computations that depend on both time and state.

Raises:RuntimeError if this is not the root context.
SetTimeStateAndParametersFrom(*args, **kwargs)

Overloaded function.

  1. SetTimeStateAndParametersFrom(self: pydrake.systems.framework.Context_[Expression], source: pydrake.systems.framework.Context_[float]) -> None

Copies time, accuracy, all state and all parameters in source, where numerical values are of type U, to this context. This method can only be called on root contexts because time and accuracy are copied. Sends out of date notifications for all dependent computations in this context.

Raises:RuntimeError if this is not the root context.

Note

Currently does not copy fixed input port values from source. See System::FixInputPortsFrom() if you want to copy those.

See also

SetStateAndParametersFrom() if you want to copy state and parameters to a non-root context.

  1. SetTimeStateAndParametersFrom(self: pydrake.systems.framework.Context_[Expression], source: pydrake.systems.framework.Context_[AutoDiffXd]) -> None

Copies time, accuracy, all state and all parameters in source, where numerical values are of type U, to this context. This method can only be called on root contexts because time and accuracy are copied. Sends out of date notifications for all dependent computations in this context.

Raises:RuntimeError if this is not the root context.

Note

Currently does not copy fixed input port values from source. See System::FixInputPortsFrom() if you want to copy those.

See also

SetStateAndParametersFrom() if you want to copy state and parameters to a non-root context.

  1. SetTimeStateAndParametersFrom(self: pydrake.systems.framework.Context_[Expression], source: pydrake.systems.framework.Context_[Expression]) -> None

Copies time, accuracy, all state and all parameters in source, where numerical values are of type U, to this context. This method can only be called on root contexts because time and accuracy are copied. Sends out of date notifications for all dependent computations in this context.

Raises:RuntimeError if this is not the root context.

Note

Currently does not copy fixed input port values from source. See System::FixInputPortsFrom() if you want to copy those.

See also

SetStateAndParametersFrom() if you want to copy state and parameters to a non-root context.

UnfreezeCache(self: pydrake.systems.framework.Context_[Expression]) → None

(Advanced) Unfreezes the cache if it was previously frozen. This is applied recursively to this Context and all its subcontexts, but not to its parent or siblings. If the cache was not frozen, this does nothing but waste a little time.

class pydrake.systems.framework.Context_[float]

%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. There are also type-erased abstract state variables, abstract-valued input ports, abstract parameters, and a double accuracy setting. The framework provides two concrete subclasses of Context: LeafContext (for leaf Systems) and DiagramContext (for composite System Diagrams). Users are forbidden to extend DiagramContext and are discouraged from subclassing LeafContext.

A Context is designed to be used only with the System that created it. State and Parameter data can be copied between contexts for compatible systems as necessary.

__init__

Initialize self. See help(type(self)) for accurate signature.

Clone(self: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.Context_[float]

Returns a deep copy of this Context.

Raises:RuntimeError if this is not the root context.
DisableCaching(self: pydrake.systems.framework.Context_[float]) → None

(Debugging) Disables caching recursively for this context and all its subcontexts. Disabling forces every Eval() method to perform a full calculation rather than returning the cached one. Results should be identical with or without caching, except for performance. If they are not, there is likely a problem with (a) the specified dependencies for some calculation, or (b) a misuse of references into cached values that hides modifications from the caching system, or (c) a bug in the caching system. The is_disabled flags are independent of the out_of_date flags, which continue to be maintained even when caching is disabled (though they are ignored).

EnableCaching(self: pydrake.systems.framework.Context_[float]) → None

(Debugging) Re-enables caching recursively for this context and all its subcontexts. The is_disabled flags are independent of the out_of_date flags, which continue to be maintained even when caching is disabled (though they are ignored). Hence re-enabling the cache with this method may result in some entries being already considered up to date. See SetAllCacheEntriesOutOfDate() if you want to ensure that caching restarts with everything out of date. You might want to do that, for example, for repeatability or because you modified something in the debugger and want to make sure it gets used.

FreezeCache(self: pydrake.systems.framework.Context_[float]) → None

(Advanced) Freezes the cache at its current contents, preventing any further cache updates. When frozen, accessing an out-of-date cache entry causes an exception to be throw. This is applied recursively to this Context and all its subcontexts, but not to its parent or siblings so it is most useful when called on the root Context. If the cache was already frozen this method does nothing but waste a little time.

get_abstract_parameter(self: pydrake.systems.framework.Context_[float], index: int) → pydrake.common.value.AbstractValue

Returns a const reference to the vector-valued parameter at index.

Precondition:
index must identify an existing parameter.
get_abstract_state(*args, **kwargs)

Overloaded function.

  1. get_abstract_state(self: pydrake.systems.framework.Context_[float]) -> pydrake.systems.framework.AbstractValues

Returns a const reference to the abstract component of the state, which may be of size zero.

  1. get_abstract_state(self: pydrake.systems.framework.Context_[float], index: int) -> pydrake.common.value.AbstractValue

Returns a const reference to the abstract component of the state at index.

Precondition:
index must identify an existing element.
Precondition:
the abstract state’s type must match the template argument.
get_accuracy(self: pydrake.systems.framework.Context_[float]) → Optional[float]

Returns the accuracy setting (if any). Note that the return type is optional<double> rather than the double value itself.

See also

SetAccuracy() for details.

get_continuous_state(self: pydrake.systems.framework.Context_[float]) → drake::systems::ContinuousState<double>

Returns a const reference to the continuous component of the state, which may be of size zero.

get_continuous_state_vector(self: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a reference to the continuous state vector, devoid of second-order structure. The vector may be of size zero.

get_discrete_state(*args, **kwargs)

Overloaded function.

  1. get_discrete_state(self: pydrake.systems.framework.Context_[float]) -> drake::systems::DiscreteValues<double>

Returns a reference to the entire discrete state, which may consist of multiple discrete state vectors (groups).

  1. get_discrete_state(self: pydrake.systems.framework.Context_[float], arg0: int) -> pydrake.systems.framework.BasicVector_[float]

Returns a const reference to group (vector) index of the discrete state.

Precondition:
index must identify an existing group.
get_discrete_state_vector(self: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.BasicVector_[float]

Returns a reference to the only discrete state vector. The vector may be of size zero.

Precondition:
There is only one discrete state group.
get_mutable_abstract_parameter(self: pydrake.systems.framework.Context_[float], index: int) → pydrake.common.value.AbstractValue

Returns a mutable reference to element index of the abstract-valued parameters. Sends out of date notifications for all computations dependent on this parameter.

Precondition:
index must identify an existing abstract parameter.

Note

Currently notifies dependents of all abstract parameters.

get_mutable_abstract_state(*args, **kwargs)

Overloaded function.

  1. get_mutable_abstract_state(self: pydrake.systems.framework.Context_[float]) -> pydrake.systems.framework.AbstractValues

Returns a mutable reference to the abstract component of the state, which may be of size zero. Sends out of date notifications for all abstract-state-dependent computations.

  1. get_mutable_abstract_state(self: pydrake.systems.framework.Context_[float], index: int) -> pydrake.common.value.AbstractValue

Returns a mutable reference to element index of the abstract state. Sends out of date notifications for all computations that depend on this abstract state variable.

Precondition:
index must identify an existing element.
Precondition:
the abstract state’s type must match the template argument.

Note

Currently notifies dependents of any abstract state variable.

get_mutable_continuous_state(self: pydrake.systems.framework.Context_[float]) → drake::systems::ContinuousState<double>

Returns a mutable reference to the continuous component of the state, which may be of size zero. Sends out of date notifications for all continuous-state-dependent computations.

get_mutable_continuous_state_vector(self: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a mutable reference to the continuous state vector, devoid of second-order structure. The vector may be of size zero. Sends out of date notifications for all continuous-state-dependent computations.

get_mutable_discrete_state(*args, **kwargs)

Overloaded function.

  1. get_mutable_discrete_state(self: pydrake.systems.framework.Context_[float]) -> drake::systems::DiscreteValues<double>

Returns a mutable reference to the discrete component of the state, which may be of size zero. Sends out of date notifications for all discrete-state-dependent computations.

  1. get_mutable_discrete_state(self: pydrake.systems.framework.Context_[float], arg0: int) -> pydrake.systems.framework.BasicVector_[float]

Returns a mutable reference to group (vector) index of the discrete state. Sends out of date notifications for all computations that depend on this discrete state group.

Precondition:
index must identify an existing group.

Note

Currently notifies dependents of all groups.

get_mutable_discrete_state_vector(self: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.BasicVector_[float]

Returns a mutable reference to the only discrete state vector. Sends out of date notifications for all discrete-state-dependent computations.

See also

get_discrete_state_vector().

Precondition:
There is only one discrete state group.
get_mutable_numeric_parameter(self: pydrake.systems.framework.Context_[float], index: int) → pydrake.systems.framework.BasicVector_[float]

Returns a mutable reference to element index of the vector-valued (numeric) parameters. Sends out of date notifications for all computations dependent on this parameter.

Precondition:
index must identify an existing numeric parameter.

Note

Currently notifies dependents of all numeric parameters.

get_mutable_parameters(self: pydrake.systems.framework.Context_[float]) → drake::systems::Parameters<double>

Returns a mutable reference to this Context’s parameters. Sends out of date notifications for all parameter-dependent computations. If you don’t mean to change all the parameters, use the indexed methods to modify only some of the parameters so that fewer computations are invalidated and fewer notifications need be sent.

get_mutable_state(self: pydrake.systems.framework.Context_[float]) → drake::systems::State<double>

Returns a mutable reference to the whole State, potentially invalidating all state-dependent computations so requiring out of date notifications to be made for all such computations. If you don’t mean to change the whole state, use more focused methods to modify only a portion of the state. See class documentation for more information.

get_numeric_parameter(self: pydrake.systems.framework.Context_[float], index: int) → pydrake.systems.framework.BasicVector_[float]

Returns a const reference to the vector-valued parameter at index.

Precondition:
index must identify an existing parameter.
get_parameters(self: pydrake.systems.framework.Context_[float]) → drake::systems::Parameters<double>

Returns a const reference to this Context’s parameters.

get_state(self: pydrake.systems.framework.Context_[float]) → drake::systems::State<double>

Returns a const reference to the whole State.

get_time(self: pydrake.systems.framework.Context_[float]) → float

Returns the current time in seconds.

See also

SetTime()

has_only_continuous_state(self: pydrake.systems.framework.Context_[float]) → bool

Returns true if the Context has continuous state, but no discrete or abstract state.

has_only_discrete_state(self: pydrake.systems.framework.Context_[float]) → bool

Returns true if the Context has discrete state, but no continuous or abstract state.

is_cache_frozen(self: pydrake.systems.framework.Context_[float]) → bool

(Advanced) Reports whether this Context’s cache is currently frozen. This checks only locally; it is possible that parent, child, or sibling subcontext caches are in a different state than this one.

is_stateless(self: pydrake.systems.framework.Context_[float]) → bool

Returns true if the Context has no state.

num_abstract_parameters(self: pydrake.systems.framework.Context_[float]) → int

Returns the number of abstract-valued parameters.

num_abstract_states(self: pydrake.systems.framework.Context_[float]) → int

Returns the number of elements in the abstract state.

num_continuous_states(self: pydrake.systems.framework.Context_[float]) → int

Returns the number of continuous state variables xc = {q, v, z}.

num_discrete_state_groups(self: pydrake.systems.framework.Context_[float]) → int

Returns the number of vectors (groups) in the discrete state.

num_input_ports(self: pydrake.systems.framework.Context_[float]) → int

Returns the number of input ports in this context.

num_numeric_parameter_groups(self: pydrake.systems.framework.Context_[float]) → int

Returns the number of vector-valued parameters.

num_output_ports(self: pydrake.systems.framework.Context_[float]) → int

Returns the number of output ports represented in this context.

num_total_states(self: pydrake.systems.framework.Context_[float]) → int

Returns the total dimension of all of the basic vector states (as if they were muxed).

Raises:RuntimeError if the system contains any abstract state.
SetAbstractState(self: object, index: int, value: object) → None

Sets the value of the abstract state variable selected by index. Sends out of date notifications for all computations that depend on that abstract state variable. The template type will be inferred and need not be specified explicitly.

Precondition:
index must identify an existing abstract state variable.
Precondition:
the abstract state’s type must match the template argument.

Note

Currently notifies dependents of any abstract state variable.

SetAccuracy(self: pydrake.systems.framework.Context_[float], accuracy: Optional[float]) → None

Records the user’s requested accuracy, which is a unit-less quantity designed for use with simulation and other numerical studies. Since accuracy is unit-less, algorithms and systems are free to interpret this quantity as they wish. The intention is that more computational work is acceptable as the accuracy setting is tightened (set closer to zero). If no accuracy is requested, computations are free to choose suitable defaults, or to refuse to proceed without an explicit accuracy setting. The accuracy of a complete simulation or other numerical study depends on the accuracy of all contributing computations, so it is important that each computation is done in accordance with the requested accuracy. Some examples of where this is needed: - Error-controlled numerical integrators use the accuracy setting to decide what step sizes to take. - The Simulator employs a numerical integrator, but also uses accuracy to decide how precisely to isolate witness function zero crossings. - Iterative calculations reported as results or cached internally depend on accuracy to decide how strictly to converge the results. Examples of these are: constraint projection, calculation of distances between smooth shapes, and deformation calculations for soft contact.

The common thread among these examples is that they all share the same Context, so by keeping accuracy here it can be used effectively to control all accuracy-dependent computations.

Any accuracy-dependent computation in this Context and its subcontexts may be invalidated by a change to the accuracy setting, so out of date notifications are sent to all such computations (at least if the accuracy setting has actually changed). Accuracy must have the same value in every subcontext within the same context tree so may only be modified at the root context of a tree.

Requested accuracy is stored in the Context for two reasons: - It permits all computations performed over a System to see the same accuracy request since accuracy is stored in one shared place, and - it allows us to notify accuracy-dependent cached results that they are out of date when the accuracy setting changes.

Raises:RuntimeError if this is not the root context.
SetAllCacheEntriesOutOfDate(self: pydrake.systems.framework.Context_[float]) → None

(Debugging) Marks all cache entries out of date, recursively for this context and all its subcontexts. This forces the next Eval() request for each cache entry to perform a full calculation rather than returning the cached one. After that first recalculation, normal caching behavior resumes (assuming the cache is not disabled). Results should be identical whether this is called or not, since the caching system should be maintaining this flag correctly. If they are not, see the documentation for SetIsCacheDisabled() for suggestions.

SetContinuousState(self: pydrake.systems.framework.Context_[float], arg0: numpy.ndarray[numpy.float64[m, 1]]) → None

Sets the continuous state to xc, including q, v, and z partitions. The supplied vector must be the same size as the existing continuous state. Sends out of date notifications for all continuous-state-dependent computations.

SetDiscreteState(*args, **kwargs)

Overloaded function.

  1. SetDiscreteState(self: pydrake.systems.framework.Context_[float], xd: numpy.ndarray[numpy.float64[m, 1]]) -> None

Sets the discrete state to xd, assuming there is just one discrete state group. The supplied vector must be the same size as the existing discrete state. Sends out of date notifications for all discrete-state-dependent computations. Use the other signature for this method if you have multiple discrete state groups.

Precondition:
There is exactly one discrete state group.
  1. SetDiscreteState(self: pydrake.systems.framework.Context_[float], group_index: int, xd: numpy.ndarray[numpy.float64[m, 1]]) -> None

Sets the discrete state group indicated by group_index to xd. The supplied vector xd must be the same size as the existing discrete state group. Sends out of date notifications for all computations that depend on this discrete state group.

Precondition:
group_index identifies an existing group.

Note

Currently notifies dependents of all groups.

SetTime(self: pydrake.systems.framework.Context_[float], time_sec: float) → None

Sets the current time in seconds. Sends out of date notifications for all time-dependent computations (at least if the time has actually changed). Time must have the same value in every subcontext within the same Diagram context tree so may only be modified at the root context of the tree.

Raises:RuntimeError if this is not the root context.
SetTimeAndContinuousState(self: pydrake.systems.framework.Context_[float], arg0: float, arg1: numpy.ndarray[numpy.float64[m, 1]]) → None

Sets time to time_sec and continuous state to xc. Performs a single notification sweep to avoid duplicate notifications for computations that depend on both time and state.

Raises:RuntimeError if this is not the root context.
SetTimeStateAndParametersFrom(*args, **kwargs)

Overloaded function.

  1. SetTimeStateAndParametersFrom(self: pydrake.systems.framework.Context_[float], source: pydrake.systems.framework.Context_[float]) -> None

Copies time, accuracy, all state and all parameters in source, where numerical values are of type U, to this context. This method can only be called on root contexts because time and accuracy are copied. Sends out of date notifications for all dependent computations in this context.

Raises:RuntimeError if this is not the root context.

Note

Currently does not copy fixed input port values from source. See System::FixInputPortsFrom() if you want to copy those.

See also

SetStateAndParametersFrom() if you want to copy state and parameters to a non-root context.

  1. SetTimeStateAndParametersFrom(self: pydrake.systems.framework.Context_[float], source: drake::systems::Context<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >) -> None

Copies time, accuracy, all state and all parameters in source, where numerical values are of type U, to this context. This method can only be called on root contexts because time and accuracy are copied. Sends out of date notifications for all dependent computations in this context.

Raises:RuntimeError if this is not the root context.

Note

Currently does not copy fixed input port values from source. See System::FixInputPortsFrom() if you want to copy those.

See also

SetStateAndParametersFrom() if you want to copy state and parameters to a non-root context.

  1. SetTimeStateAndParametersFrom(self: pydrake.systems.framework.Context_[float], source: drake::systems::Context<drake::symbolic::Expression>) -> None

Copies time, accuracy, all state and all parameters in source, where numerical values are of type U, to this context. This method can only be called on root contexts because time and accuracy are copied. Sends out of date notifications for all dependent computations in this context.

Raises:RuntimeError if this is not the root context.

Note

Currently does not copy fixed input port values from source. See System::FixInputPortsFrom() if you want to copy those.

See also

SetStateAndParametersFrom() if you want to copy state and parameters to a non-root context.

UnfreezeCache(self: pydrake.systems.framework.Context_[float]) → None

(Advanced) Unfreezes the cache if it was previously frozen. This is applied recursively to this Context and all its subcontexts, but not to its parent or siblings. If the cache was not frozen, this does nothing but waste a little time.

pydrake.systems.framework.ContinuousState

alias of pydrake.systems.framework.ContinuousState_[float]

template pydrake.systems.framework.ContinuousState_

Instantiations: ContinuousState_[float], ContinuousState_[AutoDiffXd], ContinuousState_[Expression]

class ContinuousState_[float]

%ContinuousState is a view of, and optionally a container for, all the continuous state variables xc of a Drake System. Continuous state variables are those whose values are defined by differential equations, so we expect there to be a well-defined time derivative xcdotd/dt xc.

The contents of xc are conceptually partitioned into three groups:

  • q is generalized position
  • v is generalized velocity
  • z is other continuous state

For a Drake LeafSystem these partitions are stored contiguously in memory in this sequence: xc=[q v z]. But because a Drake System may be a Diagram composed from subsystems, each with its own continuous state variables (“substates”), the composite continuous state will not generally be stored in contiguous memory. In that case the most we can say is that xc={q,v,z}, that is, it consists of all the q’s, v’s, and z’s, in some order.

Nevertheless, this ContinuousState class provides a vector view of the data that groups together all the q partitions, v partitions, and z partitions. For example, if there are three subsystems (possibly Diagrams) whose continuous state variables are respectively xc₁={q₁,v₁,z₁}, xc₂={q₂,v₂,z₂}, and xc₃={q₃,v₃,z₃} the composite xc includes all the partitions in an undefined order. However, composite q, v, and z appear ordered as q=[q₁ q₂ q₃], v=[v₁ v₂ v₃], z=[z₁ z₂ z₃]. Note that the element ordering of the composite xc is not a concatenation of the composite subgroups. Do not index elements of the full state xc unless you know it is the continuous state of a LeafSystem (a LeafSystem looking at its own Context can depend on that).

Any of the groups may be empty. However, groups q and v must be either both present or both empty, because the time derivative qdot of the second-order state variables q must be computable using a linear mapping qdot=N(q)*v.

The time derivative xcdot has the identical substructure to xc, with the partitions interpreted as qdot, vdot, and zdot. We use identical ContinuousState objects for both.

Memory ownership

When a ContinuousState represents the state of a LeafSystem, it always owns the memory that is used for the state variables and is responsible for destruction. For a Diagram, ContinuousState can instead be a view of the underlying LeafSystem substates, so that modifying the Diagram’s continuous state affects the LeafSystems appropriately. In that case, the memory is owned by the underlying LeafSystems. However, when a ContinuousState object of any structure is cloned, the resulting object always owns all its underlying memory, which is initialized with a copy of the original state variable values but is otherwise independent. The cloned object retains the structure and ordering of the elements and does not guarantee contiguous storage.

See also

DiagramContinuousState for more information.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.ContinuousState_[float], state: pydrake.systems.framework.VectorBase_[float]) -> None

Constructs a ContinuousState for a system that does not have second-order structure. The q and v partitions are empty; all of the state xc is miscellaneous continuous state z.

  1. __init__(self: pydrake.systems.framework.ContinuousState_[float], state: pydrake.systems.framework.VectorBase_[float], num_q: int, num_v: int, num_z: int) -> None

Constructs a ContinuousState that exposes second-order structure.

Parameter state:
The source xc of continuous state information.
Parameter num_q:
The number of position variables q.
Parameter num_v:
The number of velocity variables v.
Parameter num_z:
The number of other continuous variables z.

We require that num_q num_v and that the sum of the partition sizes adds up to the size of state.

  1. __init__(self: pydrake.systems.framework.ContinuousState_[float]) -> None

Constructs a zero-length ContinuousState.

Clone(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.ContinuousState_[float]
CopyToVector(self: pydrake.systems.framework.ContinuousState_[float]) → numpy.ndarray[numpy.float64[m, 1]]

Returns a copy of the entire continuous state vector into an Eigen vector.

get_generalized_position(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a const reference to the subset of the state vector that is generalized position q. May be zero length.

get_generalized_velocity(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a const reference to the subset of the continuous state vector that is generalized velocity v. May be zero length.

get_misc_continuous_state(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a const reference to the subset of the continuous state vector that is other continuous state z. May be zero length.

get_mutable_generalized_position(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a mutable reference to the subset of the state vector that is generalized position q. May be zero length.

get_mutable_generalized_velocity(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a mutable reference to the subset of the continuous state vector that is generalized velocity v. May be zero length.

get_mutable_misc_continuous_state(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a mutable reference to the subset of the continuous state vector that is other continuous state z. May be zero length.

get_mutable_vector(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a mutable reference to the entire continuous state vector.

get_vector(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a reference to the entire continuous state vector.

num_q(self: pydrake.systems.framework.ContinuousState_[float]) → int

Returns the number of generalized positions q in this state vector.

num_v(self: pydrake.systems.framework.ContinuousState_[float]) → int

Returns the number of generalized velocities v in this state vector.

num_z(self: pydrake.systems.framework.ContinuousState_[float]) → int

Returns the number of miscellaneous continuous state variables z in this state vector.

SetFrom(self: pydrake.systems.framework.ContinuousState_[float], arg0: pydrake.systems.framework.ContinuousState_[float]) → None

Copies the values from other into this, converting the scalar type as necessary.

SetFromVector(self: pydrake.systems.framework.ContinuousState_[float], value: numpy.ndarray[numpy.float64[m, 1]]) → None

Sets the entire continuous state vector from an Eigen expression.

size(self: pydrake.systems.framework.ContinuousState_[float]) → int

Returns the size of the entire continuous state vector, which is necessarily num_q + num_v + num_z.

class pydrake.systems.framework.ContinuousState_[AutoDiffXd]

%ContinuousState is a view of, and optionally a container for, all the continuous state variables xc of a Drake System. Continuous state variables are those whose values are defined by differential equations, so we expect there to be a well-defined time derivative xcdotd/dt xc.

The contents of xc are conceptually partitioned into three groups:

  • q is generalized position
  • v is generalized velocity
  • z is other continuous state

For a Drake LeafSystem these partitions are stored contiguously in memory in this sequence: xc=[q v z]. But because a Drake System may be a Diagram composed from subsystems, each with its own continuous state variables (“substates”), the composite continuous state will not generally be stored in contiguous memory. In that case the most we can say is that xc={q,v,z}, that is, it consists of all the q’s, v’s, and z’s, in some order.

Nevertheless, this ContinuousState class provides a vector view of the data that groups together all the q partitions, v partitions, and z partitions. For example, if there are three subsystems (possibly Diagrams) whose continuous state variables are respectively xc₁={q₁,v₁,z₁}, xc₂={q₂,v₂,z₂}, and xc₃={q₃,v₃,z₃} the composite xc includes all the partitions in an undefined order. However, composite q, v, and z appear ordered as q=[q₁ q₂ q₃], v=[v₁ v₂ v₃], z=[z₁ z₂ z₃]. Note that the element ordering of the composite xc is not a concatenation of the composite subgroups. Do not index elements of the full state xc unless you know it is the continuous state of a LeafSystem (a LeafSystem looking at its own Context can depend on that).

Any of the groups may be empty. However, groups q and v must be either both present or both empty, because the time derivative qdot of the second-order state variables q must be computable using a linear mapping qdot=N(q)*v.

The time derivative xcdot has the identical substructure to xc, with the partitions interpreted as qdot, vdot, and zdot. We use identical ContinuousState objects for both.

Memory ownership

When a ContinuousState represents the state of a LeafSystem, it always owns the memory that is used for the state variables and is responsible for destruction. For a Diagram, ContinuousState can instead be a view of the underlying LeafSystem substates, so that modifying the Diagram’s continuous state affects the LeafSystems appropriately. In that case, the memory is owned by the underlying LeafSystems. However, when a ContinuousState object of any structure is cloned, the resulting object always owns all its underlying memory, which is initialized with a copy of the original state variable values but is otherwise independent. The cloned object retains the structure and ordering of the elements and does not guarantee contiguous storage.

See also

DiagramContinuousState for more information.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd], state: pydrake.systems.framework.VectorBase_[AutoDiffXd]) -> None

Constructs a ContinuousState for a system that does not have second-order structure. The q and v partitions are empty; all of the state xc is miscellaneous continuous state z.

  1. __init__(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd], state: pydrake.systems.framework.VectorBase_[AutoDiffXd], num_q: int, num_v: int, num_z: int) -> None

Constructs a ContinuousState that exposes second-order structure.

Parameter state:
The source xc of continuous state information.
Parameter num_q:
The number of position variables q.
Parameter num_v:
The number of velocity variables v.
Parameter num_z:
The number of other continuous variables z.

We require that num_q num_v and that the sum of the partition sizes adds up to the size of state.

  1. __init__(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) -> None

Constructs a zero-length ContinuousState.

Clone(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → pydrake.systems.framework.ContinuousState_[AutoDiffXd]
CopyToVector(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → numpy.ndarray[object[m, 1]]

Returns a copy of the entire continuous state vector into an Eigen vector.

get_generalized_position(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → pydrake.systems.framework.VectorBase_[AutoDiffXd]

Returns a const reference to the subset of the state vector that is generalized position q. May be zero length.

get_generalized_velocity(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → pydrake.systems.framework.VectorBase_[AutoDiffXd]

Returns a const reference to the subset of the continuous state vector that is generalized velocity v. May be zero length.

get_misc_continuous_state(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → pydrake.systems.framework.VectorBase_[AutoDiffXd]

Returns a const reference to the subset of the continuous state vector that is other continuous state z. May be zero length.

get_mutable_generalized_position(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → pydrake.systems.framework.VectorBase_[AutoDiffXd]

Returns a mutable reference to the subset of the state vector that is generalized position q. May be zero length.

get_mutable_generalized_velocity(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → pydrake.systems.framework.VectorBase_[AutoDiffXd]

Returns a mutable reference to the subset of the continuous state vector that is generalized velocity v. May be zero length.

get_mutable_misc_continuous_state(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → pydrake.systems.framework.VectorBase_[AutoDiffXd]

Returns a mutable reference to the subset of the continuous state vector that is other continuous state z. May be zero length.

get_mutable_vector(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → pydrake.systems.framework.VectorBase_[AutoDiffXd]

Returns a mutable reference to the entire continuous state vector.

get_vector(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → pydrake.systems.framework.VectorBase_[AutoDiffXd]

Returns a reference to the entire continuous state vector.

num_q(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → int

Returns the number of generalized positions q in this state vector.

num_v(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → int

Returns the number of generalized velocities v in this state vector.

num_z(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → int

Returns the number of miscellaneous continuous state variables z in this state vector.

SetFrom(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd], arg0: pydrake.systems.framework.ContinuousState_[float]) → None

Copies the values from other into this, converting the scalar type as necessary.

SetFromVector(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd], value: numpy.ndarray[object[m, 1]]) → None

Sets the entire continuous state vector from an Eigen expression.

size(self: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → int

Returns the size of the entire continuous state vector, which is necessarily num_q + num_v + num_z.

class pydrake.systems.framework.ContinuousState_[Expression]

%ContinuousState is a view of, and optionally a container for, all the continuous state variables xc of a Drake System. Continuous state variables are those whose values are defined by differential equations, so we expect there to be a well-defined time derivative xcdotd/dt xc.

The contents of xc are conceptually partitioned into three groups:

  • q is generalized position
  • v is generalized velocity
  • z is other continuous state

For a Drake LeafSystem these partitions are stored contiguously in memory in this sequence: xc=[q v z]. But because a Drake System may be a Diagram composed from subsystems, each with its own continuous state variables (“substates”), the composite continuous state will not generally be stored in contiguous memory. In that case the most we can say is that xc={q,v,z}, that is, it consists of all the q’s, v’s, and z’s, in some order.

Nevertheless, this ContinuousState class provides a vector view of the data that groups together all the q partitions, v partitions, and z partitions. For example, if there are three subsystems (possibly Diagrams) whose continuous state variables are respectively xc₁={q₁,v₁,z₁}, xc₂={q₂,v₂,z₂}, and xc₃={q₃,v₃,z₃} the composite xc includes all the partitions in an undefined order. However, composite q, v, and z appear ordered as q=[q₁ q₂ q₃], v=[v₁ v₂ v₃], z=[z₁ z₂ z₃]. Note that the element ordering of the composite xc is not a concatenation of the composite subgroups. Do not index elements of the full state xc unless you know it is the continuous state of a LeafSystem (a LeafSystem looking at its own Context can depend on that).

Any of the groups may be empty. However, groups q and v must be either both present or both empty, because the time derivative qdot of the second-order state variables q must be computable using a linear mapping qdot=N(q)*v.

The time derivative xcdot has the identical substructure to xc, with the partitions interpreted as qdot, vdot, and zdot. We use identical ContinuousState objects for both.

Memory ownership

When a ContinuousState represents the state of a LeafSystem, it always owns the memory that is used for the state variables and is responsible for destruction. For a Diagram, ContinuousState can instead be a view of the underlying LeafSystem substates, so that modifying the Diagram’s continuous state affects the LeafSystems appropriately. In that case, the memory is owned by the underlying LeafSystems. However, when a ContinuousState object of any structure is cloned, the resulting object always owns all its underlying memory, which is initialized with a copy of the original state variable values but is otherwise independent. The cloned object retains the structure and ordering of the elements and does not guarantee contiguous storage.

See also

DiagramContinuousState for more information.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.ContinuousState_[Expression], state: pydrake.systems.framework.VectorBase_[Expression]) -> None

Constructs a ContinuousState for a system that does not have second-order structure. The q and v partitions are empty; all of the state xc is miscellaneous continuous state z.

  1. __init__(self: pydrake.systems.framework.ContinuousState_[Expression], state: pydrake.systems.framework.VectorBase_[Expression], num_q: int, num_v: int, num_z: int) -> None

Constructs a ContinuousState that exposes second-order structure.

Parameter state:
The source xc of continuous state information.
Parameter num_q:
The number of position variables q.
Parameter num_v:
The number of velocity variables v.
Parameter num_z:
The number of other continuous variables z.

We require that num_q num_v and that the sum of the partition sizes adds up to the size of state.

  1. __init__(self: pydrake.systems.framework.ContinuousState_[Expression]) -> None

Constructs a zero-length ContinuousState.

Clone(self: pydrake.systems.framework.ContinuousState_[Expression]) → pydrake.systems.framework.ContinuousState_[Expression]
CopyToVector(self: pydrake.systems.framework.ContinuousState_[Expression]) → numpy.ndarray[object[m, 1]]

Returns a copy of the entire continuous state vector into an Eigen vector.

get_generalized_position(self: pydrake.systems.framework.ContinuousState_[Expression]) → pydrake.systems.framework.VectorBase_[Expression]

Returns a const reference to the subset of the state vector that is generalized position q. May be zero length.

get_generalized_velocity(self: pydrake.systems.framework.ContinuousState_[Expression]) → pydrake.systems.framework.VectorBase_[Expression]

Returns a const reference to the subset of the continuous state vector that is generalized velocity v. May be zero length.

get_misc_continuous_state(self: pydrake.systems.framework.ContinuousState_[Expression]) → pydrake.systems.framework.VectorBase_[Expression]

Returns a const reference to the subset of the continuous state vector that is other continuous state z. May be zero length.

get_mutable_generalized_position(self: pydrake.systems.framework.ContinuousState_[Expression]) → pydrake.systems.framework.VectorBase_[Expression]

Returns a mutable reference to the subset of the state vector that is generalized position q. May be zero length.

get_mutable_generalized_velocity(self: pydrake.systems.framework.ContinuousState_[Expression]) → pydrake.systems.framework.VectorBase_[Expression]

Returns a mutable reference to the subset of the continuous state vector that is generalized velocity v. May be zero length.

get_mutable_misc_continuous_state(self: pydrake.systems.framework.ContinuousState_[Expression]) → pydrake.systems.framework.VectorBase_[Expression]

Returns a mutable reference to the subset of the continuous state vector that is other continuous state z. May be zero length.

get_mutable_vector(self: pydrake.systems.framework.ContinuousState_[Expression]) → pydrake.systems.framework.VectorBase_[Expression]

Returns a mutable reference to the entire continuous state vector.

get_vector(self: pydrake.systems.framework.ContinuousState_[Expression]) → pydrake.systems.framework.VectorBase_[Expression]

Returns a reference to the entire continuous state vector.

num_q(self: pydrake.systems.framework.ContinuousState_[Expression]) → int

Returns the number of generalized positions q in this state vector.

num_v(self: pydrake.systems.framework.ContinuousState_[Expression]) → int

Returns the number of generalized velocities v in this state vector.

num_z(self: pydrake.systems.framework.ContinuousState_[Expression]) → int

Returns the number of miscellaneous continuous state variables z in this state vector.

SetFrom(self: pydrake.systems.framework.ContinuousState_[Expression], arg0: pydrake.systems.framework.ContinuousState_[float]) → None

Copies the values from other into this, converting the scalar type as necessary.

SetFromVector(self: pydrake.systems.framework.ContinuousState_[Expression], value: numpy.ndarray[object[m, 1]]) → None

Sets the entire continuous state vector from an Eigen expression.

size(self: pydrake.systems.framework.ContinuousState_[Expression]) → int

Returns the size of the entire continuous state vector, which is necessarily num_q + num_v + num_z.

class pydrake.systems.framework.ContinuousState_[float]

%ContinuousState is a view of, and optionally a container for, all the continuous state variables xc of a Drake System. Continuous state variables are those whose values are defined by differential equations, so we expect there to be a well-defined time derivative xcdotd/dt xc.

The contents of xc are conceptually partitioned into three groups:

  • q is generalized position
  • v is generalized velocity
  • z is other continuous state

For a Drake LeafSystem these partitions are stored contiguously in memory in this sequence: xc=[q v z]. But because a Drake System may be a Diagram composed from subsystems, each with its own continuous state variables (“substates”), the composite continuous state will not generally be stored in contiguous memory. In that case the most we can say is that xc={q,v,z}, that is, it consists of all the q’s, v’s, and z’s, in some order.

Nevertheless, this ContinuousState class provides a vector view of the data that groups together all the q partitions, v partitions, and z partitions. For example, if there are three subsystems (possibly Diagrams) whose continuous state variables are respectively xc₁={q₁,v₁,z₁}, xc₂={q₂,v₂,z₂}, and xc₃={q₃,v₃,z₃} the composite xc includes all the partitions in an undefined order. However, composite q, v, and z appear ordered as q=[q₁ q₂ q₃], v=[v₁ v₂ v₃], z=[z₁ z₂ z₃]. Note that the element ordering of the composite xc is not a concatenation of the composite subgroups. Do not index elements of the full state xc unless you know it is the continuous state of a LeafSystem (a LeafSystem looking at its own Context can depend on that).

Any of the groups may be empty. However, groups q and v must be either both present or both empty, because the time derivative qdot of the second-order state variables q must be computable using a linear mapping qdot=N(q)*v.

The time derivative xcdot has the identical substructure to xc, with the partitions interpreted as qdot, vdot, and zdot. We use identical ContinuousState objects for both.

Memory ownership

When a ContinuousState represents the state of a LeafSystem, it always owns the memory that is used for the state variables and is responsible for destruction. For a Diagram, ContinuousState can instead be a view of the underlying LeafSystem substates, so that modifying the Diagram’s continuous state affects the LeafSystems appropriately. In that case, the memory is owned by the underlying LeafSystems. However, when a ContinuousState object of any structure is cloned, the resulting object always owns all its underlying memory, which is initialized with a copy of the original state variable values but is otherwise independent. The cloned object retains the structure and ordering of the elements and does not guarantee contiguous storage.

See also

DiagramContinuousState for more information.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.ContinuousState_[float], state: pydrake.systems.framework.VectorBase_[float]) -> None

Constructs a ContinuousState for a system that does not have second-order structure. The q and v partitions are empty; all of the state xc is miscellaneous continuous state z.

  1. __init__(self: pydrake.systems.framework.ContinuousState_[float], state: pydrake.systems.framework.VectorBase_[float], num_q: int, num_v: int, num_z: int) -> None

Constructs a ContinuousState that exposes second-order structure.

Parameter state:
The source xc of continuous state information.
Parameter num_q:
The number of position variables q.
Parameter num_v:
The number of velocity variables v.
Parameter num_z:
The number of other continuous variables z.

We require that num_q num_v and that the sum of the partition sizes adds up to the size of state.

  1. __init__(self: pydrake.systems.framework.ContinuousState_[float]) -> None

Constructs a zero-length ContinuousState.

Clone(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.ContinuousState_[float]
CopyToVector(self: pydrake.systems.framework.ContinuousState_[float]) → numpy.ndarray[numpy.float64[m, 1]]

Returns a copy of the entire continuous state vector into an Eigen vector.

get_generalized_position(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a const reference to the subset of the state vector that is generalized position q. May be zero length.

get_generalized_velocity(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a const reference to the subset of the continuous state vector that is generalized velocity v. May be zero length.

get_misc_continuous_state(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a const reference to the subset of the continuous state vector that is other continuous state z. May be zero length.

get_mutable_generalized_position(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a mutable reference to the subset of the state vector that is generalized position q. May be zero length.

get_mutable_generalized_velocity(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a mutable reference to the subset of the continuous state vector that is generalized velocity v. May be zero length.

get_mutable_misc_continuous_state(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a mutable reference to the subset of the continuous state vector that is other continuous state z. May be zero length.

get_mutable_vector(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a mutable reference to the entire continuous state vector.

get_vector(self: pydrake.systems.framework.ContinuousState_[float]) → pydrake.systems.framework.VectorBase_[float]

Returns a reference to the entire continuous state vector.

num_q(self: pydrake.systems.framework.ContinuousState_[float]) → int

Returns the number of generalized positions q in this state vector.

num_v(self: pydrake.systems.framework.ContinuousState_[float]) → int

Returns the number of generalized velocities v in this state vector.

num_z(self: pydrake.systems.framework.ContinuousState_[float]) → int

Returns the number of miscellaneous continuous state variables z in this state vector.

SetFrom(self: pydrake.systems.framework.ContinuousState_[float], arg0: pydrake.systems.framework.ContinuousState_[float]) → None

Copies the values from other into this, converting the scalar type as necessary.

SetFromVector(self: pydrake.systems.framework.ContinuousState_[float], value: numpy.ndarray[numpy.float64[m, 1]]) → None

Sets the entire continuous state vector from an Eigen expression.

size(self: pydrake.systems.framework.ContinuousState_[float]) → int

Returns the size of the entire continuous state vector, which is necessarily num_q + num_v + num_z.

class pydrake.systems.framework.DependencyTicket
__init__(self: pydrake.systems.framework.DependencyTicket, arg0: int) → None

Default constructor; the result is an invalid index. This only exists to serve applications which require a default constructor.

is_valid(self: pydrake.systems.framework.DependencyTicket) → bool

Reports if the index is valid–the only operation on an invalid index that doesn’t throw an exception in Debug builds.

pydrake.systems.framework.Diagram

alias of pydrake.systems.framework.Diagram_[float]

template pydrake.systems.framework.Diagram_

Instantiations: Diagram_[float], Diagram_[AutoDiffXd], Diagram_[Expression]

class Diagram_[float]

Bases: pydrake.systems.framework.System_[float]

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. To construct a Diagram, use a DiagramBuilder.

Each System in the Diagram must have a unique, non-empty name.

__init__(self: pydrake.systems.framework.Diagram_[float]) → None

Constructs an uninitialized Diagram. Subclasses that use this constructor are obligated to call DiagramBuilder::BuildInto(this). Provides scalar- type conversion support only if every contained subsystem provides the same support.

GetMutableSubsystemState(self: pydrake.systems.framework.Diagram_[float], arg0: pydrake.systems.framework.System_[float], arg1: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.State_[float]

Retrieves the state for a particular subsystem from the context for the entire diagram. Invalidates all entries in that subsystem’s cache that depend on State. Aborts if subsystem is not actually a subsystem of this diagram.

GetSubsystemByName(self: pydrake.systems.framework.Diagram_[float], name: str) → pydrake.systems.framework.System_[float]

Retrieves a reference to the subsystem with name name returned by get_name().

Raises:RuntimeError if a match cannot be found.

See also

System<T>::get_name()

GetSystems(self: pydrake.systems.framework.Diagram_[float]) → list

Returns the list of contained Systems.

class pydrake.systems.framework.Diagram_[AutoDiffXd]

Bases: pydrake.systems.framework.System_[AutoDiffXd]

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. To construct a Diagram, use a DiagramBuilder.

Each System in the Diagram must have a unique, non-empty name.

__init__(self: pydrake.systems.framework.Diagram_[AutoDiffXd]) → None

Constructs an uninitialized Diagram. Subclasses that use this constructor are obligated to call DiagramBuilder::BuildInto(this). Provides scalar- type conversion support only if every contained subsystem provides the same support.

GetMutableSubsystemState(self: pydrake.systems.framework.Diagram_[AutoDiffXd], arg0: pydrake.systems.framework.System_[AutoDiffXd], arg1: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.systems.framework.State_[AutoDiffXd]

Retrieves the state for a particular subsystem from the context for the entire diagram. Invalidates all entries in that subsystem’s cache that depend on State. Aborts if subsystem is not actually a subsystem of this diagram.

GetSubsystemByName(self: pydrake.systems.framework.Diagram_[AutoDiffXd], name: str) → pydrake.systems.framework.System_[AutoDiffXd]

Retrieves a reference to the subsystem with name name returned by get_name().

Raises:RuntimeError if a match cannot be found.

See also

System<T>::get_name()

GetSystems(self: pydrake.systems.framework.Diagram_[AutoDiffXd]) → list

Returns the list of contained Systems.

class pydrake.systems.framework.Diagram_[Expression]

Bases: pydrake.systems.framework.System_[Expression]

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. To construct a Diagram, use a DiagramBuilder.

Each System in the Diagram must have a unique, non-empty name.

__init__(self: pydrake.systems.framework.Diagram_[Expression]) → None

Constructs an uninitialized Diagram. Subclasses that use this constructor are obligated to call DiagramBuilder::BuildInto(this). Provides scalar- type conversion support only if every contained subsystem provides the same support.

GetMutableSubsystemState(self: pydrake.systems.framework.Diagram_[Expression], arg0: pydrake.systems.framework.System_[Expression], arg1: pydrake.systems.framework.Context_[Expression]) → pydrake.systems.framework.State_[Expression]

Retrieves the state for a particular subsystem from the context for the entire diagram. Invalidates all entries in that subsystem’s cache that depend on State. Aborts if subsystem is not actually a subsystem of this diagram.

GetSubsystemByName(self: pydrake.systems.framework.Diagram_[Expression], name: str) → pydrake.systems.framework.System_[Expression]

Retrieves a reference to the subsystem with name name returned by get_name().

Raises:RuntimeError if a match cannot be found.

See also

System<T>::get_name()

GetSystems(self: pydrake.systems.framework.Diagram_[Expression]) → list

Returns the list of contained Systems.

class pydrake.systems.framework.Diagram_[float]

Bases: pydrake.systems.framework.System_[float]

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. To construct a Diagram, use a DiagramBuilder.

Each System in the Diagram must have a unique, non-empty name.

__init__(self: pydrake.systems.framework.Diagram_[float]) → None

Constructs an uninitialized Diagram. Subclasses that use this constructor are obligated to call DiagramBuilder::BuildInto(this). Provides scalar- type conversion support only if every contained subsystem provides the same support.

GetMutableSubsystemState(self: pydrake.systems.framework.Diagram_[float], arg0: pydrake.systems.framework.System_[float], arg1: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.State_[float]

Retrieves the state for a particular subsystem from the context for the entire diagram. Invalidates all entries in that subsystem’s cache that depend on State. Aborts if subsystem is not actually a subsystem of this diagram.

GetSubsystemByName(self: pydrake.systems.framework.Diagram_[float], name: str) → pydrake.systems.framework.System_[float]

Retrieves a reference to the subsystem with name name returned by get_name().

Raises:RuntimeError if a match cannot be found.

See also

System<T>::get_name()

GetSystems(self: pydrake.systems.framework.Diagram_[float]) → list

Returns the list of contained Systems.

pydrake.systems.framework.DiagramBuilder

alias of pydrake.systems.framework.DiagramBuilder_[float]

template pydrake.systems.framework.DiagramBuilder_

Instantiations: DiagramBuilder_[float], DiagramBuilder_[AutoDiffXd], DiagramBuilder_[Expression]

class DiagramBuilder_[float]

DiagramBuilder is a factory class for Diagram. It is single use: after calling Build or BuildInto, DiagramBuilder gives up ownership of the constituent systems, and should therefore be discarded.

A system must be added to the DiagramBuilder with AddSystem or AddNamedSystem before it can be wired up in any way. Every system must have a unique, non-empty name.

__init__(self: pydrake.systems.framework.DiagramBuilder_[float]) → None
AddNamedSystem(self: pydrake.systems.framework.DiagramBuilder_[float], name: str, system: drake::systems::System<double>) → drake::systems::System<double>

Takes ownership of system, applies name to it, and adds it to the builder. Returns a bare pointer to the System, which will remain valid for the lifetime of the Diagram built by this builder.

DiagramBuilder<T> builder;
  auto bar = builder.AddNamedSystem("bar", std::make_unique<Bar<T>>());
Template parameter S:
The type of system to add.
Postcondition:
The system’s name is name.
AddSystem(self: pydrake.systems.framework.DiagramBuilder_[float], system: drake::systems::System<double>) → drake::systems::System<double>

Takes ownership of system and adds it to the builder. Returns a bare pointer to the System, which will remain valid for the lifetime of the Diagram built by this builder.

If the system’s name is unset, sets it to System::GetMemoryObjectName() as a default in order to have unique names within the diagram.

DiagramBuilder<T> builder;
  auto foo = builder.AddSystem(std::make_unique<Foo<T>>());
Template parameter S:
The type of system to add.
Build(self: pydrake.systems.framework.DiagramBuilder_[float]) → drake::systems::Diagram<double>

Builds the Diagram that has been described by the calls to Connect, ExportInput, and ExportOutput.

Raises:RuntimeError if the graph is not buildable.
BuildInto(self: pydrake.systems.framework.DiagramBuilder_[float], target: drake::systems::Diagram<double>) → None

Configures target to have the topology that has been described by the calls to Connect, ExportInput, and ExportOutput.

Raises:RuntimeError if the graph is not buildable.

Only Diagram subclasses should call this method. The target must not already be initialized.

Connect(self: pydrake.systems.framework.DiagramBuilder_[float], arg0: drake::systems::OutputPort<double>, arg1: drake::systems::InputPort<double>) → None

Declares that input port dest is connected to output port src.

Note

The connection created between src and dest via a call to this method can be effectively overridden by any subsequent call to InputPort::FixValue(). That is, calling InputPort::FixValue() on an already connected input port causes the resultant FixedInputPortValue to override any other value present on that port.

ConnectInput(*args, **kwargs)

Overloaded function.

  1. ConnectInput(self: pydrake.systems.framework.DiagramBuilder_[float], diagram_port_name: str, input: drake::systems::InputPort<double>) -> None

Connects an input to the entire Diagram, indicated by diagram_port_name, to the given input port of a constituent system.

Precondition:
The Diagram input indicated by diagram_port_name must have been previously built via ExportInput().
Postcondition:
input is connected to the indicated Diagram input port.
  1. ConnectInput(self: pydrake.systems.framework.DiagramBuilder_[float], diagram_port_index: pydrake.systems.framework.InputPortIndex, input: drake::systems::InputPort<double>) -> None

Connects an input to the entire Diagram, indicated by diagram_port_index, to the given input port of a constituent system.

Precondition:
The Diagram input indicated by diagram_port_index must have been previously built via ExportInput().
Postcondition:
input is connected to the indicated Diagram input port.
empty(self: pydrake.systems.framework.DiagramBuilder_[float]) → bool

Returns whether any Systems have been added yet.

ExportInput(self: pydrake.systems.framework.DiagramBuilder_[float], input: drake::systems::InputPort<double>, name: Union[str, pydrake.systems.framework.UseDefaultName] = <pydrake.systems.framework.UseDefaultName object at 0x7fb5f277fcb0>) → pydrake.systems.framework.InputPortIndex

Declares that the given input port of a constituent system is connected to a new input to the entire Diagram. name is an optional name for the new input port; if it is unspecified, then a default name will be provided.

Precondition:
If supplied at all, name must not be empty.
Precondition:
A port indicated by the resolution of name must not exist.
Postcondition:
input is connected to the new exported input port.
Returns:The index of the exported input port of the entire diagram.
ExportOutput(self: pydrake.systems.framework.DiagramBuilder_[float], output: drake::systems::OutputPort<double>, name: Union[str, pydrake.systems.framework.UseDefaultName] = <pydrake.systems.framework.UseDefaultName object at 0x7fb5f277fd70>) → pydrake.systems.framework.OutputPortIndex

Declares that the given output port of a constituent system is an output of the entire diagram. name is an optional name for the output port; if it is unspecified, then a default name will be provided.

Precondition:
If supplied at all, name must not be empty.
Returns:The index of the exported output port of the entire diagram.
GetMutableSystems(self: pydrake.systems.framework.DiagramBuilder_[float]) → list

Returns the list of contained Systems. See also GetSystems().

GetSystems(self: pydrake.systems.framework.DiagramBuilder_[float]) → list

Returns the list of contained Systems. See also GetMutableSystems().

class pydrake.systems.framework.DiagramBuilder_[AutoDiffXd]

DiagramBuilder is a factory class for Diagram. It is single use: after calling Build or BuildInto, DiagramBuilder gives up ownership of the constituent systems, and should therefore be discarded.

A system must be added to the DiagramBuilder with AddSystem or AddNamedSystem before it can be wired up in any way. Every system must have a unique, non-empty name.

__init__(self: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd]) → None
AddNamedSystem(self: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd], name: str, system: drake::systems::System<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >) → drake::systems::System<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Takes ownership of system, applies name to it, and adds it to the builder. Returns a bare pointer to the System, which will remain valid for the lifetime of the Diagram built by this builder.

DiagramBuilder<T> builder;
  auto bar = builder.AddNamedSystem("bar", std::make_unique<Bar<T>>());
Template parameter S:
The type of system to add.
Postcondition:
The system’s name is name.
AddSystem(self: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd], system: drake::systems::System<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >) → drake::systems::System<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Takes ownership of system and adds it to the builder. Returns a bare pointer to the System, which will remain valid for the lifetime of the Diagram built by this builder.

If the system’s name is unset, sets it to System::GetMemoryObjectName() as a default in order to have unique names within the diagram.

DiagramBuilder<T> builder;
  auto foo = builder.AddSystem(std::make_unique<Foo<T>>());
Template parameter S:
The type of system to add.
Build(self: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd]) → drake::systems::Diagram<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Builds the Diagram that has been described by the calls to Connect, ExportInput, and ExportOutput.

Raises:RuntimeError if the graph is not buildable.
BuildInto(self: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd], target: drake::systems::Diagram<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >) → None

Configures target to have the topology that has been described by the calls to Connect, ExportInput, and ExportOutput.

Raises:RuntimeError if the graph is not buildable.

Only Diagram subclasses should call this method. The target must not already be initialized.

Connect(self: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd], arg0: drake::systems::OutputPort<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >, arg1: drake::systems::InputPort<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >) → None

Declares that input port dest is connected to output port src.

Note

The connection created between src and dest via a call to this method can be effectively overridden by any subsequent call to InputPort::FixValue(). That is, calling InputPort::FixValue() on an already connected input port causes the resultant FixedInputPortValue to override any other value present on that port.

ConnectInput(*args, **kwargs)

Overloaded function.

  1. ConnectInput(self: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd], diagram_port_name: str, input: drake::systems::InputPort<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >) -> None

Connects an input to the entire Diagram, indicated by diagram_port_name, to the given input port of a constituent system.

Precondition:
The Diagram input indicated by diagram_port_name must have been previously built via ExportInput().
Postcondition:
input is connected to the indicated Diagram input port.
  1. ConnectInput(self: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd], diagram_port_index: pydrake.systems.framework.InputPortIndex, input: drake::systems::InputPort<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >) -> None

Connects an input to the entire Diagram, indicated by diagram_port_index, to the given input port of a constituent system.

Precondition:
The Diagram input indicated by diagram_port_index must have been previously built via ExportInput().
Postcondition:
input is connected to the indicated Diagram input port.
empty(self: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd]) → bool

Returns whether any Systems have been added yet.

ExportInput(self: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd], input: drake::systems::InputPort<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >, name: Union[str, pydrake.systems.framework.UseDefaultName] = <pydrake.systems.framework.UseDefaultName object at 0x7fb5f1520730>) → pydrake.systems.framework.InputPortIndex

Declares that the given input port of a constituent system is connected to a new input to the entire Diagram. name is an optional name for the new input port; if it is unspecified, then a default name will be provided.

Precondition:
If supplied at all, name must not be empty.
Precondition:
A port indicated by the resolution of name must not exist.
Postcondition:
input is connected to the new exported input port.
Returns:The index of the exported input port of the entire diagram.
ExportOutput(self: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd], output: drake::systems::OutputPort<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >, name: Union[str, pydrake.systems.framework.UseDefaultName] = <pydrake.systems.framework.UseDefaultName object at 0x7fb5f1520770>) → pydrake.systems.framework.OutputPortIndex

Declares that the given output port of a constituent system is an output of the entire diagram. name is an optional name for the output port; if it is unspecified, then a default name will be provided.

Precondition:
If supplied at all, name must not be empty.
Returns:The index of the exported output port of the entire diagram.
GetMutableSystems(self: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd]) → list

Returns the list of contained Systems. See also GetSystems().

GetSystems(self: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd]) → list

Returns the list of contained Systems. See also GetMutableSystems().

class pydrake.systems.framework.DiagramBuilder_[Expression]

DiagramBuilder is a factory class for Diagram. It is single use: after calling Build or BuildInto, DiagramBuilder gives up ownership of the constituent systems, and should therefore be discarded.

A system must be added to the DiagramBuilder with AddSystem or AddNamedSystem before it can be wired up in any way. Every system must have a unique, non-empty name.

__init__(self: pydrake.systems.framework.DiagramBuilder_[Expression]) → None
AddNamedSystem(self: pydrake.systems.framework.DiagramBuilder_[Expression], name: str, system: drake::systems::System<drake::symbolic::Expression>) → drake::systems::System<drake::symbolic::Expression>

Takes ownership of system, applies name to it, and adds it to the builder. Returns a bare pointer to the System, which will remain valid for the lifetime of the Diagram built by this builder.

DiagramBuilder<T> builder;
  auto bar = builder.AddNamedSystem("bar", std::make_unique<Bar<T>>());
Template parameter S:
The type of system to add.
Postcondition:
The system’s name is name.
AddSystem(self: pydrake.systems.framework.DiagramBuilder_[Expression], system: drake::systems::System<drake::symbolic::Expression>) → drake::systems::System<drake::symbolic::Expression>

Takes ownership of system and adds it to the builder. Returns a bare pointer to the System, which will remain valid for the lifetime of the Diagram built by this builder.

If the system’s name is unset, sets it to System::GetMemoryObjectName() as a default in order to have unique names within the diagram.

DiagramBuilder<T> builder;
  auto foo = builder.AddSystem(std::make_unique<Foo<T>>());
Template parameter S:
The type of system to add.
Build(self: pydrake.systems.framework.DiagramBuilder_[Expression]) → drake::systems::Diagram<drake::symbolic::Expression>

Builds the Diagram that has been described by the calls to Connect, ExportInput, and ExportOutput.

Raises:RuntimeError if the graph is not buildable.
BuildInto(self: pydrake.systems.framework.DiagramBuilder_[Expression], target: drake::systems::Diagram<drake::symbolic::Expression>) → None

Configures target to have the topology that has been described by the calls to Connect, ExportInput, and ExportOutput.

Raises:RuntimeError if the graph is not buildable.

Only Diagram subclasses should call this method. The target must not already be initialized.

Connect(self: pydrake.systems.framework.DiagramBuilder_[Expression], arg0: drake::systems::OutputPort<drake::symbolic::Expression>, arg1: drake::systems::InputPort<drake::symbolic::Expression>) → None

Declares that input port dest is connected to output port src.

Note

The connection created between src and dest via a call to this method can be effectively overridden by any subsequent call to InputPort::FixValue(). That is, calling InputPort::FixValue() on an already connected input port causes the resultant FixedInputPortValue to override any other value present on that port.

ConnectInput(*args, **kwargs)

Overloaded function.

  1. ConnectInput(self: pydrake.systems.framework.DiagramBuilder_[Expression], diagram_port_name: str, input: drake::systems::InputPort<drake::symbolic::Expression>) -> None

Connects an input to the entire Diagram, indicated by diagram_port_name, to the given input port of a constituent system.

Precondition:
The Diagram input indicated by diagram_port_name must have been previously built via ExportInput().
Postcondition:
input is connected to the indicated Diagram input port.
  1. ConnectInput(self: pydrake.systems.framework.DiagramBuilder_[Expression], diagram_port_index: pydrake.systems.framework.InputPortIndex, input: drake::systems::InputPort<drake::symbolic::Expression>) -> None

Connects an input to the entire Diagram, indicated by diagram_port_index, to the given input port of a constituent system.

Precondition:
The Diagram input indicated by diagram_port_index must have been previously built via ExportInput().
Postcondition:
input is connected to the indicated Diagram input port.
empty(self: pydrake.systems.framework.DiagramBuilder_[Expression]) → bool

Returns whether any Systems have been added yet.

ExportInput(self: pydrake.systems.framework.DiagramBuilder_[Expression], input: drake::systems::InputPort<drake::symbolic::Expression>, name: Union[str, pydrake.systems.framework.UseDefaultName] = <pydrake.systems.framework.UseDefaultName object at 0x7fb5f27472b0>) → pydrake.systems.framework.InputPortIndex

Declares that the given input port of a constituent system is connected to a new input to the entire Diagram. name is an optional name for the new input port; if it is unspecified, then a default name will be provided.

Precondition:
If supplied at all, name must not be empty.
Precondition:
A port indicated by the resolution of name must not exist.
Postcondition:
input is connected to the new exported input port.
Returns:The index of the exported input port of the entire diagram.
ExportOutput(self: pydrake.systems.framework.DiagramBuilder_[Expression], output: drake::systems::OutputPort<drake::symbolic::Expression>, name: Union[str, pydrake.systems.framework.UseDefaultName] = <pydrake.systems.framework.UseDefaultName object at 0x7fb5f15208f0>) → pydrake.systems.framework.OutputPortIndex

Declares that the given output port of a constituent system is an output of the entire diagram. name is an optional name for the output port; if it is unspecified, then a default name will be provided.

Precondition:
If supplied at all, name must not be empty.
Returns:The index of the exported output port of the entire diagram.
GetMutableSystems(self: pydrake.systems.framework.DiagramBuilder_[Expression]) → list

Returns the list of contained Systems. See also GetSystems().

GetSystems(self: pydrake.systems.framework.DiagramBuilder_[Expression]) → list

Returns the list of contained Systems. See also GetMutableSystems().

class pydrake.systems.framework.DiagramBuilder_[float]

DiagramBuilder is a factory class for Diagram. It is single use: after calling Build or BuildInto, DiagramBuilder gives up ownership of the constituent systems, and should therefore be discarded.

A system must be added to the DiagramBuilder with AddSystem or AddNamedSystem before it can be wired up in any way. Every system must have a unique, non-empty name.

__init__(self: pydrake.systems.framework.DiagramBuilder_[float]) → None
AddNamedSystem(self: pydrake.systems.framework.DiagramBuilder_[float], name: str, system: drake::systems::System<double>) → drake::systems::System<double>

Takes ownership of system, applies name to it, and adds it to the builder. Returns a bare pointer to the System, which will remain valid for the lifetime of the Diagram built by this builder.

DiagramBuilder<T> builder;
  auto bar = builder.AddNamedSystem("bar", std::make_unique<Bar<T>>());
Template parameter S:
The type of system to add.
Postcondition:
The system’s name is name.
AddSystem(self: pydrake.systems.framework.DiagramBuilder_[float], system: drake::systems::System<double>) → drake::systems::System<double>

Takes ownership of system and adds it to the builder. Returns a bare pointer to the System, which will remain valid for the lifetime of the Diagram built by this builder.

If the system’s name is unset, sets it to System::GetMemoryObjectName() as a default in order to have unique names within the diagram.

DiagramBuilder<T> builder;
  auto foo = builder.AddSystem(std::make_unique<Foo<T>>());
Template parameter S:
The type of system to add.
Build(self: pydrake.systems.framework.DiagramBuilder_[float]) → drake::systems::Diagram<double>

Builds the Diagram that has been described by the calls to Connect, ExportInput, and ExportOutput.

Raises:RuntimeError if the graph is not buildable.
BuildInto(self: pydrake.systems.framework.DiagramBuilder_[float], target: drake::systems::Diagram<double>) → None

Configures target to have the topology that has been described by the calls to Connect, ExportInput, and ExportOutput.

Raises:RuntimeError if the graph is not buildable.

Only Diagram subclasses should call this method. The target must not already be initialized.

Connect(self: pydrake.systems.framework.DiagramBuilder_[float], arg0: drake::systems::OutputPort<double>, arg1: drake::systems::InputPort<double>) → None

Declares that input port dest is connected to output port src.

Note

The connection created between src and dest via a call to this method can be effectively overridden by any subsequent call to InputPort::FixValue(). That is, calling InputPort::FixValue() on an already connected input port causes the resultant FixedInputPortValue to override any other value present on that port.

ConnectInput(*args, **kwargs)

Overloaded function.

  1. ConnectInput(self: pydrake.systems.framework.DiagramBuilder_[float], diagram_port_name: str, input: drake::systems::InputPort<double>) -> None

Connects an input to the entire Diagram, indicated by diagram_port_name, to the given input port of a constituent system.

Precondition:
The Diagram input indicated by diagram_port_name must have been previously built via ExportInput().
Postcondition:
input is connected to the indicated Diagram input port.
  1. ConnectInput(self: pydrake.systems.framework.DiagramBuilder_[float], diagram_port_index: pydrake.systems.framework.InputPortIndex, input: drake::systems::InputPort<double>) -> None

Connects an input to the entire Diagram, indicated by diagram_port_index, to the given input port of a constituent system.

Precondition:
The Diagram input indicated by diagram_port_index must have been previously built via ExportInput().
Postcondition:
input is connected to the indicated Diagram input port.
empty(self: pydrake.systems.framework.DiagramBuilder_[float]) → bool

Returns whether any Systems have been added yet.

ExportInput(self: pydrake.systems.framework.DiagramBuilder_[float], input: drake::systems::InputPort<double>, name: Union[str, pydrake.systems.framework.UseDefaultName] = <pydrake.systems.framework.UseDefaultName object at 0x7fb5f277fcb0>) → pydrake.systems.framework.InputPortIndex

Declares that the given input port of a constituent system is connected to a new input to the entire Diagram. name is an optional name for the new input port; if it is unspecified, then a default name will be provided.

Precondition:
If supplied at all, name must not be empty.
Precondition:
A port indicated by the resolution of name must not exist.
Postcondition:
input is connected to the new exported input port.
Returns:The index of the exported input port of the entire diagram.
ExportOutput(self: pydrake.systems.framework.DiagramBuilder_[float], output: drake::systems::OutputPort<double>, name: Union[str, pydrake.systems.framework.UseDefaultName] = <pydrake.systems.framework.UseDefaultName object at 0x7fb5f277fd70>) → pydrake.systems.framework.OutputPortIndex

Declares that the given output port of a constituent system is an output of the entire diagram. name is an optional name for the output port; if it is unspecified, then a default name will be provided.

Precondition:
If supplied at all, name must not be empty.
Returns:The index of the exported output port of the entire diagram.
GetMutableSystems(self: pydrake.systems.framework.DiagramBuilder_[float]) → list

Returns the list of contained Systems. See also GetSystems().

GetSystems(self: pydrake.systems.framework.DiagramBuilder_[float]) → list

Returns the list of contained Systems. See also GetMutableSystems().

class pydrake.systems.framework.DiscreteStateIndex
__init__(self: pydrake.systems.framework.DiscreteStateIndex, arg0: int) → None

Default constructor; the result is an invalid index. This only exists to serve applications which require a default constructor.

is_valid(self: pydrake.systems.framework.DiscreteStateIndex) → bool

Reports if the index is valid–the only operation on an invalid index that doesn’t throw an exception in Debug builds.

pydrake.systems.framework.DiscreteUpdateEvent

alias of pydrake.systems.framework.DiscreteUpdateEvent_[float]

template pydrake.systems.framework.DiscreteUpdateEvent_

Instantiations: DiscreteUpdateEvent_[float], DiscreteUpdateEvent_[AutoDiffXd], DiscreteUpdateEvent_[Expression]

class DiscreteUpdateEvent_[float]

Bases: pydrake.systems.framework.Event_[float]

This class represents a discrete update event. It has an optional callback function to do custom handling of this event given const Context and const DiscreteUpdateEvent references, and writes the updates to a mutable, non-null DiscreteValues object.

__init__

Initialize self. See help(type(self)) for accurate signature.

class pydrake.systems.framework.DiscreteUpdateEvent_[AutoDiffXd]

Bases: pydrake.systems.framework.Event_[AutoDiffXd]

This class represents a discrete update event. It has an optional callback function to do custom handling of this event given const Context and const DiscreteUpdateEvent references, and writes the updates to a mutable, non-null DiscreteValues object.

__init__

Initialize self. See help(type(self)) for accurate signature.

class pydrake.systems.framework.DiscreteUpdateEvent_[Expression]

Bases: pydrake.systems.framework.Event_[Expression]

This class represents a discrete update event. It has an optional callback function to do custom handling of this event given const Context and const DiscreteUpdateEvent references, and writes the updates to a mutable, non-null DiscreteValues object.

__init__

Initialize self. See help(type(self)) for accurate signature.

class pydrake.systems.framework.DiscreteUpdateEvent_[float]

Bases: pydrake.systems.framework.Event_[float]

This class represents a discrete update event. It has an optional callback function to do custom handling of this event given const Context and const DiscreteUpdateEvent references, and writes the updates to a mutable, non-null DiscreteValues object.

__init__

Initialize self. See help(type(self)) for accurate signature.

pydrake.systems.framework.DiscreteValues

alias of pydrake.systems.framework.DiscreteValues_[float]

template pydrake.systems.framework.DiscreteValues_

Instantiations: DiscreteValues_[float], DiscreteValues_[AutoDiffXd], DiscreteValues_[Expression]

class DiscreteValues_[float]

%DiscreteValues is a container for numerical but non-continuous state and parameters. It may own its underlying data, for use with leaf Systems, or not, for use with Diagrams.

DiscreteValues is an ordered collection xd of BasicVector “groups” so xd = [xd₀, xd₁…], where each group xdᵢ is a contiguous vector. Requesting a specific group index from this collection is the most granular way to retrieve discrete values from the Context, and thus is the unit of cache invalidation. System authors are encouraged to partition their DiscreteValues such that each cacheable computation within the System may depend on only the elements of DiscreteValues that it needs.

None of the contained vectors (groups) may be null, although any of them may be zero-length.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.DiscreteValues_[float], datum: pydrake.systems.framework.BasicVector_[float]) -> None

Constructs a one-group DiscreteValues object that owns a single datum vector which may not be null.

  1. __init__(self: pydrake.systems.framework.DiscreteValues_[float], data: List[pydrake.systems.framework.BasicVector_[float]]) -> None

Constructs a DiscreteValues that owns the underlying data. Every entry must be non-null.

  1. __init__(self: pydrake.systems.framework.DiscreteValues_[float]) -> None

Constructs an empty DiscreteValues object containing no groups.

Clone(self: pydrake.systems.framework.DiscreteValues_[float]) → pydrake.systems.framework.DiscreteValues_[float]
get_data(self: pydrake.systems.framework.DiscreteValues_[float]) → List[pydrake.systems.framework.BasicVector_[float]]
get_mutable_vector(self: pydrake.systems.framework.DiscreteValues_[float], index: int = 0) → pydrake.systems.framework.BasicVector_[float]

Returns a mutable reference to the vector holding data for the indicated group.

get_vector(self: pydrake.systems.framework.DiscreteValues_[float], index: int = 0) → pydrake.systems.framework.BasicVector_[float]

Returns a const reference to the vector holding data for the indicated group.

num_groups(self: pydrake.systems.framework.DiscreteValues_[float]) → int
SetFrom(self: pydrake.systems.framework.DiscreteValues_[float], arg0: pydrake.systems.framework.DiscreteValues_[float]) → None

Resets the values in this DiscreteValues from the values in other, possibly writing through to unowned data. Throws if the dimensions don’t match.

size(self: pydrake.systems.framework.DiscreteValues_[float]) → int

Returns the number of elements in the only DiscreteValues group.

class pydrake.systems.framework.DiscreteValues_[AutoDiffXd]

%DiscreteValues is a container for numerical but non-continuous state and parameters. It may own its underlying data, for use with leaf Systems, or not, for use with Diagrams.

DiscreteValues is an ordered collection xd of BasicVector “groups” so xd = [xd₀, xd₁…], where each group xdᵢ is a contiguous vector. Requesting a specific group index from this collection is the most granular way to retrieve discrete values from the Context, and thus is the unit of cache invalidation. System authors are encouraged to partition their DiscreteValues such that each cacheable computation within the System may depend on only the elements of DiscreteValues that it needs.

None of the contained vectors (groups) may be null, although any of them may be zero-length.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.DiscreteValues_[AutoDiffXd], datum: pydrake.systems.framework.BasicVector_[AutoDiffXd]) -> None

Constructs a one-group DiscreteValues object that owns a single datum vector which may not be null.

  1. __init__(self: pydrake.systems.framework.DiscreteValues_[AutoDiffXd], data: List[pydrake.systems.framework.BasicVector_[AutoDiffXd]]) -> None

Constructs a DiscreteValues that owns the underlying data. Every entry must be non-null.

  1. __init__(self: pydrake.systems.framework.DiscreteValues_[AutoDiffXd]) -> None

Constructs an empty DiscreteValues object containing no groups.

Clone(self: pydrake.systems.framework.DiscreteValues_[AutoDiffXd]) → pydrake.systems.framework.DiscreteValues_[AutoDiffXd]
get_data(self: pydrake.systems.framework.DiscreteValues_[AutoDiffXd]) → List[pydrake.systems.framework.BasicVector_[AutoDiffXd]]
get_mutable_vector(self: pydrake.systems.framework.DiscreteValues_[AutoDiffXd], index: int = 0) → pydrake.systems.framework.BasicVector_[AutoDiffXd]

Returns a mutable reference to the vector holding data for the indicated group.

get_vector(self: pydrake.systems.framework.DiscreteValues_[AutoDiffXd], index: int = 0) → pydrake.systems.framework.BasicVector_[AutoDiffXd]

Returns a const reference to the vector holding data for the indicated group.

num_groups(self: pydrake.systems.framework.DiscreteValues_[AutoDiffXd]) → int
SetFrom(self: pydrake.systems.framework.DiscreteValues_[AutoDiffXd], arg0: pydrake.systems.framework.DiscreteValues_[float]) → None

Resets the values in this DiscreteValues from the values in other, possibly writing through to unowned data. Throws if the dimensions don’t match.

size(self: pydrake.systems.framework.DiscreteValues_[AutoDiffXd]) → int

Returns the number of elements in the only DiscreteValues group.

class pydrake.systems.framework.DiscreteValues_[Expression]

%DiscreteValues is a container for numerical but non-continuous state and parameters. It may own its underlying data, for use with leaf Systems, or not, for use with Diagrams.

DiscreteValues is an ordered collection xd of BasicVector “groups” so xd = [xd₀, xd₁…], where each group xdᵢ is a contiguous vector. Requesting a specific group index from this collection is the most granular way to retrieve discrete values from the Context, and thus is the unit of cache invalidation. System authors are encouraged to partition their DiscreteValues such that each cacheable computation within the System may depend on only the elements of DiscreteValues that it needs.

None of the contained vectors (groups) may be null, although any of them may be zero-length.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.DiscreteValues_[Expression], datum: pydrake.systems.framework.BasicVector_[Expression]) -> None

Constructs a one-group DiscreteValues object that owns a single datum vector which may not be null.

  1. __init__(self: pydrake.systems.framework.DiscreteValues_[Expression], data: List[pydrake.systems.framework.BasicVector_[Expression]]) -> None

Constructs a DiscreteValues that owns the underlying data. Every entry must be non-null.

  1. __init__(self: pydrake.systems.framework.DiscreteValues_[Expression]) -> None

Constructs an empty DiscreteValues object containing no groups.

Clone(self: pydrake.systems.framework.DiscreteValues_[Expression]) → pydrake.systems.framework.DiscreteValues_[Expression]
get_data(self: pydrake.systems.framework.DiscreteValues_[Expression]) → List[pydrake.systems.framework.BasicVector_[Expression]]
get_mutable_vector(self: pydrake.systems.framework.DiscreteValues_[Expression], index: int = 0) → pydrake.systems.framework.BasicVector_[Expression]

Returns a mutable reference to the vector holding data for the indicated group.

get_vector(self: pydrake.systems.framework.DiscreteValues_[Expression], index: int = 0) → pydrake.systems.framework.BasicVector_[Expression]

Returns a const reference to the vector holding data for the indicated group.

num_groups(self: pydrake.systems.framework.DiscreteValues_[Expression]) → int
SetFrom(self: pydrake.systems.framework.DiscreteValues_[Expression], arg0: pydrake.systems.framework.DiscreteValues_[float]) → None

Resets the values in this DiscreteValues from the values in other, possibly writing through to unowned data. Throws if the dimensions don’t match.

size(self: pydrake.systems.framework.DiscreteValues_[Expression]) → int

Returns the number of elements in the only DiscreteValues group.

class pydrake.systems.framework.DiscreteValues_[float]

%DiscreteValues is a container for numerical but non-continuous state and parameters. It may own its underlying data, for use with leaf Systems, or not, for use with Diagrams.

DiscreteValues is an ordered collection xd of BasicVector “groups” so xd = [xd₀, xd₁…], where each group xdᵢ is a contiguous vector. Requesting a specific group index from this collection is the most granular way to retrieve discrete values from the Context, and thus is the unit of cache invalidation. System authors are encouraged to partition their DiscreteValues such that each cacheable computation within the System may depend on only the elements of DiscreteValues that it needs.

None of the contained vectors (groups) may be null, although any of them may be zero-length.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.DiscreteValues_[float], datum: pydrake.systems.framework.BasicVector_[float]) -> None

Constructs a one-group DiscreteValues object that owns a single datum vector which may not be null.

  1. __init__(self: pydrake.systems.framework.DiscreteValues_[float], data: List[pydrake.systems.framework.BasicVector_[float]]) -> None

Constructs a DiscreteValues that owns the underlying data. Every entry must be non-null.

  1. __init__(self: pydrake.systems.framework.DiscreteValues_[float]) -> None

Constructs an empty DiscreteValues object containing no groups.

Clone(self: pydrake.systems.framework.DiscreteValues_[float]) → pydrake.systems.framework.DiscreteValues_[float]
get_data(self: pydrake.systems.framework.DiscreteValues_[float]) → List[pydrake.systems.framework.BasicVector_[float]]
get_mutable_vector(self: pydrake.systems.framework.DiscreteValues_[float], index: int = 0) → pydrake.systems.framework.BasicVector_[float]

Returns a mutable reference to the vector holding data for the indicated group.

get_vector(self: pydrake.systems.framework.DiscreteValues_[float], index: int = 0) → pydrake.systems.framework.BasicVector_[float]

Returns a const reference to the vector holding data for the indicated group.

num_groups(self: pydrake.systems.framework.DiscreteValues_[float]) → int
SetFrom(self: pydrake.systems.framework.DiscreteValues_[float], arg0: pydrake.systems.framework.DiscreteValues_[float]) → None

Resets the values in this DiscreteValues from the values in other, possibly writing through to unowned data. Throws if the dimensions don’t match.

size(self: pydrake.systems.framework.DiscreteValues_[float]) → int

Returns the number of elements in the only DiscreteValues group.

pydrake.systems.framework.Event

alias of pydrake.systems.framework.Event_[float]

template pydrake.systems.framework.Event_

Instantiations: Event_[float], Event_[AutoDiffXd], Event_[Expression]

class Event_[float]

Abstract base class that represents an event. The base event contains two main pieces of information: an enum trigger type and an optional attribute of AbstractValue that can be used to explain why the event is triggered. Derived classes should contain a function pointer to an optional callback function that handles the event. No-op is the default handling behavior. Currently, the System framework only supports three concrete event types: PublishEvent, DiscreteUpdateEvent, and UnrestrictedUpdateEvent distinguished by their callback functions’ write access level to the State.

Event handling occurs during a simulation of a system. The logic that describes when particular event types are handled is described in the class documentation for Simulator.

__init__

Initialize self. See help(type(self)) for accurate signature.

get_trigger_type(self: pydrake.systems.framework.Event_[float]) → pydrake.systems.framework.TriggerType

Returns the trigger type.

class pydrake.systems.framework.Event_[AutoDiffXd]

Abstract base class that represents an event. The base event contains two main pieces of information: an enum trigger type and an optional attribute of AbstractValue that can be used to explain why the event is triggered. Derived classes should contain a function pointer to an optional callback function that handles the event. No-op is the default handling behavior. Currently, the System framework only supports three concrete event types: PublishEvent, DiscreteUpdateEvent, and UnrestrictedUpdateEvent distinguished by their callback functions’ write access level to the State.

Event handling occurs during a simulation of a system. The logic that describes when particular event types are handled is described in the class documentation for Simulator.

__init__

Initialize self. See help(type(self)) for accurate signature.

get_trigger_type(self: pydrake.systems.framework.Event_[AutoDiffXd]) → pydrake.systems.framework.TriggerType

Returns the trigger type.

class pydrake.systems.framework.Event_[Expression]

Abstract base class that represents an event. The base event contains two main pieces of information: an enum trigger type and an optional attribute of AbstractValue that can be used to explain why the event is triggered. Derived classes should contain a function pointer to an optional callback function that handles the event. No-op is the default handling behavior. Currently, the System framework only supports three concrete event types: PublishEvent, DiscreteUpdateEvent, and UnrestrictedUpdateEvent distinguished by their callback functions’ write access level to the State.

Event handling occurs during a simulation of a system. The logic that describes when particular event types are handled is described in the class documentation for Simulator.

__init__

Initialize self. See help(type(self)) for accurate signature.

get_trigger_type(self: pydrake.systems.framework.Event_[Expression]) → pydrake.systems.framework.TriggerType

Returns the trigger type.

class pydrake.systems.framework.Event_[float]

Abstract base class that represents an event. The base event contains two main pieces of information: an enum trigger type and an optional attribute of AbstractValue that can be used to explain why the event is triggered. Derived classes should contain a function pointer to an optional callback function that handles the event. No-op is the default handling behavior. Currently, the System framework only supports three concrete event types: PublishEvent, DiscreteUpdateEvent, and UnrestrictedUpdateEvent distinguished by their callback functions’ write access level to the State.

Event handling occurs during a simulation of a system. The logic that describes when particular event types are handled is described in the class documentation for Simulator.

__init__

Initialize self. See help(type(self)) for accurate signature.

get_trigger_type(self: pydrake.systems.framework.Event_[float]) → pydrake.systems.framework.TriggerType

Returns the trigger type.

class pydrake.systems.framework.EventData

Base class for storing trigger-specific data to be passed to event handlers.

__init__

Initialize self. See help(type(self)) for accurate signature.

Clone(self: pydrake.systems.framework.EventData) → pydrake.systems.framework.EventData
class pydrake.systems.framework.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. Drake API users will typically use only the four factory methods below to return status, and optionally a human-readable message, from their event handlers.

__init__

Initialize self. See help(type(self)) for accurate signature.

static DidNothing() → pydrake.systems.framework.EventStatus

Returns “did nothing” status, with no message.

static Failed(system: drake::systems::SystemBase, message: str) → pydrake.systems.framework.EventStatus

Returns “failed” status, with a message explaining why.

KeepMoreSevere(self: pydrake.systems.framework.EventStatus, candidate: pydrake.systems.framework.EventStatus) → pydrake.systems.framework.EventStatus

(Advanced) Replaces the contents of this with the more-severe status if candidate is a more severe status than this one. Does nothing if candidate severity is less than or equal to this severity. This method is for use in event dispatchers for accumulating status returns from a series of event handlers for a set of simultaneous events.

message(self: pydrake.systems.framework.EventStatus) → str

Returns the optionally-provided human-readable message supplied by the event handler that produced the current status. Returns an empty string if no message was provided.

static ReachedTermination(system: drake::systems::SystemBase, message: str) → pydrake.systems.framework.EventStatus

Returns “reached termination” status, with a message explaining why.

class Severity

The numerical values are ordered, with did_nothing < success < terminate < fatal.

Members:

kDidNothing : Successful, but nothing happened; no state update needed.

kSucceeded : Handler executed successfully; state may have been updated.

kReachedTermination : Handler succeeded but detected a termination condition (has message).

kFailed : Handler was unable to perform its job (has message).

__init__(self: pydrake.systems.framework.EventStatus.Severity, value: int) → None
kDidNothing = <Severity.kDidNothing: 0>
kFailed = <Severity.kFailed: 3>
kReachedTermination = <Severity.kReachedTermination: 2>
kSucceeded = <Severity.kSucceeded: 1>
name
value
severity(self: pydrake.systems.framework.EventStatus) → pydrake.systems.framework.EventStatus.Severity

Returns the severity of the current status.

static Succeeded() → pydrake.systems.framework.EventStatus

Returns “succeeded” status, with no message.

system(self: pydrake.systems.framework.EventStatus) → drake::systems::SystemBase

Returns the optionally-provided subsystem that generated a status return that can include a message (reached termination or failed). Returns nullptr if no subsystem was provided.

class pydrake.systems.framework.FixedInputPortValue

A FixedInputPortValue encapsulates a vector or abstract value for use as an internal value source for one of a System’s input ports. The semantics are identical to a Parameter. We assign a DependencyTracker to this object and subscribe the InputPort to it when that port is fixed. Any modification to the value here issues a notification to its dependent, and increments a serial number kept here.

__init__

Initialize self. See help(type(self)) for accurate signature.

GetMutableData(self: pydrake.systems.framework.FixedInputPortValue) → pydrake.common.value.AbstractValue

Returns a pointer to the data inside this FixedInputPortValue, and notifies the dependent input port that the value has changed.

To ensure invalidation notifications are delivered, callers should call this method every time they wish to update the stored value. In particular, callers MUST NOT write through the returned pointer if there is any possibility this FixedInputPortValue has been accessed since the last time this method was called.

pydrake.systems.framework.GenerateHtml(system: drake::systems::System<double>, initial_depth: int = 1) → str

Generates an html string to “render” the system, with collapsible diagrams. Use initial_depth to set the depth to which the subdiagrams are expanded by default (0 for all collapsed, +∞ for all expanded).

Warning

The implementation of GenerateHtml has been temporarily removed from Drake due to licensing restrictions. This function will return valid HTML, but will not produce any useful rendering.

pydrake.systems.framework.InputPort

alias of pydrake.systems.framework.InputPort_[float]

template pydrake.systems.framework.InputPort_

Instantiations: InputPort_[float], InputPort_[AutoDiffXd], InputPort_[Expression]

class InputPort_[float]

An InputPort is a System resource that describes the kind of input a System accepts, on a given port. It does not directly contain any runtime input port data; that is always contained in a Context. The actual value will be either the value of an OutputPort to which this is connected, or a fixed value set in a Context.

__init__

Initialize self. See help(type(self)) for accurate signature.

Eval(self: pydrake.systems.framework.InputPort_[float], arg0: pydrake.systems.framework.Context_[float]) → object
EvalAbstract(self: pydrake.systems.framework.InputPort_[float], context: pydrake.systems.framework.Context_[float]) → pydrake.common.value.AbstractValue

(Advanced.) Returns the value of this input port, typed as an AbstractValue. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts an AbstractValue.

EvalBasicVector(self: pydrake.systems.framework.InputPort_[float], context: pydrake.systems.framework.Context_[float]) → object

(Advanced.) Returns the value of this input port, typed as a BasicVector. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts a BasicVector.

FixValue(*args, **kwargs)

Overloaded function.

  1. FixValue(self: pydrake.systems.framework.InputPort_[float], context: pydrake.systems.framework.Context_[float], value: pydrake.common.value.AbstractValue) -> pydrake.systems.framework.FixedInputPortValue

Provides a fixed value for this InputPort in the given Context. If the port is already connected, this value will override the connected source value. (By “connected” we mean that the port appeared in a DiagramBuilder::Connect() call.)

For vector-valued input ports, you can provide an Eigen vector expression, a BasicVector object, or a scalar (treated as a Vector1). In each of these cases the value is copied into a Value<BasicVector>. If the original value was a BasicVector-derived object, its concrete type is maintained although the stored type is still Value<BasicVector>. The supplied vector must have the right size for the vector port or an RuntimeError is thrown.

For abstract-valued input ports, you can provide any ValueType that is compatible with the model type provided when the port was declared. If the type has a copy constructor it will be copied into a Value<ValueType> object for storage. Otherwise it must have an accessible Clone() method and it is stored using the type returned by that method, which must be ValueType or a base class of ValueType. Eigen objects and expressions are not accepted directly, but you can store then in abstract ports by providing an already-abstract object like Value<MatrixXd>(your_matrix).

The returned FixedInputPortValue reference may be used to modify the input port’s value subsequently using the appropriate FixedInputPortValue method, which will ensure that cache invalidation notifications are delivered.

Template parameter ValueType:
The type of the supplied value object. This will be inferred so no template argument need be specified. The type must be copy constructible or have an accessible Clone() method.
Parameter context:
A Context that is compatible with the System that owns this port.
Parameter value:
The fixed value for this port. Must be convertible to the input port’s data type.
Returns:a reference to the the FixedInputPortValue object in the Context that contains this port’s value.
Precondition:
context is compatible with the System that owns this InputPort.
Precondition:
value is compatible with this InputPort’s data type.
  1. FixValue(self: pydrake.systems.framework.InputPort_[float], context: pydrake.systems.framework.Context_[float], value: object) -> pydrake.systems.framework.FixedInputPortValue

Provides a fixed value for this InputPort in the given Context. If the port is already connected, this value will override the connected source value. (By “connected” we mean that the port appeared in a DiagramBuilder::Connect() call.)

For vector-valued input ports, you can provide an Eigen vector expression, a BasicVector object, or a scalar (treated as a Vector1). In each of these cases the value is copied into a Value<BasicVector>. If the original value was a BasicVector-derived object, its concrete type is maintained although the stored type is still Value<BasicVector>. The supplied vector must have the right size for the vector port or an RuntimeError is thrown.

For abstract-valued input ports, you can provide any ValueType that is compatible with the model type provided when the port was declared. If the type has a copy constructor it will be copied into a Value<ValueType> object for storage. Otherwise it must have an accessible Clone() method and it is stored using the type returned by that method, which must be ValueType or a base class of ValueType. Eigen objects and expressions are not accepted directly, but you can store then in abstract ports by providing an already-abstract object like Value<MatrixXd>(your_matrix).

The returned FixedInputPortValue reference may be used to modify the input port’s value subsequently using the appropriate FixedInputPortValue method, which will ensure that cache invalidation notifications are delivered.

Template parameter ValueType:
The type of the supplied value object. This will be inferred so no template argument need be specified. The type must be copy constructible or have an accessible Clone() method.
Parameter context:
A Context that is compatible with the System that owns this port.
Parameter value:
The fixed value for this port. Must be convertible to the input port’s data type.
Returns:a reference to the the FixedInputPortValue object in the Context that contains this port’s value.
Precondition:
context is compatible with the System that owns this InputPort.
Precondition:
value is compatible with this InputPort’s data type.
get_data_type(self: pydrake.systems.framework.InputPort_[float]) → pydrake.systems.framework.PortDataType

Returns the port data type.

get_index(self: pydrake.systems.framework.InputPort_[float]) → pydrake.systems.framework.InputPortIndex

Returns the index of this input port within the owning System. For a Diagram, this will be the index within the Diagram, not the index within a LeafSystem whose input port was exported.

get_name(self: pydrake.systems.framework.InputPort_[float]) → str

Get port name.

get_system(self: pydrake.systems.framework.InputPort_[float]) → drake::systems::System<double>

Returns a reference to the System that owns this input port. Note that for a Diagram input port this will be the Diagram, not the LeafSystem whose input port was exported.

GetFullDescription(self: pydrake.systems.framework.InputPort_[float]) → str

Returns a verbose human-readable description of port. This is useful for error messages or debugging.

HasValue(self: pydrake.systems.framework.InputPort_[float], context: pydrake.systems.framework.Context_[float]) → bool

Returns true iff this port is connected or has had a fixed value provided in the given Context. Beware that at the moment, this could be an expensive operation, because the value is brought up-to-date as part of this operation.

size(self: pydrake.systems.framework.InputPort_[float]) → int

Returns the fixed size expected for a vector-valued port. Not meaningful for abstract-valued ports.

ticket(self: pydrake.systems.framework.InputPort_[float]) → pydrake.systems.framework.DependencyTicket

(Advanced.) Returns the DependencyTicket for this port within the owning System.

class pydrake.systems.framework.InputPort_[AutoDiffXd]

An InputPort is a System resource that describes the kind of input a System accepts, on a given port. It does not directly contain any runtime input port data; that is always contained in a Context. The actual value will be either the value of an OutputPort to which this is connected, or a fixed value set in a Context.

__init__

Initialize self. See help(type(self)) for accurate signature.

Eval(self: pydrake.systems.framework.InputPort_[AutoDiffXd], arg0: pydrake.systems.framework.Context_[AutoDiffXd]) → object
EvalAbstract(self: pydrake.systems.framework.InputPort_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.common.value.AbstractValue

(Advanced.) Returns the value of this input port, typed as an AbstractValue. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts an AbstractValue.

EvalBasicVector(self: pydrake.systems.framework.InputPort_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) → object

(Advanced.) Returns the value of this input port, typed as a BasicVector. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts a BasicVector.

FixValue(*args, **kwargs)

Overloaded function.

  1. FixValue(self: pydrake.systems.framework.InputPort_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], value: pydrake.common.value.AbstractValue) -> pydrake.systems.framework.FixedInputPortValue

Provides a fixed value for this InputPort in the given Context. If the port is already connected, this value will override the connected source value. (By “connected” we mean that the port appeared in a DiagramBuilder::Connect() call.)

For vector-valued input ports, you can provide an Eigen vector expression, a BasicVector object, or a scalar (treated as a Vector1). In each of these cases the value is copied into a Value<BasicVector>. If the original value was a BasicVector-derived object, its concrete type is maintained although the stored type is still Value<BasicVector>. The supplied vector must have the right size for the vector port or an RuntimeError is thrown.

For abstract-valued input ports, you can provide any ValueType that is compatible with the model type provided when the port was declared. If the type has a copy constructor it will be copied into a Value<ValueType> object for storage. Otherwise it must have an accessible Clone() method and it is stored using the type returned by that method, which must be ValueType or a base class of ValueType. Eigen objects and expressions are not accepted directly, but you can store then in abstract ports by providing an already-abstract object like Value<MatrixXd>(your_matrix).

The returned FixedInputPortValue reference may be used to modify the input port’s value subsequently using the appropriate FixedInputPortValue method, which will ensure that cache invalidation notifications are delivered.

Template parameter ValueType:
The type of the supplied value object. This will be inferred so no template argument need be specified. The type must be copy constructible or have an accessible Clone() method.
Parameter context:
A Context that is compatible with the System that owns this port.
Parameter value:
The fixed value for this port. Must be convertible to the input port’s data type.
Returns:a reference to the the FixedInputPortValue object in the Context that contains this port’s value.
Precondition:
context is compatible with the System that owns this InputPort.
Precondition:
value is compatible with this InputPort’s data type.
  1. FixValue(self: pydrake.systems.framework.InputPort_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], value: object) -> pydrake.systems.framework.FixedInputPortValue

Provides a fixed value for this InputPort in the given Context. If the port is already connected, this value will override the connected source value. (By “connected” we mean that the port appeared in a DiagramBuilder::Connect() call.)

For vector-valued input ports, you can provide an Eigen vector expression, a BasicVector object, or a scalar (treated as a Vector1). In each of these cases the value is copied into a Value<BasicVector>. If the original value was a BasicVector-derived object, its concrete type is maintained although the stored type is still Value<BasicVector>. The supplied vector must have the right size for the vector port or an RuntimeError is thrown.

For abstract-valued input ports, you can provide any ValueType that is compatible with the model type provided when the port was declared. If the type has a copy constructor it will be copied into a Value<ValueType> object for storage. Otherwise it must have an accessible Clone() method and it is stored using the type returned by that method, which must be ValueType or a base class of ValueType. Eigen objects and expressions are not accepted directly, but you can store then in abstract ports by providing an already-abstract object like Value<MatrixXd>(your_matrix).

The returned FixedInputPortValue reference may be used to modify the input port’s value subsequently using the appropriate FixedInputPortValue method, which will ensure that cache invalidation notifications are delivered.

Template parameter ValueType:
The type of the supplied value object. This will be inferred so no template argument need be specified. The type must be copy constructible or have an accessible Clone() method.
Parameter context:
A Context that is compatible with the System that owns this port.
Parameter value:
The fixed value for this port. Must be convertible to the input port’s data type.
Returns:a reference to the the FixedInputPortValue object in the Context that contains this port’s value.
Precondition:
context is compatible with the System that owns this InputPort.
Precondition:
value is compatible with this InputPort’s data type.
get_data_type(self: pydrake.systems.framework.InputPort_[AutoDiffXd]) → pydrake.systems.framework.PortDataType

Returns the port data type.

get_index(self: pydrake.systems.framework.InputPort_[AutoDiffXd]) → pydrake.systems.framework.InputPortIndex

Returns the index of this input port within the owning System. For a Diagram, this will be the index within the Diagram, not the index within a LeafSystem whose input port was exported.

get_name(self: pydrake.systems.framework.InputPort_[AutoDiffXd]) → str

Get port name.

get_system(self: pydrake.systems.framework.InputPort_[AutoDiffXd]) → drake::systems::System<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Returns a reference to the System that owns this input port. Note that for a Diagram input port this will be the Diagram, not the LeafSystem whose input port was exported.

GetFullDescription(self: pydrake.systems.framework.InputPort_[AutoDiffXd]) → str

Returns a verbose human-readable description of port. This is useful for error messages or debugging.

HasValue(self: pydrake.systems.framework.InputPort_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) → bool

Returns true iff this port is connected or has had a fixed value provided in the given Context. Beware that at the moment, this could be an expensive operation, because the value is brought up-to-date as part of this operation.

size(self: pydrake.systems.framework.InputPort_[AutoDiffXd]) → int

Returns the fixed size expected for a vector-valued port. Not meaningful for abstract-valued ports.

ticket(self: pydrake.systems.framework.InputPort_[AutoDiffXd]) → pydrake.systems.framework.DependencyTicket

(Advanced.) Returns the DependencyTicket for this port within the owning System.

class pydrake.systems.framework.InputPort_[Expression]

An InputPort is a System resource that describes the kind of input a System accepts, on a given port. It does not directly contain any runtime input port data; that is always contained in a Context. The actual value will be either the value of an OutputPort to which this is connected, or a fixed value set in a Context.

__init__

Initialize self. See help(type(self)) for accurate signature.

Eval(self: pydrake.systems.framework.InputPort_[Expression], arg0: pydrake.systems.framework.Context_[Expression]) → object
EvalAbstract(self: pydrake.systems.framework.InputPort_[Expression], context: pydrake.systems.framework.Context_[Expression]) → pydrake.common.value.AbstractValue

(Advanced.) Returns the value of this input port, typed as an AbstractValue. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts an AbstractValue.

EvalBasicVector(self: pydrake.systems.framework.InputPort_[Expression], context: pydrake.systems.framework.Context_[Expression]) → object

(Advanced.) Returns the value of this input port, typed as a BasicVector. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts a BasicVector.

FixValue(*args, **kwargs)

Overloaded function.

  1. FixValue(self: pydrake.systems.framework.InputPort_[Expression], context: pydrake.systems.framework.Context_[Expression], value: pydrake.common.value.AbstractValue) -> pydrake.systems.framework.FixedInputPortValue

Provides a fixed value for this InputPort in the given Context. If the port is already connected, this value will override the connected source value. (By “connected” we mean that the port appeared in a DiagramBuilder::Connect() call.)

For vector-valued input ports, you can provide an Eigen vector expression, a BasicVector object, or a scalar (treated as a Vector1). In each of these cases the value is copied into a Value<BasicVector>. If the original value was a BasicVector-derived object, its concrete type is maintained although the stored type is still Value<BasicVector>. The supplied vector must have the right size for the vector port or an RuntimeError is thrown.

For abstract-valued input ports, you can provide any ValueType that is compatible with the model type provided when the port was declared. If the type has a copy constructor it will be copied into a Value<ValueType> object for storage. Otherwise it must have an accessible Clone() method and it is stored using the type returned by that method, which must be ValueType or a base class of ValueType. Eigen objects and expressions are not accepted directly, but you can store then in abstract ports by providing an already-abstract object like Value<MatrixXd>(your_matrix).

The returned FixedInputPortValue reference may be used to modify the input port’s value subsequently using the appropriate FixedInputPortValue method, which will ensure that cache invalidation notifications are delivered.

Template parameter ValueType:
The type of the supplied value object. This will be inferred so no template argument need be specified. The type must be copy constructible or have an accessible Clone() method.
Parameter context:
A Context that is compatible with the System that owns this port.
Parameter value:
The fixed value for this port. Must be convertible to the input port’s data type.
Returns:a reference to the the FixedInputPortValue object in the Context that contains this port’s value.
Precondition:
context is compatible with the System that owns this InputPort.
Precondition:
value is compatible with this InputPort’s data type.
  1. FixValue(self: pydrake.systems.framework.InputPort_[Expression], context: pydrake.systems.framework.Context_[Expression], value: object) -> pydrake.systems.framework.FixedInputPortValue

Provides a fixed value for this InputPort in the given Context. If the port is already connected, this value will override the connected source value. (By “connected” we mean that the port appeared in a DiagramBuilder::Connect() call.)

For vector-valued input ports, you can provide an Eigen vector expression, a BasicVector object, or a scalar (treated as a Vector1). In each of these cases the value is copied into a Value<BasicVector>. If the original value was a BasicVector-derived object, its concrete type is maintained although the stored type is still Value<BasicVector>. The supplied vector must have the right size for the vector port or an RuntimeError is thrown.

For abstract-valued input ports, you can provide any ValueType that is compatible with the model type provided when the port was declared. If the type has a copy constructor it will be copied into a Value<ValueType> object for storage. Otherwise it must have an accessible Clone() method and it is stored using the type returned by that method, which must be ValueType or a base class of ValueType. Eigen objects and expressions are not accepted directly, but you can store then in abstract ports by providing an already-abstract object like Value<MatrixXd>(your_matrix).

The returned FixedInputPortValue reference may be used to modify the input port’s value subsequently using the appropriate FixedInputPortValue method, which will ensure that cache invalidation notifications are delivered.

Template parameter ValueType:
The type of the supplied value object. This will be inferred so no template argument need be specified. The type must be copy constructible or have an accessible Clone() method.
Parameter context:
A Context that is compatible with the System that owns this port.
Parameter value:
The fixed value for this port. Must be convertible to the input port’s data type.
Returns:a reference to the the FixedInputPortValue object in the Context that contains this port’s value.
Precondition:
context is compatible with the System that owns this InputPort.
Precondition:
value is compatible with this InputPort’s data type.
get_data_type(self: pydrake.systems.framework.InputPort_[Expression]) → pydrake.systems.framework.PortDataType

Returns the port data type.

get_index(self: pydrake.systems.framework.InputPort_[Expression]) → pydrake.systems.framework.InputPortIndex

Returns the index of this input port within the owning System. For a Diagram, this will be the index within the Diagram, not the index within a LeafSystem whose input port was exported.

get_name(self: pydrake.systems.framework.InputPort_[Expression]) → str

Get port name.

get_system(self: pydrake.systems.framework.InputPort_[Expression]) → drake::systems::System<drake::symbolic::Expression>

Returns a reference to the System that owns this input port. Note that for a Diagram input port this will be the Diagram, not the LeafSystem whose input port was exported.

GetFullDescription(self: pydrake.systems.framework.InputPort_[Expression]) → str

Returns a verbose human-readable description of port. This is useful for error messages or debugging.

HasValue(self: pydrake.systems.framework.InputPort_[Expression], context: pydrake.systems.framework.Context_[Expression]) → bool

Returns true iff this port is connected or has had a fixed value provided in the given Context. Beware that at the moment, this could be an expensive operation, because the value is brought up-to-date as part of this operation.

size(self: pydrake.systems.framework.InputPort_[Expression]) → int

Returns the fixed size expected for a vector-valued port. Not meaningful for abstract-valued ports.

ticket(self: pydrake.systems.framework.InputPort_[Expression]) → pydrake.systems.framework.DependencyTicket

(Advanced.) Returns the DependencyTicket for this port within the owning System.

class pydrake.systems.framework.InputPort_[float]

An InputPort is a System resource that describes the kind of input a System accepts, on a given port. It does not directly contain any runtime input port data; that is always contained in a Context. The actual value will be either the value of an OutputPort to which this is connected, or a fixed value set in a Context.

__init__

Initialize self. See help(type(self)) for accurate signature.

Eval(self: pydrake.systems.framework.InputPort_[float], arg0: pydrake.systems.framework.Context_[float]) → object
EvalAbstract(self: pydrake.systems.framework.InputPort_[float], context: pydrake.systems.framework.Context_[float]) → pydrake.common.value.AbstractValue

(Advanced.) Returns the value of this input port, typed as an AbstractValue. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts an AbstractValue.

EvalBasicVector(self: pydrake.systems.framework.InputPort_[float], context: pydrake.systems.framework.Context_[float]) → object

(Advanced.) Returns the value of this input port, typed as a BasicVector. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts a BasicVector.

FixValue(*args, **kwargs)

Overloaded function.

  1. FixValue(self: pydrake.systems.framework.InputPort_[float], context: pydrake.systems.framework.Context_[float], value: pydrake.common.value.AbstractValue) -> pydrake.systems.framework.FixedInputPortValue

Provides a fixed value for this InputPort in the given Context. If the port is already connected, this value will override the connected source value. (By “connected” we mean that the port appeared in a DiagramBuilder::Connect() call.)

For vector-valued input ports, you can provide an Eigen vector expression, a BasicVector object, or a scalar (treated as a Vector1). In each of these cases the value is copied into a Value<BasicVector>. If the original value was a BasicVector-derived object, its concrete type is maintained although the stored type is still Value<BasicVector>. The supplied vector must have the right size for the vector port or an RuntimeError is thrown.

For abstract-valued input ports, you can provide any ValueType that is compatible with the model type provided when the port was declared. If the type has a copy constructor it will be copied into a Value<ValueType> object for storage. Otherwise it must have an accessible Clone() method and it is stored using the type returned by that method, which must be ValueType or a base class of ValueType. Eigen objects and expressions are not accepted directly, but you can store then in abstract ports by providing an already-abstract object like Value<MatrixXd>(your_matrix).

The returned FixedInputPortValue reference may be used to modify the input port’s value subsequently using the appropriate FixedInputPortValue method, which will ensure that cache invalidation notifications are delivered.

Template parameter ValueType:
The type of the supplied value object. This will be inferred so no template argument need be specified. The type must be copy constructible or have an accessible Clone() method.
Parameter context:
A Context that is compatible with the System that owns this port.
Parameter value:
The fixed value for this port. Must be convertible to the input port’s data type.
Returns:a reference to the the FixedInputPortValue object in the Context that contains this port’s value.
Precondition:
context is compatible with the System that owns this InputPort.
Precondition:
value is compatible with this InputPort’s data type.
  1. FixValue(self: pydrake.systems.framework.InputPort_[float], context: pydrake.systems.framework.Context_[float], value: object) -> pydrake.systems.framework.FixedInputPortValue

Provides a fixed value for this InputPort in the given Context. If the port is already connected, this value will override the connected source value. (By “connected” we mean that the port appeared in a DiagramBuilder::Connect() call.)

For vector-valued input ports, you can provide an Eigen vector expression, a BasicVector object, or a scalar (treated as a Vector1). In each of these cases the value is copied into a Value<BasicVector>. If the original value was a BasicVector-derived object, its concrete type is maintained although the stored type is still Value<BasicVector>. The supplied vector must have the right size for the vector port or an RuntimeError is thrown.

For abstract-valued input ports, you can provide any ValueType that is compatible with the model type provided when the port was declared. If the type has a copy constructor it will be copied into a Value<ValueType> object for storage. Otherwise it must have an accessible Clone() method and it is stored using the type returned by that method, which must be ValueType or a base class of ValueType. Eigen objects and expressions are not accepted directly, but you can store then in abstract ports by providing an already-abstract object like Value<MatrixXd>(your_matrix).

The returned FixedInputPortValue reference may be used to modify the input port’s value subsequently using the appropriate FixedInputPortValue method, which will ensure that cache invalidation notifications are delivered.

Template parameter ValueType:
The type of the supplied value object. This will be inferred so no template argument need be specified. The type must be copy constructible or have an accessible Clone() method.
Parameter context:
A Context that is compatible with the System that owns this port.
Parameter value:
The fixed value for this port. Must be convertible to the input port’s data type.
Returns:a reference to the the FixedInputPortValue object in the Context that contains this port’s value.
Precondition:
context is compatible with the System that owns this InputPort.
Precondition:
value is compatible with this InputPort’s data type.
get_data_type(self: pydrake.systems.framework.InputPort_[float]) → pydrake.systems.framework.PortDataType

Returns the port data type.

get_index(self: pydrake.systems.framework.InputPort_[float]) → pydrake.systems.framework.InputPortIndex

Returns the index of this input port within the owning System. For a Diagram, this will be the index within the Diagram, not the index within a LeafSystem whose input port was exported.

get_name(self: pydrake.systems.framework.InputPort_[float]) → str

Get port name.

get_system(self: pydrake.systems.framework.InputPort_[float]) → drake::systems::System<double>

Returns a reference to the System that owns this input port. Note that for a Diagram input port this will be the Diagram, not the LeafSystem whose input port was exported.

GetFullDescription(self: pydrake.systems.framework.InputPort_[float]) → str

Returns a verbose human-readable description of port. This is useful for error messages or debugging.

HasValue(self: pydrake.systems.framework.InputPort_[float], context: pydrake.systems.framework.Context_[float]) → bool

Returns true iff this port is connected or has had a fixed value provided in the given Context. Beware that at the moment, this could be an expensive operation, because the value is brought up-to-date as part of this operation.

size(self: pydrake.systems.framework.InputPort_[float]) → int

Returns the fixed size expected for a vector-valued port. Not meaningful for abstract-valued ports.

ticket(self: pydrake.systems.framework.InputPort_[float]) → pydrake.systems.framework.DependencyTicket

(Advanced.) Returns the DependencyTicket for this port within the owning System.

class pydrake.systems.framework.InputPortIndex
__init__(self: pydrake.systems.framework.InputPortIndex, arg0: int) → None

Default constructor; the result is an invalid index. This only exists to serve applications which require a default constructor.

is_valid(self: pydrake.systems.framework.InputPortIndex) → bool

Reports if the index is valid–the only operation on an invalid index that doesn’t throw an exception in Debug builds.

class pydrake.systems.framework.InputPortSelection

Members:

kNoInput

kUseFirstInputIfItExists

__init__(self: pydrake.systems.framework.InputPortSelection, value: int) → None
kNoInput = <InputPortSelection.kNoInput: -1>
kUseFirstInputIfItExists = <InputPortSelection.kUseFirstInputIfItExists: -2>
name
value
pydrake.systems.framework.LeafContext

alias of pydrake.systems.framework.LeafContext_[float]

template pydrake.systems.framework.LeafContext_

Instantiations: LeafContext_[float], LeafContext_[AutoDiffXd], LeafContext_[Expression]

class LeafContext_[float]

Bases: pydrake.systems.framework.Context_[float]

LeafContext contains all prerequisite data necessary to uniquely determine the results of computations performed by the associated LeafSystem.

See also

Context for more information.

__init__

Initialize self. See help(type(self)) for accurate signature.

class pydrake.systems.framework.LeafContext_[AutoDiffXd]

Bases: pydrake.systems.framework.Context_[AutoDiffXd]

LeafContext contains all prerequisite data necessary to uniquely determine the results of computations performed by the associated LeafSystem.

See also

Context for more information.

__init__

Initialize self. See help(type(self)) for accurate signature.

class pydrake.systems.framework.LeafContext_[Expression]

Bases: pydrake.systems.framework.Context_[Expression]

LeafContext contains all prerequisite data necessary to uniquely determine the results of computations performed by the associated LeafSystem.

See also

Context for more information.

__init__

Initialize self. See help(type(self)) for accurate signature.

class pydrake.systems.framework.LeafContext_[float]

Bases: pydrake.systems.framework.Context_[float]

LeafContext contains all prerequisite data necessary to uniquely determine the results of computations performed by the associated LeafSystem.

See also

Context for more information.

__init__

Initialize self. See help(type(self)) for accurate signature.

pydrake.systems.framework.LeafOutputPort

alias of pydrake.systems.framework.LeafOutputPort_[float]

template pydrake.systems.framework.LeafOutputPort_

Instantiations: LeafOutputPort_[float], LeafOutputPort_[AutoDiffXd], LeafOutputPort_[Expression]

class LeafOutputPort_[float]

Bases: pydrake.systems.framework.OutputPort_[float]

(Advanced.) Implements an output port whose value is managed by a cache entry in the same LeafSystem as the port. This is intended for internal use in implementing the DeclareOutputPort() variants in LeafSystem.

__init__

Initialize self. See help(type(self)) for accurate signature.

disable_caching_by_default(self: pydrake.systems.framework.LeafOutputPort_[float]) → None

(Debugging) Specifies that caching should be disabled for this output port when a Context is first allocated. This is useful if you have observed different behavior with caching on or off and would like to determine if the problem is caused by this port.

See also

CacheEntry::disable_caching_by_default()

class pydrake.systems.framework.LeafOutputPort_[AutoDiffXd]

Bases: pydrake.systems.framework.OutputPort_[AutoDiffXd]

(Advanced.) Implements an output port whose value is managed by a cache entry in the same LeafSystem as the port. This is intended for internal use in implementing the DeclareOutputPort() variants in LeafSystem.

__init__

Initialize self. See help(type(self)) for accurate signature.

disable_caching_by_default(self: pydrake.systems.framework.LeafOutputPort_[AutoDiffXd]) → None

(Debugging) Specifies that caching should be disabled for this output port when a Context is first allocated. This is useful if you have observed different behavior with caching on or off and would like to determine if the problem is caused by this port.

See also

CacheEntry::disable_caching_by_default()

class pydrake.systems.framework.LeafOutputPort_[Expression]

Bases: pydrake.systems.framework.OutputPort_[Expression]

(Advanced.) Implements an output port whose value is managed by a cache entry in the same LeafSystem as the port. This is intended for internal use in implementing the DeclareOutputPort() variants in LeafSystem.

__init__

Initialize self. See help(type(self)) for accurate signature.

disable_caching_by_default(self: pydrake.systems.framework.LeafOutputPort_[Expression]) → None

(Debugging) Specifies that caching should be disabled for this output port when a Context is first allocated. This is useful if you have observed different behavior with caching on or off and would like to determine if the problem is caused by this port.

See also

CacheEntry::disable_caching_by_default()

class pydrake.systems.framework.LeafOutputPort_[float]

Bases: pydrake.systems.framework.OutputPort_[float]

(Advanced.) Implements an output port whose value is managed by a cache entry in the same LeafSystem as the port. This is intended for internal use in implementing the DeclareOutputPort() variants in LeafSystem.

__init__

Initialize self. See help(type(self)) for accurate signature.

disable_caching_by_default(self: pydrake.systems.framework.LeafOutputPort_[float]) → None

(Debugging) Specifies that caching should be disabled for this output port when a Context is first allocated. This is useful if you have observed different behavior with caching on or off and would like to determine if the problem is caused by this port.

See also

CacheEntry::disable_caching_by_default()

pydrake.systems.framework.LeafSystem

alias of pydrake.systems.framework.LeafSystem_[float]

template pydrake.systems.framework.LeafSystem_

Instantiations: LeafSystem_[float], LeafSystem_[AutoDiffXd], LeafSystem_[Expression]

class LeafSystem_[float]

Bases: pydrake.systems.framework.System_[float]

A superclass template that extends System with some convenience utilities that are not applicable to Diagrams.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.LeafSystem_[float]) -> None

Default constructor that declares no inputs, outputs, state, parameters, events, nor scalar-type conversion support (AutoDiff, etc.). To enable AutoDiff support, use the SystemScalarConverter-based constructor.

  1. __init__(self: pydrake.systems.framework.LeafSystem_[float], converter: pydrake.systems.framework.SystemScalarConverter) -> None

Constructor that declares no inputs, outputs, state, parameters, or events, but allows subclasses to declare scalar-type conversion support (AutoDiff, etc.).

The scalar-type conversion support will use converter. To enable scalar-type conversion support, pass a SystemTypeTag<S>{} where S must be the exact class of this being constructed.

See system_scalar_conversion for detailed background and examples related to scalar-type conversion support.

DeclareAbstractInputPort(self: pydrake.systems.framework.LeafSystem_[float], name: str, model_value: pydrake.common.value.AbstractValue) → pydrake.systems.framework.InputPort_[float]

Declares an abstract-valued input port using the given model_value. This is the best way to declare LeafSystem abstract input ports.

Any port connected to this input, and any call to FixValue for this input, must provide for values whose type matches this model_value.

See also

System::DeclareInputPort() for more information.

DeclareAbstractOutputPort(*args, **kwargs)

Overloaded function.

  1. DeclareAbstractOutputPort(self: pydrake.systems.framework.LeafSystem_[float], name: str, alloc: Callable[[], pydrake.common.value.AbstractValue], calc: Callable[[pydrake.systems.framework.Context_[float], pydrake.common.value.AbstractValue], None], prerequisites_of_calc: Set[pydrake.systems.framework.DependencyTicket] = {DependencyTicket(15)}) -> pydrake.systems.framework.OutputPort_[float]

(Advanced) Declares an abstract-valued output port using the given allocator and calculator functions provided in their most generic forms. If you have a member function available use one of the other signatures.

See also

LeafOutputPort::AllocCallback, LeafOutputPort::CalcCallback

  1. DeclareAbstractOutputPort(self: pydrake.systems.framework.LeafSystem_[float], alloc: Callable[[], pydrake.common.value.AbstractValue], calc: Callable[[pydrake.systems.framework.Context_[float], pydrake.common.value.AbstractValue], None]) -> pydrake.systems.framework.OutputPort_[float]

(Advanced) Declares an abstract-valued output port using the given allocator and calculator functions provided in their most generic forms. If you have a member function available use one of the other signatures.

See also

LeafOutputPort::AllocCallback, LeafOutputPort::CalcCallback

DeclareAbstractParameter(self: pydrake.systems.framework.LeafSystem_[float], model_value: pydrake.common.value.AbstractValue) → int

Declares an abstract parameter using the given model_value. LeafSystem’s default implementation of SetDefaultParameters() will reset parameters to their model values. Returns the index of the new parameter.

DeclareAbstractState(self: pydrake.systems.framework.LeafSystem_[float], arg0: pydrake.common.value.AbstractValue) → pydrake.systems.framework.AbstractStateIndex

Declares an abstract state.

Parameter abstract_state:
The abstract state model value.
Returns:index of the declared abstract state.
DeclareContinuousState(*args, **kwargs)

Overloaded function.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[float], num_state_variables: int) -> None

Declares that this System should reserve continuous state with num_state_variables state variables, which have no second-order structure.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[float], num_q: int, num_v: int, num_z: int) -> None

Declares that this System should reserve continuous state with num_q generalized positions, num_v generalized velocities, and num_z miscellaneous state variables.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[float], model_vector: pydrake.systems.framework.BasicVector_[float]) -> None

Declares that this System should reserve continuous state with model_vector.size() miscellaneous state variables, stored in a vector cloned from model_vector.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[float], model_vector: pydrake.systems.framework.BasicVector_[float], num_q: int, num_v: int, num_z: int) -> None

Declares that this System should reserve continuous state with num_q generalized positions, num_v generalized velocities, and num_z miscellaneous state variables, stored in a vector cloned from model_vector. Aborts if model_vector has the wrong size. If the model_vector declares any VectorBase::GetElementBounds() constraints, they will be re-declared as inequality constraints on this system (see DeclareInequalityConstraint()).

DeclareDiscreteState(*args, **kwargs)

Overloaded function.

  1. DeclareDiscreteState(self: pydrake.systems.framework.LeafSystem_[float], model_vector: pydrake.systems.framework.BasicVector_[float]) -> pydrake.systems.framework.DiscreteStateIndex

Declares a discrete state group with model_vector.size() state variables, stored in a vector cloned from model_vector (preserving the concrete type and value).

  1. DeclareDiscreteState(self: pydrake.systems.framework.LeafSystem_[float], vector: numpy.ndarray[numpy.float64[m, 1]]) -> pydrake.systems.framework.DiscreteStateIndex

Declares a discrete state group with vector.size() state variables, stored in a BasicVector initialized with the contents of vector.

  1. DeclareDiscreteState(self: pydrake.systems.framework.LeafSystem_[float], num_state_variables: int) -> pydrake.systems.framework.DiscreteStateIndex

Declares a discrete state group with num_state_variables state variables, stored in a BasicVector initialized to be all-zero. If you want non-zero initial values, use an alternate DeclareDiscreteState() signature that accepts a model_vector parameter.

Precondition:
num_state_variables must be non-negative.
DeclareInitializationEvent(self: pydrake.systems.framework.LeafSystem_[float], event: pydrake.systems.framework.Event_[float]) → None

(Advanced) Declares that a particular Event object should be dispatched at initialization. This is the most general form for declaring initialization events and most users should use one of the other methods in this group instead.

See also

DeclareInitializationPublishEvent()

See also

DeclareInitializationDiscreteUpdateEvent()

See also

DeclareInitializationUnrestrictedUpdate()

See declare_initialization_events “Declare initialization events” for more information.

Depending on the type of event, on initialization it will be passed to the Publish, DiscreteUpdate, or UnrestrictedUpdate event dispatcher. If the event object contains a handler function, Drake’s default dispatchers will invoke that handler. If not, then no further action is taken. Thus an event with no handler has no effect unless its dispatcher has been overridden. We strongly recommend that you do not override the dispatcher and instead do supply a handler.

The given event object is deep-copied (cloned), and the copy is stored internally so you do not need to keep the object around after this call.

Precondition:
event’s associated trigger type must be TriggerType::kUnknown or already set to TriggerType::kInitialization.
DeclareNumericParameter(self: pydrake.systems.framework.LeafSystem_[float], model_vector: pydrake.systems.framework.BasicVector_[float]) → int

Declares a numeric parameter using the given model_vector. LeafSystem’s default implementation of SetDefaultParameters() will reset parameters to their model vectors. If the model_vector declares any VectorBase::GetElementBounds() constraints, they will be re-declared as inequality constraints on this system (see DeclareInequalityConstraint()). Returns the index of the new parameter.

DeclarePeriodicDiscreteUpdate(self: pydrake.systems.framework.LeafSystem_[float], period_sec: float, offset_sec: float = 0.0) → None

(To be deprecated) Declares a periodic discrete update event that invokes the DiscreteUpdate() dispatcher but does not provide a handler function. This does guarantee that a Simulator step will end exactly at the update time, but otherwise has no effect unless the DoDiscreteUpdate() dispatcher has been overloaded (not recommended).

DeclarePeriodicEvent(self: pydrake.systems.framework.LeafSystem_[float], period_sec: float, offset_sec: float, event: pydrake.systems.framework.Event_[float]) → None

(Advanced) Declares that a particular Event object should be dispatched periodically. This is the most general form for declaring periodic events and most users should use one of the other methods in this group instead.

See also

DeclarePeriodicPublishEvent()

See also

DeclarePeriodicDiscreteUpdateEvent()

See also

DeclarePeriodicUnrestrictedUpdateEvent()

See declare_periodic_events “Declare periodic events” for more information.

Depending on the type of event, when triggered it will be passed to the Publish, DiscreteUpdate, or UnrestrictedUpdate event dispatcher. If the event object contains a handler function, Drake’s default dispatchers will invoke that handler. If not, then no further action is taken. Thus an event with no handler has no effect unless its dispatcher has been overridden. We strongly recommend that you do not override the dispatcher and instead do supply a handler.

The given event object is deep-copied (cloned), and the copy is stored internally so you do not need to keep the object around after this call.

Precondition:
event’s associated trigger type must be TriggerType::kUnknown or already set to TriggerType::kPeriodic.
DeclarePeriodicPublish(self: pydrake.systems.framework.LeafSystem_[float], period_sec: float, offset_sec: float = 0.0) → None

(To be deprecated) Declares a periodic publish event that invokes the Publish() dispatcher but does not provide a handler function. This does guarantee that a Simulator step will end exactly at the publish time, but otherwise has no effect unless the DoPublish() dispatcher has been overloaded (not recommended).

DeclarePerStepEvent(self: pydrake.systems.framework.LeafSystem_[float], event: pydrake.systems.framework.Event_[float]) → None

(Advanced) Declares that a particular Event object should be dispatched at every trajectory-advancing step. Publish events are dispatched at the end of initialization and at the end of each step. Discrete- and unrestricted update events are dispatched at the start of each step. This is the most general form for declaring per-step events and most users should use one of the other methods in this group instead.

See also

DeclarePerStepPublishEvent()

See also

DeclarePerStepDiscreteUpdateEvent()

See also

DeclarePerStepUnrestrictedUpdateEvent()

See declare_per-step_events “Declare per-step events” for more information.

Depending on the type of event, at each step it will be passed to the Publish, DiscreteUpdate, or UnrestrictedUpdate event dispatcher. If the event object contains a handler function, Drake’s default dispatchers will invoke that handler. If not, then no further action is taken. Thus an event with no handler has no effect unless its dispatcher has been overridden. We strongly recommend that you do not override the dispatcher and instead do supply a handler.

The given event object is deep-copied (cloned), and the copy is stored internally so you do not need to keep the object around after this call.

Precondition:
event’s associated trigger type must be TriggerType::kUnknown or already set to TriggerType::kPerStep.
DeclareVectorInputPort(self: pydrake.systems.framework.LeafSystem_[float], name: str, model_vector: pydrake.systems.framework.BasicVector_[float], random_type: Optional[pydrake.common._module_py.RandomDistribution] = None) → pydrake.systems.framework.InputPort_[float]

Declares a vector-valued input port using the given model_vector. This is the best way to declare LeafSystem input ports that require subclasses of BasicVector. The port’s size and type will be the same as model_vector. If the port is intended to model a random noise or disturbance input, random_type can (optionally) be used to label it as such. If the model_vector declares any VectorBase::GetElementBounds() constraints, they will be re-declared as inequality constraints on this system (see DeclareInequalityConstraint()).

See also

System::DeclareInputPort() for more information.

DeclareVectorOutputPort(*args, **kwargs)

Overloaded function.

  1. DeclareVectorOutputPort(self: pydrake.systems.framework.LeafSystem_[float], name: str, model_value: pydrake.systems.framework.BasicVector_[float], calc: Callable[[pydrake.systems.framework.Context_[float], pydrake.systems.framework.BasicVector_[float]], None], prerequisites_of_calc: Set[pydrake.systems.framework.DependencyTicket] = {DependencyTicket(15)}) -> pydrake.systems.framework.OutputPort_[float]

(Advanced) Declares a vector-valued output port using the given model_vector and a function for calculating the port’s value at runtime. The port’s size will be model_vector.size(), and the default allocator for the port will be model_vector.Clone(). Note that this takes the calculator function in its most generic form; if you have a member function available use one of the other signatures.

See also

LeafOutputPort::CalcVectorCallback

  1. DeclareVectorOutputPort(self: pydrake.systems.framework.LeafSystem_[float], arg0: pydrake.systems.framework.BasicVector_[float], arg1: Callable[[pydrake.systems.framework.Context_[float], pydrake.systems.framework.BasicVector_[float]], None]) -> pydrake.systems.framework.OutputPort_[float]

(Advanced) Declares a vector-valued output port using the given model_vector and a function for calculating the port’s value at runtime. The port’s size will be model_vector.size(), and the default allocator for the port will be model_vector.Clone(). Note that this takes the calculator function in its most generic form; if you have a member function available use one of the other signatures.

See also

LeafOutputPort::CalcVectorCallback

DoCalcDiscreteVariableUpdates(self: pydrake.systems.framework.LeafSystem_[float], arg0: pydrake.systems.framework.Context_[float], arg1: List[pydrake.systems.framework.DiscreteUpdateEvent_[float]], arg2: pydrake.systems.framework.DiscreteValues_[float]) → None

Derived-class event dispatcher for all simultaneous discrete update events. Override this in your derived LeafSystem only if you require behavior other than the default dispatch behavior (not common). The default behavior is to traverse events in the arbitrary order they appear in events, and for each event that has a callback function, to invoke the callback with context, that event, and discrete_state. Note that the same (possibly modified) discrete_state is passed to subsequent callbacks.

Do not override this just to handle an event – instead declare the event and a handler callback for it using one of the Declare...DiscreteUpdateEvent() methods.

This method is called only from the virtual DispatchDiscreteVariableUpdateHandler(), which is only called from the public non-virtual CalcDiscreteVariableUpdates(), which will already have error-checked the parameters so you don’t have to. In particular, implementations may assume that context is valid; that discrete_state is non-null, and that the referenced object has the same constituent structure as was produced by AllocateDiscreteVariables().

Parameter context:
The “before” state.
Parameter events:
All the discrete update events that need handling.
Parameter discrete_state:
The current state of the system on input; the desired state of the system on return.
DoCalcTimeDerivatives(self: pydrake.systems.framework.LeafSystem_[float], arg0: pydrake.systems.framework.Context_[float], arg1: pydrake.systems.framework.ContinuousState_[float]) → None
DoPublish(self: pydrake.systems.framework.LeafSystem_[float], arg0: pydrake.systems.framework.Context_[float], arg1: List[pydrake.systems.framework.PublishEvent_[float]]) → None

Derived-class event dispatcher for all simultaneous publish events in events. Override this in your derived LeafSystem only if you require behavior other than the default dispatch behavior (not common). The default behavior is to traverse events in the arbitrary order they appear in events, and for each event that has a callback function, to invoke the callback with context and that event.

Do not override this just to handle an event – instead declare the event and a handler callback for it using one of the Declare...PublishEvent() methods.

This method is called only from the virtual DispatchPublishHandler, which is only called from the public non-virtual Publish(), which will have already error-checked context so you may assume that it is valid.

Parameter context:
Const current context.
Parameter events:
All the publish events that need handling.
MakeWitnessFunction(*args, **kwargs)

Overloaded function.

  1. MakeWitnessFunction(self: pydrake.systems.framework.LeafSystem_[float], description: str, direction_type: pydrake.systems.framework.WitnessFunctionDirection, calc: Callable[[pydrake.systems.framework.Context_[float]], float]) -> pydrake.systems.framework.WitnessFunction_[float]

Constructs the witness function with the given description (used primarily for debugging and logging), direction type, and calculator function; and with no event object.

Note

In order for the witness function to be used, you MUST overload System::DoGetWitnessFunctions().

  1. MakeWitnessFunction(self: pydrake.systems.framework.LeafSystem_[float], description: str, direction_type: pydrake.systems.framework.WitnessFunctionDirection, calc: Callable[[pydrake.systems.framework.Context_[float]], float], e: pydrake.systems.framework.Event_[float]) -> pydrake.systems.framework.WitnessFunction_[float]

Constructs the witness function with the given description (used primarily for debugging and logging), direction type, and calculator function, and with an object corresponding to the event that is to be dispatched when this witness function triggers. Example types of event objects are publish, discrete variable update, unrestricted update events. A clone of the event will be owned by the newly constructed WitnessFunction.

Note

In order for the witness function to be used, you MUST overload System::DoGetWitnessFunctions().

class pydrake.systems.framework.LeafSystem_[AutoDiffXd]

Bases: pydrake.systems.framework.System_[AutoDiffXd]

A superclass template that extends System with some convenience utilities that are not applicable to Diagrams.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd]) -> None

Default constructor that declares no inputs, outputs, state, parameters, events, nor scalar-type conversion support (AutoDiff, etc.). To enable AutoDiff support, use the SystemScalarConverter-based constructor.

  1. __init__(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], converter: pydrake.systems.framework.SystemScalarConverter) -> None

Constructor that declares no inputs, outputs, state, parameters, or events, but allows subclasses to declare scalar-type conversion support (AutoDiff, etc.).

The scalar-type conversion support will use converter. To enable scalar-type conversion support, pass a SystemTypeTag<S>{} where S must be the exact class of this being constructed.

See system_scalar_conversion for detailed background and examples related to scalar-type conversion support.

DeclareAbstractInputPort(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], name: str, model_value: pydrake.common.value.AbstractValue) → pydrake.systems.framework.InputPort_[AutoDiffXd]

Declares an abstract-valued input port using the given model_value. This is the best way to declare LeafSystem abstract input ports.

Any port connected to this input, and any call to FixValue for this input, must provide for values whose type matches this model_value.

See also

System::DeclareInputPort() for more information.

DeclareAbstractOutputPort(*args, **kwargs)

Overloaded function.

  1. DeclareAbstractOutputPort(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], name: str, alloc: Callable[[], pydrake.common.value.AbstractValue], calc: Callable[[pydrake.systems.framework.Context_[AutoDiffXd], pydrake.common.value.AbstractValue], None], prerequisites_of_calc: Set[pydrake.systems.framework.DependencyTicket] = {DependencyTicket(15)}) -> pydrake.systems.framework.OutputPort_[AutoDiffXd]

(Advanced) Declares an abstract-valued output port using the given allocator and calculator functions provided in their most generic forms. If you have a member function available use one of the other signatures.

See also

LeafOutputPort::AllocCallback, LeafOutputPort::CalcCallback

  1. DeclareAbstractOutputPort(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], alloc: Callable[[], pydrake.common.value.AbstractValue], calc: Callable[[pydrake.systems.framework.Context_[AutoDiffXd], pydrake.common.value.AbstractValue], None]) -> pydrake.systems.framework.OutputPort_[AutoDiffXd]

(Advanced) Declares an abstract-valued output port using the given allocator and calculator functions provided in their most generic forms. If you have a member function available use one of the other signatures.

See also

LeafOutputPort::AllocCallback, LeafOutputPort::CalcCallback

DeclareAbstractParameter(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], model_value: pydrake.common.value.AbstractValue) → int

Declares an abstract parameter using the given model_value. LeafSystem’s default implementation of SetDefaultParameters() will reset parameters to their model values. Returns the index of the new parameter.

DeclareAbstractState(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], arg0: pydrake.common.value.AbstractValue) → pydrake.systems.framework.AbstractStateIndex

Declares an abstract state.

Parameter abstract_state:
The abstract state model value.
Returns:index of the declared abstract state.
DeclareContinuousState(*args, **kwargs)

Overloaded function.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], num_state_variables: int) -> None

Declares that this System should reserve continuous state with num_state_variables state variables, which have no second-order structure.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], num_q: int, num_v: int, num_z: int) -> None

Declares that this System should reserve continuous state with num_q generalized positions, num_v generalized velocities, and num_z miscellaneous state variables.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], model_vector: pydrake.systems.framework.BasicVector_[AutoDiffXd]) -> None

Declares that this System should reserve continuous state with model_vector.size() miscellaneous state variables, stored in a vector cloned from model_vector.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], model_vector: pydrake.systems.framework.BasicVector_[AutoDiffXd], num_q: int, num_v: int, num_z: int) -> None

Declares that this System should reserve continuous state with num_q generalized positions, num_v generalized velocities, and num_z miscellaneous state variables, stored in a vector cloned from model_vector. Aborts if model_vector has the wrong size. If the model_vector declares any VectorBase::GetElementBounds() constraints, they will be re-declared as inequality constraints on this system (see DeclareInequalityConstraint()).

DeclareDiscreteState(*args, **kwargs)

Overloaded function.

  1. DeclareDiscreteState(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], model_vector: pydrake.systems.framework.BasicVector_[AutoDiffXd]) -> pydrake.systems.framework.DiscreteStateIndex

Declares a discrete state group with model_vector.size() state variables, stored in a vector cloned from model_vector (preserving the concrete type and value).

  1. DeclareDiscreteState(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], vector: numpy.ndarray[object[m, 1]]) -> pydrake.systems.framework.DiscreteStateIndex

Declares a discrete state group with vector.size() state variables, stored in a BasicVector initialized with the contents of vector.

  1. DeclareDiscreteState(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], num_state_variables: int) -> pydrake.systems.framework.DiscreteStateIndex

Declares a discrete state group with num_state_variables state variables, stored in a BasicVector initialized to be all-zero. If you want non-zero initial values, use an alternate DeclareDiscreteState() signature that accepts a model_vector parameter.

Precondition:
num_state_variables must be non-negative.
DeclareInitializationEvent(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], event: pydrake.systems.framework.Event_[AutoDiffXd]) → None

(Advanced) Declares that a particular Event object should be dispatched at initialization. This is the most general form for declaring initialization events and most users should use one of the other methods in this group instead.

See also

DeclareInitializationPublishEvent()

See also

DeclareInitializationDiscreteUpdateEvent()

See also

DeclareInitializationUnrestrictedUpdate()

See declare_initialization_events “Declare initialization events” for more information.

Depending on the type of event, on initialization it will be passed to the Publish, DiscreteUpdate, or UnrestrictedUpdate event dispatcher. If the event object contains a handler function, Drake’s default dispatchers will invoke that handler. If not, then no further action is taken. Thus an event with no handler has no effect unless its dispatcher has been overridden. We strongly recommend that you do not override the dispatcher and instead do supply a handler.

The given event object is deep-copied (cloned), and the copy is stored internally so you do not need to keep the object around after this call.

Precondition:
event’s associated trigger type must be TriggerType::kUnknown or already set to TriggerType::kInitialization.
DeclareNumericParameter(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], model_vector: pydrake.systems.framework.BasicVector_[AutoDiffXd]) → int

Declares a numeric parameter using the given model_vector. LeafSystem’s default implementation of SetDefaultParameters() will reset parameters to their model vectors. If the model_vector declares any VectorBase::GetElementBounds() constraints, they will be re-declared as inequality constraints on this system (see DeclareInequalityConstraint()). Returns the index of the new parameter.

DeclarePeriodicDiscreteUpdate(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], period_sec: float, offset_sec: float = 0.0) → None

(To be deprecated) Declares a periodic discrete update event that invokes the DiscreteUpdate() dispatcher but does not provide a handler function. This does guarantee that a Simulator step will end exactly at the update time, but otherwise has no effect unless the DoDiscreteUpdate() dispatcher has been overloaded (not recommended).

DeclarePeriodicEvent(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], period_sec: float, offset_sec: float, event: pydrake.systems.framework.Event_[AutoDiffXd]) → None

(Advanced) Declares that a particular Event object should be dispatched periodically. This is the most general form for declaring periodic events and most users should use one of the other methods in this group instead.

See also

DeclarePeriodicPublishEvent()

See also

DeclarePeriodicDiscreteUpdateEvent()

See also

DeclarePeriodicUnrestrictedUpdateEvent()

See declare_periodic_events “Declare periodic events” for more information.

Depending on the type of event, when triggered it will be passed to the Publish, DiscreteUpdate, or UnrestrictedUpdate event dispatcher. If the event object contains a handler function, Drake’s default dispatchers will invoke that handler. If not, then no further action is taken. Thus an event with no handler has no effect unless its dispatcher has been overridden. We strongly recommend that you do not override the dispatcher and instead do supply a handler.

The given event object is deep-copied (cloned), and the copy is stored internally so you do not need to keep the object around after this call.

Precondition:
event’s associated trigger type must be TriggerType::kUnknown or already set to TriggerType::kPeriodic.
DeclarePeriodicPublish(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], period_sec: float, offset_sec: float = 0.0) → None

(To be deprecated) Declares a periodic publish event that invokes the Publish() dispatcher but does not provide a handler function. This does guarantee that a Simulator step will end exactly at the publish time, but otherwise has no effect unless the DoPublish() dispatcher has been overloaded (not recommended).

DeclarePerStepEvent(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], event: pydrake.systems.framework.Event_[AutoDiffXd]) → None

(Advanced) Declares that a particular Event object should be dispatched at every trajectory-advancing step. Publish events are dispatched at the end of initialization and at the end of each step. Discrete- and unrestricted update events are dispatched at the start of each step. This is the most general form for declaring per-step events and most users should use one of the other methods in this group instead.

See also

DeclarePerStepPublishEvent()

See also

DeclarePerStepDiscreteUpdateEvent()

See also

DeclarePerStepUnrestrictedUpdateEvent()

See declare_per-step_events “Declare per-step events” for more information.

Depending on the type of event, at each step it will be passed to the Publish, DiscreteUpdate, or UnrestrictedUpdate event dispatcher. If the event object contains a handler function, Drake’s default dispatchers will invoke that handler. If not, then no further action is taken. Thus an event with no handler has no effect unless its dispatcher has been overridden. We strongly recommend that you do not override the dispatcher and instead do supply a handler.

The given event object is deep-copied (cloned), and the copy is stored internally so you do not need to keep the object around after this call.

Precondition:
event’s associated trigger type must be TriggerType::kUnknown or already set to TriggerType::kPerStep.
DeclareVectorInputPort(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], name: str, model_vector: pydrake.systems.framework.BasicVector_[AutoDiffXd], random_type: Optional[pydrake.common._module_py.RandomDistribution] = None) → pydrake.systems.framework.InputPort_[AutoDiffXd]

Declares a vector-valued input port using the given model_vector. This is the best way to declare LeafSystem input ports that require subclasses of BasicVector. The port’s size and type will be the same as model_vector. If the port is intended to model a random noise or disturbance input, random_type can (optionally) be used to label it as such. If the model_vector declares any VectorBase::GetElementBounds() constraints, they will be re-declared as inequality constraints on this system (see DeclareInequalityConstraint()).

See also

System::DeclareInputPort() for more information.

DeclareVectorOutputPort(*args, **kwargs)

Overloaded function.

  1. DeclareVectorOutputPort(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], name: str, model_value: pydrake.systems.framework.BasicVector_[AutoDiffXd], calc: Callable[[pydrake.systems.framework.Context_[AutoDiffXd], pydrake.systems.framework.BasicVector_[AutoDiffXd]], None], prerequisites_of_calc: Set[pydrake.systems.framework.DependencyTicket] = {DependencyTicket(15)}) -> pydrake.systems.framework.OutputPort_[AutoDiffXd]

(Advanced) Declares a vector-valued output port using the given model_vector and a function for calculating the port’s value at runtime. The port’s size will be model_vector.size(), and the default allocator for the port will be model_vector.Clone(). Note that this takes the calculator function in its most generic form; if you have a member function available use one of the other signatures.

See also

LeafOutputPort::CalcVectorCallback

  1. DeclareVectorOutputPort(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], arg0: pydrake.systems.framework.BasicVector_[AutoDiffXd], arg1: Callable[[pydrake.systems.framework.Context_[AutoDiffXd], pydrake.systems.framework.BasicVector_[AutoDiffXd]], None]) -> pydrake.systems.framework.OutputPort_[AutoDiffXd]

(Advanced) Declares a vector-valued output port using the given model_vector and a function for calculating the port’s value at runtime. The port’s size will be model_vector.size(), and the default allocator for the port will be model_vector.Clone(). Note that this takes the calculator function in its most generic form; if you have a member function available use one of the other signatures.

See also

LeafOutputPort::CalcVectorCallback

DoCalcDiscreteVariableUpdates(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], arg0: pydrake.systems.framework.Context_[AutoDiffXd], arg1: List[pydrake.systems.framework.DiscreteUpdateEvent_[AutoDiffXd]], arg2: pydrake.systems.framework.DiscreteValues_[AutoDiffXd]) → None

Derived-class event dispatcher for all simultaneous discrete update events. Override this in your derived LeafSystem only if you require behavior other than the default dispatch behavior (not common). The default behavior is to traverse events in the arbitrary order they appear in events, and for each event that has a callback function, to invoke the callback with context, that event, and discrete_state. Note that the same (possibly modified) discrete_state is passed to subsequent callbacks.

Do not override this just to handle an event – instead declare the event and a handler callback for it using one of the Declare...DiscreteUpdateEvent() methods.

This method is called only from the virtual DispatchDiscreteVariableUpdateHandler(), which is only called from the public non-virtual CalcDiscreteVariableUpdates(), which will already have error-checked the parameters so you don’t have to. In particular, implementations may assume that context is valid; that discrete_state is non-null, and that the referenced object has the same constituent structure as was produced by AllocateDiscreteVariables().

Parameter context:
The “before” state.
Parameter events:
All the discrete update events that need handling.
Parameter discrete_state:
The current state of the system on input; the desired state of the system on return.
DoCalcTimeDerivatives(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], arg0: pydrake.systems.framework.Context_[AutoDiffXd], arg1: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → None
DoPublish(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], arg0: pydrake.systems.framework.Context_[AutoDiffXd], arg1: List[pydrake.systems.framework.PublishEvent_[AutoDiffXd]]) → None

Derived-class event dispatcher for all simultaneous publish events in events. Override this in your derived LeafSystem only if you require behavior other than the default dispatch behavior (not common). The default behavior is to traverse events in the arbitrary order they appear in events, and for each event that has a callback function, to invoke the callback with context and that event.

Do not override this just to handle an event – instead declare the event and a handler callback for it using one of the Declare...PublishEvent() methods.

This method is called only from the virtual DispatchPublishHandler, which is only called from the public non-virtual Publish(), which will have already error-checked context so you may assume that it is valid.

Parameter context:
Const current context.
Parameter events:
All the publish events that need handling.
MakeWitnessFunction(*args, **kwargs)

Overloaded function.

  1. MakeWitnessFunction(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], description: str, direction_type: pydrake.systems.framework.WitnessFunctionDirection, calc: Callable[[pydrake.systems.framework.Context_[AutoDiffXd]], pydrake.autodiffutils.AutoDiffXd]) -> pydrake.systems.framework.WitnessFunction_[AutoDiffXd]

Constructs the witness function with the given description (used primarily for debugging and logging), direction type, and calculator function; and with no event object.

Note

In order for the witness function to be used, you MUST overload System::DoGetWitnessFunctions().

  1. MakeWitnessFunction(self: pydrake.systems.framework.LeafSystem_[AutoDiffXd], description: str, direction_type: pydrake.systems.framework.WitnessFunctionDirection, calc: Callable[[pydrake.systems.framework.Context_[AutoDiffXd]], pydrake.autodiffutils.AutoDiffXd], e: pydrake.systems.framework.Event_[AutoDiffXd]) -> pydrake.systems.framework.WitnessFunction_[AutoDiffXd]

Constructs the witness function with the given description (used primarily for debugging and logging), direction type, and calculator function, and with an object corresponding to the event that is to be dispatched when this witness function triggers. Example types of event objects are publish, discrete variable update, unrestricted update events. A clone of the event will be owned by the newly constructed WitnessFunction.

Note

In order for the witness function to be used, you MUST overload System::DoGetWitnessFunctions().

class pydrake.systems.framework.LeafSystem_[Expression]

Bases: pydrake.systems.framework.System_[Expression]

A superclass template that extends System with some convenience utilities that are not applicable to Diagrams.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.LeafSystem_[Expression]) -> None

Default constructor that declares no inputs, outputs, state, parameters, events, nor scalar-type conversion support (AutoDiff, etc.). To enable AutoDiff support, use the SystemScalarConverter-based constructor.

  1. __init__(self: pydrake.systems.framework.LeafSystem_[Expression], converter: pydrake.systems.framework.SystemScalarConverter) -> None

Constructor that declares no inputs, outputs, state, parameters, or events, but allows subclasses to declare scalar-type conversion support (AutoDiff, etc.).

The scalar-type conversion support will use converter. To enable scalar-type conversion support, pass a SystemTypeTag<S>{} where S must be the exact class of this being constructed.

See system_scalar_conversion for detailed background and examples related to scalar-type conversion support.

DeclareAbstractInputPort(self: pydrake.systems.framework.LeafSystem_[Expression], name: str, model_value: pydrake.common.value.AbstractValue) → pydrake.systems.framework.InputPort_[Expression]

Declares an abstract-valued input port using the given model_value. This is the best way to declare LeafSystem abstract input ports.

Any port connected to this input, and any call to FixValue for this input, must provide for values whose type matches this model_value.

See also

System::DeclareInputPort() for more information.

DeclareAbstractOutputPort(*args, **kwargs)

Overloaded function.

  1. DeclareAbstractOutputPort(self: pydrake.systems.framework.LeafSystem_[Expression], name: str, alloc: Callable[[], pydrake.common.value.AbstractValue], calc: Callable[[pydrake.systems.framework.Context_[Expression], pydrake.common.value.AbstractValue], None], prerequisites_of_calc: Set[pydrake.systems.framework.DependencyTicket] = {DependencyTicket(15)}) -> pydrake.systems.framework.OutputPort_[Expression]

(Advanced) Declares an abstract-valued output port using the given allocator and calculator functions provided in their most generic forms. If you have a member function available use one of the other signatures.

See also

LeafOutputPort::AllocCallback, LeafOutputPort::CalcCallback

  1. DeclareAbstractOutputPort(self: pydrake.systems.framework.LeafSystem_[Expression], alloc: Callable[[], pydrake.common.value.AbstractValue], calc: Callable[[pydrake.systems.framework.Context_[Expression], pydrake.common.value.AbstractValue], None]) -> pydrake.systems.framework.OutputPort_[Expression]

(Advanced) Declares an abstract-valued output port using the given allocator and calculator functions provided in their most generic forms. If you have a member function available use one of the other signatures.

See also

LeafOutputPort::AllocCallback, LeafOutputPort::CalcCallback

DeclareAbstractParameter(self: pydrake.systems.framework.LeafSystem_[Expression], model_value: pydrake.common.value.AbstractValue) → int

Declares an abstract parameter using the given model_value. LeafSystem’s default implementation of SetDefaultParameters() will reset parameters to their model values. Returns the index of the new parameter.

DeclareAbstractState(self: pydrake.systems.framework.LeafSystem_[Expression], arg0: pydrake.common.value.AbstractValue) → pydrake.systems.framework.AbstractStateIndex

Declares an abstract state.

Parameter abstract_state:
The abstract state model value.
Returns:index of the declared abstract state.
DeclareContinuousState(*args, **kwargs)

Overloaded function.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[Expression], num_state_variables: int) -> None

Declares that this System should reserve continuous state with num_state_variables state variables, which have no second-order structure.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[Expression], num_q: int, num_v: int, num_z: int) -> None

Declares that this System should reserve continuous state with num_q generalized positions, num_v generalized velocities, and num_z miscellaneous state variables.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[Expression], model_vector: pydrake.systems.framework.BasicVector_[Expression]) -> None

Declares that this System should reserve continuous state with model_vector.size() miscellaneous state variables, stored in a vector cloned from model_vector.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[Expression], model_vector: pydrake.systems.framework.BasicVector_[Expression], num_q: int, num_v: int, num_z: int) -> None

Declares that this System should reserve continuous state with num_q generalized positions, num_v generalized velocities, and num_z miscellaneous state variables, stored in a vector cloned from model_vector. Aborts if model_vector has the wrong size. If the model_vector declares any VectorBase::GetElementBounds() constraints, they will be re-declared as inequality constraints on this system (see DeclareInequalityConstraint()).

DeclareDiscreteState(*args, **kwargs)

Overloaded function.

  1. DeclareDiscreteState(self: pydrake.systems.framework.LeafSystem_[Expression], model_vector: pydrake.systems.framework.BasicVector_[Expression]) -> pydrake.systems.framework.DiscreteStateIndex

Declares a discrete state group with model_vector.size() state variables, stored in a vector cloned from model_vector (preserving the concrete type and value).

  1. DeclareDiscreteState(self: pydrake.systems.framework.LeafSystem_[Expression], vector: numpy.ndarray[object[m, 1]]) -> pydrake.systems.framework.DiscreteStateIndex

Declares a discrete state group with vector.size() state variables, stored in a BasicVector initialized with the contents of vector.

  1. DeclareDiscreteState(self: pydrake.systems.framework.LeafSystem_[Expression], num_state_variables: int) -> pydrake.systems.framework.DiscreteStateIndex

Declares a discrete state group with num_state_variables state variables, stored in a BasicVector initialized to be all-zero. If you want non-zero initial values, use an alternate DeclareDiscreteState() signature that accepts a model_vector parameter.

Precondition:
num_state_variables must be non-negative.
DeclareInitializationEvent(self: pydrake.systems.framework.LeafSystem_[Expression], event: pydrake.systems.framework.Event_[Expression]) → None

(Advanced) Declares that a particular Event object should be dispatched at initialization. This is the most general form for declaring initialization events and most users should use one of the other methods in this group instead.

See also

DeclareInitializationPublishEvent()

See also

DeclareInitializationDiscreteUpdateEvent()

See also

DeclareInitializationUnrestrictedUpdate()

See declare_initialization_events “Declare initialization events” for more information.

Depending on the type of event, on initialization it will be passed to the Publish, DiscreteUpdate, or UnrestrictedUpdate event dispatcher. If the event object contains a handler function, Drake’s default dispatchers will invoke that handler. If not, then no further action is taken. Thus an event with no handler has no effect unless its dispatcher has been overridden. We strongly recommend that you do not override the dispatcher and instead do supply a handler.

The given event object is deep-copied (cloned), and the copy is stored internally so you do not need to keep the object around after this call.

Precondition:
event’s associated trigger type must be TriggerType::kUnknown or already set to TriggerType::kInitialization.
DeclareNumericParameter(self: pydrake.systems.framework.LeafSystem_[Expression], model_vector: pydrake.systems.framework.BasicVector_[Expression]) → int

Declares a numeric parameter using the given model_vector. LeafSystem’s default implementation of SetDefaultParameters() will reset parameters to their model vectors. If the model_vector declares any VectorBase::GetElementBounds() constraints, they will be re-declared as inequality constraints on this system (see DeclareInequalityConstraint()). Returns the index of the new parameter.

DeclarePeriodicDiscreteUpdate(self: pydrake.systems.framework.LeafSystem_[Expression], period_sec: float, offset_sec: float = 0.0) → None

(To be deprecated) Declares a periodic discrete update event that invokes the DiscreteUpdate() dispatcher but does not provide a handler function. This does guarantee that a Simulator step will end exactly at the update time, but otherwise has no effect unless the DoDiscreteUpdate() dispatcher has been overloaded (not recommended).

DeclarePeriodicEvent(self: pydrake.systems.framework.LeafSystem_[Expression], period_sec: float, offset_sec: float, event: pydrake.systems.framework.Event_[Expression]) → None

(Advanced) Declares that a particular Event object should be dispatched periodically. This is the most general form for declaring periodic events and most users should use one of the other methods in this group instead.

See also

DeclarePeriodicPublishEvent()

See also

DeclarePeriodicDiscreteUpdateEvent()

See also

DeclarePeriodicUnrestrictedUpdateEvent()

See declare_periodic_events “Declare periodic events” for more information.

Depending on the type of event, when triggered it will be passed to the Publish, DiscreteUpdate, or UnrestrictedUpdate event dispatcher. If the event object contains a handler function, Drake’s default dispatchers will invoke that handler. If not, then no further action is taken. Thus an event with no handler has no effect unless its dispatcher has been overridden. We strongly recommend that you do not override the dispatcher and instead do supply a handler.

The given event object is deep-copied (cloned), and the copy is stored internally so you do not need to keep the object around after this call.

Precondition:
event’s associated trigger type must be TriggerType::kUnknown or already set to TriggerType::kPeriodic.
DeclarePeriodicPublish(self: pydrake.systems.framework.LeafSystem_[Expression], period_sec: float, offset_sec: float = 0.0) → None

(To be deprecated) Declares a periodic publish event that invokes the Publish() dispatcher but does not provide a handler function. This does guarantee that a Simulator step will end exactly at the publish time, but otherwise has no effect unless the DoPublish() dispatcher has been overloaded (not recommended).

DeclarePerStepEvent(self: pydrake.systems.framework.LeafSystem_[Expression], event: pydrake.systems.framework.Event_[Expression]) → None

(Advanced) Declares that a particular Event object should be dispatched at every trajectory-advancing step. Publish events are dispatched at the end of initialization and at the end of each step. Discrete- and unrestricted update events are dispatched at the start of each step. This is the most general form for declaring per-step events and most users should use one of the other methods in this group instead.

See also

DeclarePerStepPublishEvent()

See also

DeclarePerStepDiscreteUpdateEvent()

See also

DeclarePerStepUnrestrictedUpdateEvent()

See declare_per-step_events “Declare per-step events” for more information.

Depending on the type of event, at each step it will be passed to the Publish, DiscreteUpdate, or UnrestrictedUpdate event dispatcher. If the event object contains a handler function, Drake’s default dispatchers will invoke that handler. If not, then no further action is taken. Thus an event with no handler has no effect unless its dispatcher has been overridden. We strongly recommend that you do not override the dispatcher and instead do supply a handler.

The given event object is deep-copied (cloned), and the copy is stored internally so you do not need to keep the object around after this call.

Precondition:
event’s associated trigger type must be TriggerType::kUnknown or already set to TriggerType::kPerStep.
DeclareVectorInputPort(self: pydrake.systems.framework.LeafSystem_[Expression], name: str, model_vector: pydrake.systems.framework.BasicVector_[Expression], random_type: Optional[pydrake.common._module_py.RandomDistribution] = None) → pydrake.systems.framework.InputPort_[Expression]

Declares a vector-valued input port using the given model_vector. This is the best way to declare LeafSystem input ports that require subclasses of BasicVector. The port’s size and type will be the same as model_vector. If the port is intended to model a random noise or disturbance input, random_type can (optionally) be used to label it as such. If the model_vector declares any VectorBase::GetElementBounds() constraints, they will be re-declared as inequality constraints on this system (see DeclareInequalityConstraint()).

See also

System::DeclareInputPort() for more information.

DeclareVectorOutputPort(*args, **kwargs)

Overloaded function.

  1. DeclareVectorOutputPort(self: pydrake.systems.framework.LeafSystem_[Expression], name: str, model_value: pydrake.systems.framework.BasicVector_[Expression], calc: Callable[[pydrake.systems.framework.Context_[Expression], pydrake.systems.framework.BasicVector_[Expression]], None], prerequisites_of_calc: Set[pydrake.systems.framework.DependencyTicket] = {DependencyTicket(15)}) -> pydrake.systems.framework.OutputPort_[Expression]

(Advanced) Declares a vector-valued output port using the given model_vector and a function for calculating the port’s value at runtime. The port’s size will be model_vector.size(), and the default allocator for the port will be model_vector.Clone(). Note that this takes the calculator function in its most generic form; if you have a member function available use one of the other signatures.

See also

LeafOutputPort::CalcVectorCallback

  1. DeclareVectorOutputPort(self: pydrake.systems.framework.LeafSystem_[Expression], arg0: pydrake.systems.framework.BasicVector_[Expression], arg1: Callable[[pydrake.systems.framework.Context_[Expression], pydrake.systems.framework.BasicVector_[Expression]], None]) -> pydrake.systems.framework.OutputPort_[Expression]

(Advanced) Declares a vector-valued output port using the given model_vector and a function for calculating the port’s value at runtime. The port’s size will be model_vector.size(), and the default allocator for the port will be model_vector.Clone(). Note that this takes the calculator function in its most generic form; if you have a member function available use one of the other signatures.

See also

LeafOutputPort::CalcVectorCallback

DoCalcDiscreteVariableUpdates(self: pydrake.systems.framework.LeafSystem_[Expression], arg0: pydrake.systems.framework.Context_[Expression], arg1: List[pydrake.systems.framework.DiscreteUpdateEvent_[Expression]], arg2: pydrake.systems.framework.DiscreteValues_[Expression]) → None

Derived-class event dispatcher for all simultaneous discrete update events. Override this in your derived LeafSystem only if you require behavior other than the default dispatch behavior (not common). The default behavior is to traverse events in the arbitrary order they appear in events, and for each event that has a callback function, to invoke the callback with context, that event, and discrete_state. Note that the same (possibly modified) discrete_state is passed to subsequent callbacks.

Do not override this just to handle an event – instead declare the event and a handler callback for it using one of the Declare...DiscreteUpdateEvent() methods.

This method is called only from the virtual DispatchDiscreteVariableUpdateHandler(), which is only called from the public non-virtual CalcDiscreteVariableUpdates(), which will already have error-checked the parameters so you don’t have to. In particular, implementations may assume that context is valid; that discrete_state is non-null, and that the referenced object has the same constituent structure as was produced by AllocateDiscreteVariables().

Parameter context:
The “before” state.
Parameter events:
All the discrete update events that need handling.
Parameter discrete_state:
The current state of the system on input; the desired state of the system on return.
DoCalcTimeDerivatives(self: pydrake.systems.framework.LeafSystem_[Expression], arg0: pydrake.systems.framework.Context_[Expression], arg1: pydrake.systems.framework.ContinuousState_[Expression]) → None
DoPublish(self: pydrake.systems.framework.LeafSystem_[Expression], arg0: pydrake.systems.framework.Context_[Expression], arg1: List[pydrake.systems.framework.PublishEvent_[Expression]]) → None

Derived-class event dispatcher for all simultaneous publish events in events. Override this in your derived LeafSystem only if you require behavior other than the default dispatch behavior (not common). The default behavior is to traverse events in the arbitrary order they appear in events, and for each event that has a callback function, to invoke the callback with context and that event.

Do not override this just to handle an event – instead declare the event and a handler callback for it using one of the Declare...PublishEvent() methods.

This method is called only from the virtual DispatchPublishHandler, which is only called from the public non-virtual Publish(), which will have already error-checked context so you may assume that it is valid.

Parameter context:
Const current context.
Parameter events:
All the publish events that need handling.
MakeWitnessFunction(*args, **kwargs)

Overloaded function.

  1. MakeWitnessFunction(self: pydrake.systems.framework.LeafSystem_[Expression], description: str, direction_type: pydrake.systems.framework.WitnessFunctionDirection, calc: Callable[[pydrake.systems.framework.Context_[Expression]], pydrake.symbolic.Expression]) -> pydrake.systems.framework.WitnessFunction_[Expression]

Constructs the witness function with the given description (used primarily for debugging and logging), direction type, and calculator function; and with no event object.

Note

In order for the witness function to be used, you MUST overload System::DoGetWitnessFunctions().

  1. MakeWitnessFunction(self: pydrake.systems.framework.LeafSystem_[Expression], description: str, direction_type: pydrake.systems.framework.WitnessFunctionDirection, calc: Callable[[pydrake.systems.framework.Context_[Expression]], pydrake.symbolic.Expression], e: pydrake.systems.framework.Event_[Expression]) -> pydrake.systems.framework.WitnessFunction_[Expression]

Constructs the witness function with the given description (used primarily for debugging and logging), direction type, and calculator function, and with an object corresponding to the event that is to be dispatched when this witness function triggers. Example types of event objects are publish, discrete variable update, unrestricted update events. A clone of the event will be owned by the newly constructed WitnessFunction.

Note

In order for the witness function to be used, you MUST overload System::DoGetWitnessFunctions().

class pydrake.systems.framework.LeafSystem_[float]

Bases: pydrake.systems.framework.System_[float]

A superclass template that extends System with some convenience utilities that are not applicable to Diagrams.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.LeafSystem_[float]) -> None

Default constructor that declares no inputs, outputs, state, parameters, events, nor scalar-type conversion support (AutoDiff, etc.). To enable AutoDiff support, use the SystemScalarConverter-based constructor.

  1. __init__(self: pydrake.systems.framework.LeafSystem_[float], converter: pydrake.systems.framework.SystemScalarConverter) -> None

Constructor that declares no inputs, outputs, state, parameters, or events, but allows subclasses to declare scalar-type conversion support (AutoDiff, etc.).

The scalar-type conversion support will use converter. To enable scalar-type conversion support, pass a SystemTypeTag<S>{} where S must be the exact class of this being constructed.

See system_scalar_conversion for detailed background and examples related to scalar-type conversion support.

DeclareAbstractInputPort(self: pydrake.systems.framework.LeafSystem_[float], name: str, model_value: pydrake.common.value.AbstractValue) → pydrake.systems.framework.InputPort_[float]

Declares an abstract-valued input port using the given model_value. This is the best way to declare LeafSystem abstract input ports.

Any port connected to this input, and any call to FixValue for this input, must provide for values whose type matches this model_value.

See also

System::DeclareInputPort() for more information.

DeclareAbstractOutputPort(*args, **kwargs)

Overloaded function.

  1. DeclareAbstractOutputPort(self: pydrake.systems.framework.LeafSystem_[float], name: str, alloc: Callable[[], pydrake.common.value.AbstractValue], calc: Callable[[pydrake.systems.framework.Context_[float], pydrake.common.value.AbstractValue], None], prerequisites_of_calc: Set[pydrake.systems.framework.DependencyTicket] = {DependencyTicket(15)}) -> pydrake.systems.framework.OutputPort_[float]

(Advanced) Declares an abstract-valued output port using the given allocator and calculator functions provided in their most generic forms. If you have a member function available use one of the other signatures.

See also

LeafOutputPort::AllocCallback, LeafOutputPort::CalcCallback

  1. DeclareAbstractOutputPort(self: pydrake.systems.framework.LeafSystem_[float], alloc: Callable[[], pydrake.common.value.AbstractValue], calc: Callable[[pydrake.systems.framework.Context_[float], pydrake.common.value.AbstractValue], None]) -> pydrake.systems.framework.OutputPort_[float]

(Advanced) Declares an abstract-valued output port using the given allocator and calculator functions provided in their most generic forms. If you have a member function available use one of the other signatures.

See also

LeafOutputPort::AllocCallback, LeafOutputPort::CalcCallback

DeclareAbstractParameter(self: pydrake.systems.framework.LeafSystem_[float], model_value: pydrake.common.value.AbstractValue) → int

Declares an abstract parameter using the given model_value. LeafSystem’s default implementation of SetDefaultParameters() will reset parameters to their model values. Returns the index of the new parameter.

DeclareAbstractState(self: pydrake.systems.framework.LeafSystem_[float], arg0: pydrake.common.value.AbstractValue) → pydrake.systems.framework.AbstractStateIndex

Declares an abstract state.

Parameter abstract_state:
The abstract state model value.
Returns:index of the declared abstract state.
DeclareContinuousState(*args, **kwargs)

Overloaded function.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[float], num_state_variables: int) -> None

Declares that this System should reserve continuous state with num_state_variables state variables, which have no second-order structure.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[float], num_q: int, num_v: int, num_z: int) -> None

Declares that this System should reserve continuous state with num_q generalized positions, num_v generalized velocities, and num_z miscellaneous state variables.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[float], model_vector: pydrake.systems.framework.BasicVector_[float]) -> None

Declares that this System should reserve continuous state with model_vector.size() miscellaneous state variables, stored in a vector cloned from model_vector.

  1. DeclareContinuousState(self: pydrake.systems.framework.LeafSystem_[float], model_vector: pydrake.systems.framework.BasicVector_[float], num_q: int, num_v: int, num_z: int) -> None

Declares that this System should reserve continuous state with num_q generalized positions, num_v generalized velocities, and num_z miscellaneous state variables, stored in a vector cloned from model_vector. Aborts if model_vector has the wrong size. If the model_vector declares any VectorBase::GetElementBounds() constraints, they will be re-declared as inequality constraints on this system (see DeclareInequalityConstraint()).

DeclareDiscreteState(*args, **kwargs)

Overloaded function.

  1. DeclareDiscreteState(self: pydrake.systems.framework.LeafSystem_[float], model_vector: pydrake.systems.framework.BasicVector_[float]) -> pydrake.systems.framework.DiscreteStateIndex

Declares a discrete state group with model_vector.size() state variables, stored in a vector cloned from model_vector (preserving the concrete type and value).

  1. DeclareDiscreteState(self: pydrake.systems.framework.LeafSystem_[float], vector: numpy.ndarray[numpy.float64[m, 1]]) -> pydrake.systems.framework.DiscreteStateIndex

Declares a discrete state group with vector.size() state variables, stored in a BasicVector initialized with the contents of vector.

  1. DeclareDiscreteState(self: pydrake.systems.framework.LeafSystem_[float], num_state_variables: int) -> pydrake.systems.framework.DiscreteStateIndex

Declares a discrete state group with num_state_variables state variables, stored in a BasicVector initialized to be all-zero. If you want non-zero initial values, use an alternate DeclareDiscreteState() signature that accepts a model_vector parameter.

Precondition:
num_state_variables must be non-negative.
DeclareInitializationEvent(self: pydrake.systems.framework.LeafSystem_[float], event: pydrake.systems.framework.Event_[float]) → None

(Advanced) Declares that a particular Event object should be dispatched at initialization. This is the most general form for declaring initialization events and most users should use one of the other methods in this group instead.

See also

DeclareInitializationPublishEvent()

See also

DeclareInitializationDiscreteUpdateEvent()

See also

DeclareInitializationUnrestrictedUpdate()

See declare_initialization_events “Declare initialization events” for more information.

Depending on the type of event, on initialization it will be passed to the Publish, DiscreteUpdate, or UnrestrictedUpdate event dispatcher. If the event object contains a handler function, Drake’s default dispatchers will invoke that handler. If not, then no further action is taken. Thus an event with no handler has no effect unless its dispatcher has been overridden. We strongly recommend that you do not override the dispatcher and instead do supply a handler.

The given event object is deep-copied (cloned), and the copy is stored internally so you do not need to keep the object around after this call.

Precondition:
event’s associated trigger type must be TriggerType::kUnknown or already set to TriggerType::kInitialization.
DeclareNumericParameter(self: pydrake.systems.framework.LeafSystem_[float], model_vector: pydrake.systems.framework.BasicVector_[float]) → int

Declares a numeric parameter using the given model_vector. LeafSystem’s default implementation of SetDefaultParameters() will reset parameters to their model vectors. If the model_vector declares any VectorBase::GetElementBounds() constraints, they will be re-declared as inequality constraints on this system (see DeclareInequalityConstraint()). Returns the index of the new parameter.

DeclarePeriodicDiscreteUpdate(self: pydrake.systems.framework.LeafSystem_[float], period_sec: float, offset_sec: float = 0.0) → None

(To be deprecated) Declares a periodic discrete update event that invokes the DiscreteUpdate() dispatcher but does not provide a handler function. This does guarantee that a Simulator step will end exactly at the update time, but otherwise has no effect unless the DoDiscreteUpdate() dispatcher has been overloaded (not recommended).

DeclarePeriodicEvent(self: pydrake.systems.framework.LeafSystem_[float], period_sec: float, offset_sec: float, event: pydrake.systems.framework.Event_[float]) → None

(Advanced) Declares that a particular Event object should be dispatched periodically. This is the most general form for declaring periodic events and most users should use one of the other methods in this group instead.

See also

DeclarePeriodicPublishEvent()

See also

DeclarePeriodicDiscreteUpdateEvent()

See also

DeclarePeriodicUnrestrictedUpdateEvent()

See declare_periodic_events “Declare periodic events” for more information.

Depending on the type of event, when triggered it will be passed to the Publish, DiscreteUpdate, or UnrestrictedUpdate event dispatcher. If the event object contains a handler function, Drake’s default dispatchers will invoke that handler. If not, then no further action is taken. Thus an event with no handler has no effect unless its dispatcher has been overridden. We strongly recommend that you do not override the dispatcher and instead do supply a handler.

The given event object is deep-copied (cloned), and the copy is stored internally so you do not need to keep the object around after this call.

Precondition:
event’s associated trigger type must be TriggerType::kUnknown or already set to TriggerType::kPeriodic.
DeclarePeriodicPublish(self: pydrake.systems.framework.LeafSystem_[float], period_sec: float, offset_sec: float = 0.0) → None

(To be deprecated) Declares a periodic publish event that invokes the Publish() dispatcher but does not provide a handler function. This does guarantee that a Simulator step will end exactly at the publish time, but otherwise has no effect unless the DoPublish() dispatcher has been overloaded (not recommended).

DeclarePerStepEvent(self: pydrake.systems.framework.LeafSystem_[float], event: pydrake.systems.framework.Event_[float]) → None

(Advanced) Declares that a particular Event object should be dispatched at every trajectory-advancing step. Publish events are dispatched at the end of initialization and at the end of each step. Discrete- and unrestricted update events are dispatched at the start of each step. This is the most general form for declaring per-step events and most users should use one of the other methods in this group instead.

See also

DeclarePerStepPublishEvent()

See also

DeclarePerStepDiscreteUpdateEvent()

See also

DeclarePerStepUnrestrictedUpdateEvent()

See declare_per-step_events “Declare per-step events” for more information.

Depending on the type of event, at each step it will be passed to the Publish, DiscreteUpdate, or UnrestrictedUpdate event dispatcher. If the event object contains a handler function, Drake’s default dispatchers will invoke that handler. If not, then no further action is taken. Thus an event with no handler has no effect unless its dispatcher has been overridden. We strongly recommend that you do not override the dispatcher and instead do supply a handler.

The given event object is deep-copied (cloned), and the copy is stored internally so you do not need to keep the object around after this call.

Precondition:
event’s associated trigger type must be TriggerType::kUnknown or already set to TriggerType::kPerStep.
DeclareVectorInputPort(self: pydrake.systems.framework.LeafSystem_[float], name: str, model_vector: pydrake.systems.framework.BasicVector_[float], random_type: Optional[pydrake.common._module_py.RandomDistribution] = None) → pydrake.systems.framework.InputPort_[float]

Declares a vector-valued input port using the given model_vector. This is the best way to declare LeafSystem input ports that require subclasses of BasicVector. The port’s size and type will be the same as model_vector. If the port is intended to model a random noise or disturbance input, random_type can (optionally) be used to label it as such. If the model_vector declares any VectorBase::GetElementBounds() constraints, they will be re-declared as inequality constraints on this system (see DeclareInequalityConstraint()).

See also

System::DeclareInputPort() for more information.

DeclareVectorOutputPort(*args, **kwargs)

Overloaded function.

  1. DeclareVectorOutputPort(self: pydrake.systems.framework.LeafSystem_[float], name: str, model_value: pydrake.systems.framework.BasicVector_[float], calc: Callable[[pydrake.systems.framework.Context_[float], pydrake.systems.framework.BasicVector_[float]], None], prerequisites_of_calc: Set[pydrake.systems.framework.DependencyTicket] = {DependencyTicket(15)}) -> pydrake.systems.framework.OutputPort_[float]

(Advanced) Declares a vector-valued output port using the given model_vector and a function for calculating the port’s value at runtime. The port’s size will be model_vector.size(), and the default allocator for the port will be model_vector.Clone(). Note that this takes the calculator function in its most generic form; if you have a member function available use one of the other signatures.

See also

LeafOutputPort::CalcVectorCallback

  1. DeclareVectorOutputPort(self: pydrake.systems.framework.LeafSystem_[float], arg0: pydrake.systems.framework.BasicVector_[float], arg1: Callable[[pydrake.systems.framework.Context_[float], pydrake.systems.framework.BasicVector_[float]], None]) -> pydrake.systems.framework.OutputPort_[float]

(Advanced) Declares a vector-valued output port using the given model_vector and a function for calculating the port’s value at runtime. The port’s size will be model_vector.size(), and the default allocator for the port will be model_vector.Clone(). Note that this takes the calculator function in its most generic form; if you have a member function available use one of the other signatures.

See also

LeafOutputPort::CalcVectorCallback

DoCalcDiscreteVariableUpdates(self: pydrake.systems.framework.LeafSystem_[float], arg0: pydrake.systems.framework.Context_[float], arg1: List[pydrake.systems.framework.DiscreteUpdateEvent_[float]], arg2: pydrake.systems.framework.DiscreteValues_[float]) → None

Derived-class event dispatcher for all simultaneous discrete update events. Override this in your derived LeafSystem only if you require behavior other than the default dispatch behavior (not common). The default behavior is to traverse events in the arbitrary order they appear in events, and for each event that has a callback function, to invoke the callback with context, that event, and discrete_state. Note that the same (possibly modified) discrete_state is passed to subsequent callbacks.

Do not override this just to handle an event – instead declare the event and a handler callback for it using one of the Declare...DiscreteUpdateEvent() methods.

This method is called only from the virtual DispatchDiscreteVariableUpdateHandler(), which is only called from the public non-virtual CalcDiscreteVariableUpdates(), which will already have error-checked the parameters so you don’t have to. In particular, implementations may assume that context is valid; that discrete_state is non-null, and that the referenced object has the same constituent structure as was produced by AllocateDiscreteVariables().

Parameter context:
The “before” state.
Parameter events:
All the discrete update events that need handling.
Parameter discrete_state:
The current state of the system on input; the desired state of the system on return.
DoCalcTimeDerivatives(self: pydrake.systems.framework.LeafSystem_[float], arg0: pydrake.systems.framework.Context_[float], arg1: pydrake.systems.framework.ContinuousState_[float]) → None
DoPublish(self: pydrake.systems.framework.LeafSystem_[float], arg0: pydrake.systems.framework.Context_[float], arg1: List[pydrake.systems.framework.PublishEvent_[float]]) → None

Derived-class event dispatcher for all simultaneous publish events in events. Override this in your derived LeafSystem only if you require behavior other than the default dispatch behavior (not common). The default behavior is to traverse events in the arbitrary order they appear in events, and for each event that has a callback function, to invoke the callback with context and that event.

Do not override this just to handle an event – instead declare the event and a handler callback for it using one of the Declare...PublishEvent() methods.

This method is called only from the virtual DispatchPublishHandler, which is only called from the public non-virtual Publish(), which will have already error-checked context so you may assume that it is valid.

Parameter context:
Const current context.
Parameter events:
All the publish events that need handling.
MakeWitnessFunction(*args, **kwargs)

Overloaded function.

  1. MakeWitnessFunction(self: pydrake.systems.framework.LeafSystem_[float], description: str, direction_type: pydrake.systems.framework.WitnessFunctionDirection, calc: Callable[[pydrake.systems.framework.Context_[float]], float]) -> pydrake.systems.framework.WitnessFunction_[float]

Constructs the witness function with the given description (used primarily for debugging and logging), direction type, and calculator function; and with no event object.

Note

In order for the witness function to be used, you MUST overload System::DoGetWitnessFunctions().

  1. MakeWitnessFunction(self: pydrake.systems.framework.LeafSystem_[float], description: str, direction_type: pydrake.systems.framework.WitnessFunctionDirection, calc: Callable[[pydrake.systems.framework.Context_[float]], float], e: pydrake.systems.framework.Event_[float]) -> pydrake.systems.framework.WitnessFunction_[float]

Constructs the witness function with the given description (used primarily for debugging and logging), direction type, and calculator function, and with an object corresponding to the event that is to be dispatched when this witness function triggers. Example types of event objects are publish, discrete variable update, unrestricted update events. A clone of the event will be owned by the newly constructed WitnessFunction.

Note

In order for the witness function to be used, you MUST overload System::DoGetWitnessFunctions().

class pydrake.systems.framework.NumericParameterIndex
__init__(self: pydrake.systems.framework.NumericParameterIndex, arg0: int) → None

Default constructor; the result is an invalid index. This only exists to serve applications which require a default constructor.

is_valid(self: pydrake.systems.framework.NumericParameterIndex) → bool

Reports if the index is valid–the only operation on an invalid index that doesn’t throw an exception in Debug builds.

pydrake.systems.framework.OutputPort

alias of pydrake.systems.framework.OutputPort_[float]

template pydrake.systems.framework.OutputPort_

Instantiations: OutputPort_[float], OutputPort_[AutoDiffXd], OutputPort_[Expression]

class OutputPort_[float]

An OutputPort belongs to a System and represents the properties of one of that System’s output ports. OutputPort objects are assigned OutputPortIndex values in the order they are declared; these are unique within a single System.

An output port can be considered a “window” into a System that permits controlled exposure of one of the values contained in that System’s Context at run time. Input ports of other subsystems may be connected to an output port to construct system diagrams with carefully managed interdependencies.

The exposed value may be the result of an output computation, or it may simply expose some other value contained in the Context, such as the values of state variables. The Context handles caching of output port values and tracks dependencies to ensure that the values are valid with respect to their prerequisites. Leaf systems provide for the production of output port values, by computation or forwarding from other values within the associated leaf context. A diagram’s output ports, on the other hand, are exported from output ports of its contained subsystems.

An output port’s value is always stored as an AbstractValue, but we also provide special handling for output ports known to have numeric (vector) values. Vector-valued ports may specify a particular vector length, or may leave that to be determined at runtime.

OutputPort objects support three important operations:

  • Allocate() returns an object that can hold the port’s value.
  • Calc() unconditionally computes the port’s value.
  • Eval() updates a cached value if necessary.
__init__

Initialize self. See help(type(self)) for accurate signature.

Allocate(self: pydrake.systems.framework.OutputPort_[float]) → pydrake.common.value.AbstractValue

Allocates a concrete object suitable for holding the value to be exposed by this output port, and returns that as an AbstractValue. The returned object will never be null. If Drake assertions are enabled (typically only in Debug builds), validates for a vector-valued port that the returned AbstractValue is actually a BasicVector-derived type and that it has an acceptable size.

Note

If this is a vector-valued port, the underlying type is Value<BasicVector<T>>; downcast to BasicVector<T> before downcasting to the specific BasicVector subclass.

Eval(self: pydrake.systems.framework.OutputPort_[float], arg0: pydrake.systems.framework.Context_[float]) → object
EvalAbstract(self: pydrake.systems.framework.OutputPort_[float], context: pydrake.systems.framework.Context_[float]) → object

(Advanced.) Returns the value of this output port, typed as an AbstractValue. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts an AbstractValue.

EvalBasicVector(self: pydrake.systems.framework.OutputPort_[float], context: pydrake.systems.framework.Context_[float]) → object

(Advanced.) Returns the value of this output port, typed as a BasicVector. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts a BasicVector.

get_data_type(self: pydrake.systems.framework.OutputPort_[float]) → pydrake.systems.framework.PortDataType

Returns the port data type.

get_index(self: pydrake.systems.framework.OutputPort_[float]) → pydrake.systems.framework.OutputPortIndex

Returns the index of this output port within the owning System. For a Diagram, this will be the index within the Diagram, not the index within the LeafSystem whose output port was forwarded.

get_name(self: pydrake.systems.framework.OutputPort_[float]) → str

Get port name.

get_system(self: pydrake.systems.framework.OutputPort_[float]) → drake::systems::System<double>

Returns a reference to the System that owns this output port. Note that for a diagram output port this will be the diagram, not the leaf system whose output port was forwarded.

size(self: pydrake.systems.framework.OutputPort_[float]) → int

Returns the fixed size expected for a vector-valued port. Not meaningful for abstract-valued ports.

class pydrake.systems.framework.OutputPort_[AutoDiffXd]

An OutputPort belongs to a System and represents the properties of one of that System’s output ports. OutputPort objects are assigned OutputPortIndex values in the order they are declared; these are unique within a single System.

An output port can be considered a “window” into a System that permits controlled exposure of one of the values contained in that System’s Context at run time. Input ports of other subsystems may be connected to an output port to construct system diagrams with carefully managed interdependencies.

The exposed value may be the result of an output computation, or it may simply expose some other value contained in the Context, such as the values of state variables. The Context handles caching of output port values and tracks dependencies to ensure that the values are valid with respect to their prerequisites. Leaf systems provide for the production of output port values, by computation or forwarding from other values within the associated leaf context. A diagram’s output ports, on the other hand, are exported from output ports of its contained subsystems.

An output port’s value is always stored as an AbstractValue, but we also provide special handling for output ports known to have numeric (vector) values. Vector-valued ports may specify a particular vector length, or may leave that to be determined at runtime.

OutputPort objects support three important operations:

  • Allocate() returns an object that can hold the port’s value.
  • Calc() unconditionally computes the port’s value.
  • Eval() updates a cached value if necessary.
__init__

Initialize self. See help(type(self)) for accurate signature.

Allocate(self: pydrake.systems.framework.OutputPort_[AutoDiffXd]) → pydrake.common.value.AbstractValue

Allocates a concrete object suitable for holding the value to be exposed by this output port, and returns that as an AbstractValue. The returned object will never be null. If Drake assertions are enabled (typically only in Debug builds), validates for a vector-valued port that the returned AbstractValue is actually a BasicVector-derived type and that it has an acceptable size.

Note

If this is a vector-valued port, the underlying type is Value<BasicVector<T>>; downcast to BasicVector<T> before downcasting to the specific BasicVector subclass.

Eval(self: pydrake.systems.framework.OutputPort_[AutoDiffXd], arg0: pydrake.systems.framework.Context_[AutoDiffXd]) → object
EvalAbstract(self: pydrake.systems.framework.OutputPort_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) → object

(Advanced.) Returns the value of this output port, typed as an AbstractValue. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts an AbstractValue.

EvalBasicVector(self: pydrake.systems.framework.OutputPort_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) → object

(Advanced.) Returns the value of this output port, typed as a BasicVector. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts a BasicVector.

get_data_type(self: pydrake.systems.framework.OutputPort_[AutoDiffXd]) → pydrake.systems.framework.PortDataType

Returns the port data type.

get_index(self: pydrake.systems.framework.OutputPort_[AutoDiffXd]) → pydrake.systems.framework.OutputPortIndex

Returns the index of this output port within the owning System. For a Diagram, this will be the index within the Diagram, not the index within the LeafSystem whose output port was forwarded.

get_name(self: pydrake.systems.framework.OutputPort_[AutoDiffXd]) → str

Get port name.

get_system(self: pydrake.systems.framework.OutputPort_[AutoDiffXd]) → drake::systems::System<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Returns a reference to the System that owns this output port. Note that for a diagram output port this will be the diagram, not the leaf system whose output port was forwarded.

size(self: pydrake.systems.framework.OutputPort_[AutoDiffXd]) → int

Returns the fixed size expected for a vector-valued port. Not meaningful for abstract-valued ports.

class pydrake.systems.framework.OutputPort_[Expression]

An OutputPort belongs to a System and represents the properties of one of that System’s output ports. OutputPort objects are assigned OutputPortIndex values in the order they are declared; these are unique within a single System.

An output port can be considered a “window” into a System that permits controlled exposure of one of the values contained in that System’s Context at run time. Input ports of other subsystems may be connected to an output port to construct system diagrams with carefully managed interdependencies.

The exposed value may be the result of an output computation, or it may simply expose some other value contained in the Context, such as the values of state variables. The Context handles caching of output port values and tracks dependencies to ensure that the values are valid with respect to their prerequisites. Leaf systems provide for the production of output port values, by computation or forwarding from other values within the associated leaf context. A diagram’s output ports, on the other hand, are exported from output ports of its contained subsystems.

An output port’s value is always stored as an AbstractValue, but we also provide special handling for output ports known to have numeric (vector) values. Vector-valued ports may specify a particular vector length, or may leave that to be determined at runtime.

OutputPort objects support three important operations:

  • Allocate() returns an object that can hold the port’s value.
  • Calc() unconditionally computes the port’s value.
  • Eval() updates a cached value if necessary.
__init__

Initialize self. See help(type(self)) for accurate signature.

Allocate(self: pydrake.systems.framework.OutputPort_[Expression]) → pydrake.common.value.AbstractValue

Allocates a concrete object suitable for holding the value to be exposed by this output port, and returns that as an AbstractValue. The returned object will never be null. If Drake assertions are enabled (typically only in Debug builds), validates for a vector-valued port that the returned AbstractValue is actually a BasicVector-derived type and that it has an acceptable size.

Note

If this is a vector-valued port, the underlying type is Value<BasicVector<T>>; downcast to BasicVector<T> before downcasting to the specific BasicVector subclass.

Eval(self: pydrake.systems.framework.OutputPort_[Expression], arg0: pydrake.systems.framework.Context_[Expression]) → object
EvalAbstract(self: pydrake.systems.framework.OutputPort_[Expression], context: pydrake.systems.framework.Context_[Expression]) → object

(Advanced.) Returns the value of this output port, typed as an AbstractValue. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts an AbstractValue.

EvalBasicVector(self: pydrake.systems.framework.OutputPort_[Expression], context: pydrake.systems.framework.Context_[Expression]) → object

(Advanced.) Returns the value of this output port, typed as a BasicVector. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts a BasicVector.

get_data_type(self: pydrake.systems.framework.OutputPort_[Expression]) → pydrake.systems.framework.PortDataType

Returns the port data type.

get_index(self: pydrake.systems.framework.OutputPort_[Expression]) → pydrake.systems.framework.OutputPortIndex

Returns the index of this output port within the owning System. For a Diagram, this will be the index within the Diagram, not the index within the LeafSystem whose output port was forwarded.

get_name(self: pydrake.systems.framework.OutputPort_[Expression]) → str

Get port name.

get_system(self: pydrake.systems.framework.OutputPort_[Expression]) → drake::systems::System<drake::symbolic::Expression>

Returns a reference to the System that owns this output port. Note that for a diagram output port this will be the diagram, not the leaf system whose output port was forwarded.

size(self: pydrake.systems.framework.OutputPort_[Expression]) → int

Returns the fixed size expected for a vector-valued port. Not meaningful for abstract-valued ports.

class pydrake.systems.framework.OutputPort_[float]

An OutputPort belongs to a System and represents the properties of one of that System’s output ports. OutputPort objects are assigned OutputPortIndex values in the order they are declared; these are unique within a single System.

An output port can be considered a “window” into a System that permits controlled exposure of one of the values contained in that System’s Context at run time. Input ports of other subsystems may be connected to an output port to construct system diagrams with carefully managed interdependencies.

The exposed value may be the result of an output computation, or it may simply expose some other value contained in the Context, such as the values of state variables. The Context handles caching of output port values and tracks dependencies to ensure that the values are valid with respect to their prerequisites. Leaf systems provide for the production of output port values, by computation or forwarding from other values within the associated leaf context. A diagram’s output ports, on the other hand, are exported from output ports of its contained subsystems.

An output port’s value is always stored as an AbstractValue, but we also provide special handling for output ports known to have numeric (vector) values. Vector-valued ports may specify a particular vector length, or may leave that to be determined at runtime.

OutputPort objects support three important operations:

  • Allocate() returns an object that can hold the port’s value.
  • Calc() unconditionally computes the port’s value.
  • Eval() updates a cached value if necessary.
__init__

Initialize self. See help(type(self)) for accurate signature.

Allocate(self: pydrake.systems.framework.OutputPort_[float]) → pydrake.common.value.AbstractValue

Allocates a concrete object suitable for holding the value to be exposed by this output port, and returns that as an AbstractValue. The returned object will never be null. If Drake assertions are enabled (typically only in Debug builds), validates for a vector-valued port that the returned AbstractValue is actually a BasicVector-derived type and that it has an acceptable size.

Note

If this is a vector-valued port, the underlying type is Value<BasicVector<T>>; downcast to BasicVector<T> before downcasting to the specific BasicVector subclass.

Eval(self: pydrake.systems.framework.OutputPort_[float], arg0: pydrake.systems.framework.Context_[float]) → object
EvalAbstract(self: pydrake.systems.framework.OutputPort_[float], context: pydrake.systems.framework.Context_[float]) → object

(Advanced.) Returns the value of this output port, typed as an AbstractValue. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts an AbstractValue.

EvalBasicVector(self: pydrake.systems.framework.OutputPort_[float], context: pydrake.systems.framework.Context_[float]) → object

(Advanced.) Returns the value of this output port, typed as a BasicVector. Most users should call Eval() instead. This method is only needed when the result will be passed into some other API that only accepts a BasicVector.

get_data_type(self: pydrake.systems.framework.OutputPort_[float]) → pydrake.systems.framework.PortDataType

Returns the port data type.

get_index(self: pydrake.systems.framework.OutputPort_[float]) → pydrake.systems.framework.OutputPortIndex

Returns the index of this output port within the owning System. For a Diagram, this will be the index within the Diagram, not the index within the LeafSystem whose output port was forwarded.

get_name(self: pydrake.systems.framework.OutputPort_[float]) → str

Get port name.

get_system(self: pydrake.systems.framework.OutputPort_[float]) → drake::systems::System<double>

Returns a reference to the System that owns this output port. Note that for a diagram output port this will be the diagram, not the leaf system whose output port was forwarded.

size(self: pydrake.systems.framework.OutputPort_[float]) → int

Returns the fixed size expected for a vector-valued port. Not meaningful for abstract-valued ports.

class pydrake.systems.framework.OutputPortIndex
__init__(self: pydrake.systems.framework.OutputPortIndex, arg0: int) → None

Default constructor; the result is an invalid index. This only exists to serve applications which require a default constructor.

is_valid(self: pydrake.systems.framework.OutputPortIndex) → bool

Reports if the index is valid–the only operation on an invalid index that doesn’t throw an exception in Debug builds.

class pydrake.systems.framework.OutputPortSelection

Members:

kNoOutput

kUseFirstOutputIfItExists

__init__(self: pydrake.systems.framework.OutputPortSelection, value: int) → None
kNoOutput = <OutputPortSelection.kNoOutput: -1>
kUseFirstOutputIfItExists = <OutputPortSelection.kUseFirstOutputIfItExists: -2>
name
value
pydrake.systems.framework.Parameters

alias of pydrake.systems.framework.Parameters_[float]

template pydrake.systems.framework.Parameters_

Instantiations: Parameters_[float], Parameters_[AutoDiffXd], Parameters_[Expression]

class Parameters_[float]

Parameters is a container for variables that parameterize a System so that it can represent a family of related models. Parameters are members of the Context. Parameters are not Inputs because they do not flow from upstream Systems, and they are not State because the System does not define update functions for them. If Parameters are modified, they are modified by application-specific logic, extrinsic to the System framework and to the flow of simulation time.

The Parameters include both vector-valued and abstract-valued elements.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.Parameters_[float]) -> None

Constructs an empty Parameters.

  1. __init__(self: pydrake.systems.framework.Parameters_[float], numeric: List[pydrake.systems.framework.BasicVector_[float]], abstract: List[pydrake.common.value.AbstractValue]) -> None

Constructs Parameters both numeric and abstract.

  1. __init__(self: pydrake.systems.framework.Parameters_[float], numeric: List[pydrake.systems.framework.BasicVector_[float]]) -> None

Constructs Parameters that are purely numeric.

  1. __init__(self: pydrake.systems.framework.Parameters_[float], abstract: List[pydrake.common.value.AbstractValue]) -> None

Constructs Parameters that are purely abstract.

  1. __init__(self: pydrake.systems.framework.Parameters_[float], vec: pydrake.systems.framework.BasicVector_[float]) -> None

Constructs Parameters in the common case where the parameters consist of exactly one numeric vector.

  1. __init__(self: pydrake.systems.framework.Parameters_[float], value: pydrake.common.value.AbstractValue) -> None

Constructs Parameters in the common case where the parameters consist of exactly one abstract value.

Clone(self: pydrake.systems.framework.Parameters_[float]) → pydrake.systems.framework.Parameters_[float]
get_abstract_parameter(self: pydrake.systems.framework.Parameters_[float], index: int) → pydrake.common.value.AbstractValue

Returns the abstract-valued parameter at index. Asserts if the index is out of bounds.

get_abstract_parameters(self: pydrake.systems.framework.Parameters_[float]) → pydrake.systems.framework.AbstractValues
get_mutable_abstract_parameter(self: pydrake.systems.framework.Parameters_[float], index: int) → pydrake.common.value.AbstractValue

Returns the abstract-valued parameter at index. Asserts if the index is out of bounds.

get_mutable_numeric_parameter(self: pydrake.systems.framework.Parameters_[float], index: int) → pydrake.systems.framework.BasicVector_[float]

Returns the vector-valued parameter at index. Asserts if the index is out of bounds.

get_numeric_parameter(self: pydrake.systems.framework.Parameters_[float], index: int) → pydrake.systems.framework.BasicVector_[float]

Returns the vector-valued parameter at index. Asserts if the index is out of bounds.

get_numeric_parameters(self: pydrake.systems.framework.Parameters_[float]) → drake::systems::DiscreteValues<double>
num_abstract_parameters(self: pydrake.systems.framework.Parameters_[float]) → int
num_numeric_parameter_groups(self: pydrake.systems.framework.Parameters_[float]) → int
set_abstract_parameters(self: pydrake.systems.framework.Parameters_[float], abstract_params: pydrake.systems.framework.AbstractValues) → None
set_numeric_parameters(self: pydrake.systems.framework.Parameters_[float], numeric_params: drake::systems::DiscreteValues<double>) → None
SetFrom(self: pydrake.systems.framework.Parameters_[float], arg0: pydrake.systems.framework.Parameters_[float]) → None

Initializes this state from other.

class pydrake.systems.framework.Parameters_[AutoDiffXd]

Parameters is a container for variables that parameterize a System so that it can represent a family of related models. Parameters are members of the Context. Parameters are not Inputs because they do not flow from upstream Systems, and they are not State because the System does not define update functions for them. If Parameters are modified, they are modified by application-specific logic, extrinsic to the System framework and to the flow of simulation time.

The Parameters include both vector-valued and abstract-valued elements.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.Parameters_[AutoDiffXd]) -> None

Constructs an empty Parameters.

  1. __init__(self: pydrake.systems.framework.Parameters_[AutoDiffXd], numeric: List[pydrake.systems.framework.BasicVector_[AutoDiffXd]], abstract: List[pydrake.common.value.AbstractValue]) -> None

Constructs Parameters both numeric and abstract.

  1. __init__(self: pydrake.systems.framework.Parameters_[AutoDiffXd], numeric: List[pydrake.systems.framework.BasicVector_[AutoDiffXd]]) -> None

Constructs Parameters that are purely numeric.

  1. __init__(self: pydrake.systems.framework.Parameters_[AutoDiffXd], abstract: List[pydrake.common.value.AbstractValue]) -> None

Constructs Parameters that are purely abstract.

  1. __init__(self: pydrake.systems.framework.Parameters_[AutoDiffXd], vec: pydrake.systems.framework.BasicVector_[AutoDiffXd]) -> None

Constructs Parameters in the common case where the parameters consist of exactly one numeric vector.

  1. __init__(self: pydrake.systems.framework.Parameters_[AutoDiffXd], value: pydrake.common.value.AbstractValue) -> None

Constructs Parameters in the common case where the parameters consist of exactly one abstract value.

Clone(self: pydrake.systems.framework.Parameters_[AutoDiffXd]) → pydrake.systems.framework.Parameters_[AutoDiffXd]
get_abstract_parameter(self: pydrake.systems.framework.Parameters_[AutoDiffXd], index: int) → pydrake.common.value.AbstractValue

Returns the abstract-valued parameter at index. Asserts if the index is out of bounds.

get_abstract_parameters(self: pydrake.systems.framework.Parameters_[AutoDiffXd]) → pydrake.systems.framework.AbstractValues
get_mutable_abstract_parameter(self: pydrake.systems.framework.Parameters_[AutoDiffXd], index: int) → pydrake.common.value.AbstractValue

Returns the abstract-valued parameter at index. Asserts if the index is out of bounds.

get_mutable_numeric_parameter(self: pydrake.systems.framework.Parameters_[AutoDiffXd], index: int) → pydrake.systems.framework.BasicVector_[AutoDiffXd]

Returns the vector-valued parameter at index. Asserts if the index is out of bounds.

get_numeric_parameter(self: pydrake.systems.framework.Parameters_[AutoDiffXd], index: int) → pydrake.systems.framework.BasicVector_[AutoDiffXd]

Returns the vector-valued parameter at index. Asserts if the index is out of bounds.

get_numeric_parameters(self: pydrake.systems.framework.Parameters_[AutoDiffXd]) → drake::systems::DiscreteValues<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >
num_abstract_parameters(self: pydrake.systems.framework.Parameters_[AutoDiffXd]) → int
num_numeric_parameter_groups(self: pydrake.systems.framework.Parameters_[AutoDiffXd]) → int
set_abstract_parameters(self: pydrake.systems.framework.Parameters_[AutoDiffXd], abstract_params: pydrake.systems.framework.AbstractValues) → None
set_numeric_parameters(self: pydrake.systems.framework.Parameters_[AutoDiffXd], numeric_params: drake::systems::DiscreteValues<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >) → None
SetFrom(self: pydrake.systems.framework.Parameters_[AutoDiffXd], arg0: pydrake.systems.framework.Parameters_[float]) → None

Initializes this state from other.

class pydrake.systems.framework.Parameters_[Expression]

Parameters is a container for variables that parameterize a System so that it can represent a family of related models. Parameters are members of the Context. Parameters are not Inputs because they do not flow from upstream Systems, and they are not State because the System does not define update functions for them. If Parameters are modified, they are modified by application-specific logic, extrinsic to the System framework and to the flow of simulation time.

The Parameters include both vector-valued and abstract-valued elements.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.Parameters_[Expression]) -> None

Constructs an empty Parameters.

  1. __init__(self: pydrake.systems.framework.Parameters_[Expression], numeric: List[pydrake.systems.framework.BasicVector_[Expression]], abstract: List[pydrake.common.value.AbstractValue]) -> None

Constructs Parameters both numeric and abstract.

  1. __init__(self: pydrake.systems.framework.Parameters_[Expression], numeric: List[pydrake.systems.framework.BasicVector_[Expression]]) -> None

Constructs Parameters that are purely numeric.

  1. __init__(self: pydrake.systems.framework.Parameters_[Expression], abstract: List[pydrake.common.value.AbstractValue]) -> None

Constructs Parameters that are purely abstract.

  1. __init__(self: pydrake.systems.framework.Parameters_[Expression], vec: pydrake.systems.framework.BasicVector_[Expression]) -> None

Constructs Parameters in the common case where the parameters consist of exactly one numeric vector.

  1. __init__(self: pydrake.systems.framework.Parameters_[Expression], value: pydrake.common.value.AbstractValue) -> None

Constructs Parameters in the common case where the parameters consist of exactly one abstract value.

Clone(self: pydrake.systems.framework.Parameters_[Expression]) → pydrake.systems.framework.Parameters_[Expression]
get_abstract_parameter(self: pydrake.systems.framework.Parameters_[Expression], index: int) → pydrake.common.value.AbstractValue

Returns the abstract-valued parameter at index. Asserts if the index is out of bounds.

get_abstract_parameters(self: pydrake.systems.framework.Parameters_[Expression]) → pydrake.systems.framework.AbstractValues
get_mutable_abstract_parameter(self: pydrake.systems.framework.Parameters_[Expression], index: int) → pydrake.common.value.AbstractValue

Returns the abstract-valued parameter at index. Asserts if the index is out of bounds.

get_mutable_numeric_parameter(self: pydrake.systems.framework.Parameters_[Expression], index: int) → pydrake.systems.framework.BasicVector_[Expression]

Returns the vector-valued parameter at index. Asserts if the index is out of bounds.

get_numeric_parameter(self: pydrake.systems.framework.Parameters_[Expression], index: int) → pydrake.systems.framework.BasicVector_[Expression]

Returns the vector-valued parameter at index. Asserts if the index is out of bounds.

get_numeric_parameters(self: pydrake.systems.framework.Parameters_[Expression]) → drake::systems::DiscreteValues<drake::symbolic::Expression>
num_abstract_parameters(self: pydrake.systems.framework.Parameters_[Expression]) → int
num_numeric_parameter_groups(self: pydrake.systems.framework.Parameters_[Expression]) → int
set_abstract_parameters(self: pydrake.systems.framework.Parameters_[Expression], abstract_params: pydrake.systems.framework.AbstractValues) → None
set_numeric_parameters(self: pydrake.systems.framework.Parameters_[Expression], numeric_params: drake::systems::DiscreteValues<drake::symbolic::Expression>) → None
SetFrom(self: pydrake.systems.framework.Parameters_[Expression], arg0: pydrake.systems.framework.Parameters_[float]) → None

Initializes this state from other.

class pydrake.systems.framework.Parameters_[float]

Parameters is a container for variables that parameterize a System so that it can represent a family of related models. Parameters are members of the Context. Parameters are not Inputs because they do not flow from upstream Systems, and they are not State because the System does not define update functions for them. If Parameters are modified, they are modified by application-specific logic, extrinsic to the System framework and to the flow of simulation time.

The Parameters include both vector-valued and abstract-valued elements.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.Parameters_[float]) -> None

Constructs an empty Parameters.

  1. __init__(self: pydrake.systems.framework.Parameters_[float], numeric: List[pydrake.systems.framework.BasicVector_[float]], abstract: List[pydrake.common.value.AbstractValue]) -> None

Constructs Parameters both numeric and abstract.

  1. __init__(self: pydrake.systems.framework.Parameters_[float], numeric: List[pydrake.systems.framework.BasicVector_[float]]) -> None

Constructs Parameters that are purely numeric.

  1. __init__(self: pydrake.systems.framework.Parameters_[float], abstract: List[pydrake.common.value.AbstractValue]) -> None

Constructs Parameters that are purely abstract.

  1. __init__(self: pydrake.systems.framework.Parameters_[float], vec: pydrake.systems.framework.BasicVector_[float]) -> None

Constructs Parameters in the common case where the parameters consist of exactly one numeric vector.

  1. __init__(self: pydrake.systems.framework.Parameters_[float], value: pydrake.common.value.AbstractValue) -> None

Constructs Parameters in the common case where the parameters consist of exactly one abstract value.

Clone(self: pydrake.systems.framework.Parameters_[float]) → pydrake.systems.framework.Parameters_[float]
get_abstract_parameter(self: pydrake.systems.framework.Parameters_[float], index: int) → pydrake.common.value.AbstractValue

Returns the abstract-valued parameter at index. Asserts if the index is out of bounds.

get_abstract_parameters(self: pydrake.systems.framework.Parameters_[float]) → pydrake.systems.framework.AbstractValues
get_mutable_abstract_parameter(self: pydrake.systems.framework.Parameters_[float], index: int) → pydrake.common.value.AbstractValue

Returns the abstract-valued parameter at index. Asserts if the index is out of bounds.

get_mutable_numeric_parameter(self: pydrake.systems.framework.Parameters_[float], index: int) → pydrake.systems.framework.BasicVector_[float]

Returns the vector-valued parameter at index. Asserts if the index is out of bounds.

get_numeric_parameter(self: pydrake.systems.framework.Parameters_[float], index: int) → pydrake.systems.framework.BasicVector_[float]

Returns the vector-valued parameter at index. Asserts if the index is out of bounds.

get_numeric_parameters(self: pydrake.systems.framework.Parameters_[float]) → drake::systems::DiscreteValues<double>
num_abstract_parameters(self: pydrake.systems.framework.Parameters_[float]) → int
num_numeric_parameter_groups(self: pydrake.systems.framework.Parameters_[float]) → int
set_abstract_parameters(self: pydrake.systems.framework.Parameters_[float], abstract_params: pydrake.systems.framework.AbstractValues) → None
set_numeric_parameters(self: pydrake.systems.framework.Parameters_[float], numeric_params: drake::systems::DiscreteValues<double>) → None
SetFrom(self: pydrake.systems.framework.Parameters_[float], arg0: pydrake.systems.framework.Parameters_[float]) → None

Initializes this state from other.

class pydrake.systems.framework.PeriodicEventData

Bases: pydrake.systems.framework.EventData

A token describing an event that recurs on a fixed period. The events are triggered at time = offset_sec + i * period_sec, where i is a non-negative integer.

__init__

Initialize self. See help(type(self)) for accurate signature.

offset_sec(self: pydrake.systems.framework.PeriodicEventData) → float

Gets the time after zero when this event should first occur.

period_sec(self: pydrake.systems.framework.PeriodicEventData) → float

Gets the period with which this event should recur.

class pydrake.systems.framework.PortDataType

Members:

kVectorValued

kAbstractValued

__init__(self: pydrake.systems.framework.PortDataType, value: int) → None
kAbstractValued = <PortDataType.kAbstractValued: 1>
kVectorValued = <PortDataType.kVectorValued: 0>
name
value
pydrake.systems.framework.PublishEvent

alias of pydrake.systems.framework.PublishEvent_[float]

template pydrake.systems.framework.PublishEvent_

Instantiations: PublishEvent_[float], PublishEvent_[AutoDiffXd], PublishEvent_[Expression]

class PublishEvent_[float]

Bases: pydrake.systems.framework.Event_[float]

This class represents a publish event. It has an optional callback function to do custom handling of this event given const Context and const PublishEvent object references.

See also

System::Publish for more details.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.PublishEvent_[float], callback: Callable[[pydrake.systems.framework.Context_[float], pydrake.systems.framework.PublishEvent_[float]], None]) -> None

Makes a PublishEvent with no trigger type, no event data, and the specified callback function.

  1. __init__(self: pydrake.systems.framework.PublishEvent_[float], trigger_type: pydrake.systems.framework.TriggerType, callback: Callable[[pydrake.systems.framework.Context_[float], pydrake.systems.framework.PublishEvent_[float]], None]) -> None

Users should not be calling these

class pydrake.systems.framework.PublishEvent_[AutoDiffXd]

Bases: pydrake.systems.framework.Event_[AutoDiffXd]

This class represents a publish event. It has an optional callback function to do custom handling of this event given const Context and const PublishEvent object references.

See also

System::Publish for more details.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.PublishEvent_[AutoDiffXd], callback: Callable[[pydrake.systems.framework.Context_[AutoDiffXd], pydrake.systems.framework.PublishEvent_[AutoDiffXd]], None]) -> None

Makes a PublishEvent with no trigger type, no event data, and the specified callback function.

  1. __init__(self: pydrake.systems.framework.PublishEvent_[AutoDiffXd], trigger_type: pydrake.systems.framework.TriggerType, callback: Callable[[pydrake.systems.framework.Context_[AutoDiffXd], pydrake.systems.framework.PublishEvent_[AutoDiffXd]], None]) -> None

Users should not be calling these

class pydrake.systems.framework.PublishEvent_[Expression]

Bases: pydrake.systems.framework.Event_[Expression]

This class represents a publish event. It has an optional callback function to do custom handling of this event given const Context and const PublishEvent object references.

See also

System::Publish for more details.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.PublishEvent_[Expression], callback: Callable[[pydrake.systems.framework.Context_[Expression], pydrake.systems.framework.PublishEvent_[Expression]], None]) -> None

Makes a PublishEvent with no trigger type, no event data, and the specified callback function.

  1. __init__(self: pydrake.systems.framework.PublishEvent_[Expression], trigger_type: pydrake.systems.framework.TriggerType, callback: Callable[[pydrake.systems.framework.Context_[Expression], pydrake.systems.framework.PublishEvent_[Expression]], None]) -> None

Users should not be calling these

class pydrake.systems.framework.PublishEvent_[float]

Bases: pydrake.systems.framework.Event_[float]

This class represents a publish event. It has an optional callback function to do custom handling of this event given const Context and const PublishEvent object references.

See also

System::Publish for more details.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.systems.framework.PublishEvent_[float], callback: Callable[[pydrake.systems.framework.Context_[float], pydrake.systems.framework.PublishEvent_[float]], None]) -> None

Makes a PublishEvent with no trigger type, no event data, and the specified callback function.

  1. __init__(self: pydrake.systems.framework.PublishEvent_[float], trigger_type: pydrake.systems.framework.TriggerType, callback: Callable[[pydrake.systems.framework.Context_[float], pydrake.systems.framework.PublishEvent_[float]], None]) -> None

Users should not be calling these

pydrake.systems.framework.State

alias of pydrake.systems.framework.State_[float]

template pydrake.systems.framework.State_

Instantiations: State_[float], State_[AutoDiffXd], State_[Expression]

class State_[float]

%State is a container for all the data comprising the complete state of a particular System at a particular moment. Any field in State may be empty if it is not applicable to the System in question. A System may not maintain state in any place other than a State object.

A State x contains three types of state variables:

  • ContinuousState xc
  • DiscreteState xd
  • AbstractState xa
__init__(self: pydrake.systems.framework.State_[float]) → None
get_abstract_state(self: pydrake.systems.framework.State_[float]) → pydrake.systems.framework.AbstractValues

Returns a const pointer to the abstract component of the state at index. Asserts if index doesn’t exist.

get_continuous_state(self: pydrake.systems.framework.State_[float]) → drake::systems::ContinuousState<double>
get_discrete_state(self: pydrake.systems.framework.State_[float]) → drake::systems::DiscreteValues<double>
get_mutable_abstract_state(self: pydrake.systems.framework.State_[float]) → pydrake.systems.framework.AbstractValues

Returns a mutable pointer to element index of the abstract state. Asserts if index doesn’t exist.

get_mutable_continuous_state(self: pydrake.systems.framework.State_[float]) → drake::systems::ContinuousState<double>
get_mutable_discrete_state(self: pydrake.systems.framework.State_[float]) → drake::systems::DiscreteValues<double>
class pydrake.systems.framework.State_[AutoDiffXd]

%State is a container for all the data comprising the complete state of a particular System at a particular moment. Any field in State may be empty if it is not applicable to the System in question. A System may not maintain state in any place other than a State object.

A State x contains three types of state variables:

  • ContinuousState xc
  • DiscreteState xd
  • AbstractState xa
__init__(self: pydrake.systems.framework.State_[AutoDiffXd]) → None
get_abstract_state(self: pydrake.systems.framework.State_[AutoDiffXd]) → pydrake.systems.framework.AbstractValues

Returns a const pointer to the abstract component of the state at index. Asserts if index doesn’t exist.

get_continuous_state(self: pydrake.systems.framework.State_[AutoDiffXd]) → drake::systems::ContinuousState<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >
get_discrete_state(self: pydrake.systems.framework.State_[AutoDiffXd]) → drake::systems::DiscreteValues<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >
get_mutable_abstract_state(self: pydrake.systems.framework.State_[AutoDiffXd]) → pydrake.systems.framework.AbstractValues

Returns a mutable pointer to element index of the abstract state. Asserts if index doesn’t exist.

get_mutable_continuous_state(self: pydrake.systems.framework.State_[AutoDiffXd]) → drake::systems::ContinuousState<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >
get_mutable_discrete_state(self: pydrake.systems.framework.State_[AutoDiffXd]) → drake::systems::DiscreteValues<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >
class pydrake.systems.framework.State_[Expression]

%State is a container for all the data comprising the complete state of a particular System at a particular moment. Any field in State may be empty if it is not applicable to the System in question. A System may not maintain state in any place other than a State object.

A State x contains three types of state variables:

  • ContinuousState xc
  • DiscreteState xd
  • AbstractState xa
__init__(self: pydrake.systems.framework.State_[Expression]) → None
get_abstract_state(self: pydrake.systems.framework.State_[Expression]) → pydrake.systems.framework.AbstractValues

Returns a const pointer to the abstract component of the state at index. Asserts if index doesn’t exist.

get_continuous_state(self: pydrake.systems.framework.State_[Expression]) → drake::systems::ContinuousState<drake::symbolic::Expression>
get_discrete_state(self: pydrake.systems.framework.State_[Expression]) → drake::systems::DiscreteValues<drake::symbolic::Expression>
get_mutable_abstract_state(self: pydrake.systems.framework.State_[Expression]) → pydrake.systems.framework.AbstractValues

Returns a mutable pointer to element index of the abstract state. Asserts if index doesn’t exist.

get_mutable_continuous_state(self: pydrake.systems.framework.State_[Expression]) → drake::systems::ContinuousState<drake::symbolic::Expression>
get_mutable_discrete_state(self: pydrake.systems.framework.State_[Expression]) → drake::systems::DiscreteValues<drake::symbolic::Expression>
class pydrake.systems.framework.State_[float]

%State is a container for all the data comprising the complete state of a particular System at a particular moment. Any field in State may be empty if it is not applicable to the System in question. A System may not maintain state in any place other than a State object.

A State x contains three types of state variables:

  • ContinuousState xc
  • DiscreteState xd
  • AbstractState xa
__init__(self: pydrake.systems.framework.State_[float]) → None
get_abstract_state(self: pydrake.systems.framework.State_[float]) → pydrake.systems.framework.AbstractValues

Returns a const pointer to the abstract component of the state at index. Asserts if index doesn’t exist.

get_continuous_state(self: pydrake.systems.framework.State_[float]) → drake::systems::ContinuousState<double>
get_discrete_state(self: pydrake.systems.framework.State_[float]) → drake::systems::DiscreteValues<double>
get_mutable_abstract_state(self: pydrake.systems.framework.State_[float]) → pydrake.systems.framework.AbstractValues

Returns a mutable pointer to element index of the abstract state. Asserts if index doesn’t exist.

get_mutable_continuous_state(self: pydrake.systems.framework.State_[float]) → drake::systems::ContinuousState<double>
get_mutable_discrete_state(self: pydrake.systems.framework.State_[float]) → drake::systems::DiscreteValues<double>
class pydrake.systems.framework.SubsystemIndex
__init__(self: pydrake.systems.framework.SubsystemIndex, arg0: int) → None

Default constructor; the result is an invalid index. This only exists to serve applications which require a default constructor.

is_valid(self: pydrake.systems.framework.SubsystemIndex) → bool

Reports if the index is valid–the only operation on an invalid index that doesn’t throw an exception in Debug builds.

pydrake.systems.framework.Subvector

alias of pydrake.systems.framework.Subvector_[float]

template pydrake.systems.framework.Subvector_

Instantiations: Subvector_[float], Subvector_[AutoDiffXd], Subvector_[Expression]

class Subvector_[float]

Bases: pydrake.systems.framework.VectorBase_[float]

Subvector is a concrete class template that implements VectorBase by providing a sliced view of a VectorBase.

__init__

Initialize self. See help(type(self)) for accurate signature.

class pydrake.systems.framework.Subvector_[AutoDiffXd]

Bases: pydrake.systems.framework.VectorBase_[AutoDiffXd]

Subvector is a concrete class template that implements VectorBase by providing a sliced view of a VectorBase.

__init__

Initialize self. See help(type(self)) for accurate signature.

class pydrake.systems.framework.Subvector_[Expression]

Bases: pydrake.systems.framework.VectorBase_[Expression]

Subvector is a concrete class template that implements VectorBase by providing a sliced view of a VectorBase.

__init__

Initialize self. See help(type(self)) for accurate signature.

class pydrake.systems.framework.Subvector_[float]

Bases: pydrake.systems.framework.VectorBase_[float]

Subvector is a concrete class template that implements VectorBase by providing a sliced view of a VectorBase.

__init__

Initialize self. See help(type(self)) for accurate signature.

pydrake.systems.framework.Supervector

alias of pydrake.systems.framework.Supervector_[float]

template pydrake.systems.framework.Supervector_

Instantiations: Supervector_[float], Supervector_[AutoDiffXd], Supervector_[Expression]

class Supervector_[float]

Bases: pydrake.systems.framework.VectorBase_[float]

Supervector is a concrete class template that implements VectorBase by concatenating multiple VectorBases, which it does not own.

__init__

Initialize self. See help(type(self)) for accurate signature.

class pydrake.systems.framework.Supervector_[AutoDiffXd]

Bases: pydrake.systems.framework.VectorBase_[AutoDiffXd]

Supervector is a concrete class template that implements VectorBase by concatenating multiple VectorBases, which it does not own.

__init__

Initialize self. See help(type(self)) for accurate signature.

class pydrake.systems.framework.Supervector_[Expression]

Bases: pydrake.systems.framework.VectorBase_[Expression]

Supervector is a concrete class template that implements VectorBase by concatenating multiple VectorBases, which it does not own.

__init__

Initialize self. See help(type(self)) for accurate signature.

class pydrake.systems.framework.Supervector_[float]

Bases: pydrake.systems.framework.VectorBase_[float]

Supervector is a concrete class template that implements VectorBase by concatenating multiple VectorBases, which it does not own.

__init__

Initialize self. See help(type(self)) for accurate signature.

pydrake.systems.framework.System

alias of pydrake.systems.framework.System_[float]

template pydrake.systems.framework.System_

Instantiations: System_[float], System_[AutoDiffXd], System_[Expression]

class System_[float]

Bases: pydrake.systems.framework.SystemBase

Base class for all System functionality that is dependent on the templatized scalar type T for input, state, parameters, and outputs.

__init__

Initialize self. See help(type(self)) for accurate signature.

AllocateContext(self: pydrake.systems.framework.System_[float]) → pydrake.systems.framework.Context_[float]

Returns a Context<T> suitable for use with this System<T>.

AllocateDiscreteVariables(self: pydrake.systems.framework.System_[float]) → pydrake.systems.framework.DiscreteValues_[float]

Returns a DiscreteValues of the same dimensions as the discrete_state allocated in CreateDefaultContext. The simulator will provide this state as the output argument to Update.

AllocateOutput(self: pydrake.systems.framework.System_[float]) → pydrake.systems.framework.SystemOutput_[float]

Returns a container that can hold the values of all of this System’s output ports. It is sized with the number of output ports and uses each output port’s allocation method to provide an object of the right type for that port.

AllocateTimeDerivatives(self: pydrake.systems.framework.System_[float]) → pydrake.systems.framework.ContinuousState_[float]

Returns a ContinuousState of the same size as the continuous_state allocated in CreateDefaultContext. The simulator will provide this state as the output argument to EvalTimeDerivatives.

CalcConservativePower(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float]) → float

Calculates and returns the conservative power represented by the current contents of the given context. Prefer EvalConservativePower() to avoid unnecessary recalculation.

See also

EvalConservativePower() for more information.

CalcDiscreteVariableUpdates(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float], discrete_state: pydrake.systems.framework.DiscreteValues_[float]) → None

This method forces a discrete update on the system given a context, and the updated discrete state is stored in discrete_state. The discrete update event will have a trigger type of kForced, with no attribute or custom callback.

CalcKineticEnergy(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float]) → float

Calculates and returns the kinetic energy represented by the current configuration and velocity provided in context. Prefer EvalKineticEnergy() to avoid unnecessary recalculation.

See also

EvalKineticEnergy() for more information.

CalcNonConservativePower(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float]) → float

Calculates and returns the non-conservative power represented by the current contents of the given context. Prefer EvalNonConservativePower() to avoid unnecessary recalculation.

See also

EvalNonConservativePower() for more information.

CalcOutput(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float], outputs: pydrake.systems.framework.SystemOutput_[float]) → None

Utility method that computes for every output port i the value y(i) that should result from the current contents of the given Context. Note that individual output port values can be calculated using get_output_port(i).Calc(); this method invokes that for each output port in index order. The result may depend on time and the current values of input ports, parameters, and state variables. The result is written to outputs which must already have been allocated to have the right number of entries of the right types.

CalcPotentialEnergy(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float]) → float

Calculates and returns the potential energy represented by the current configuration provided in context. Prefer EvalPotentialEnergy() to avoid unnecessary recalculation.

See also

EvalPotentialEnergy() for more information.

CalcTimeDerivatives(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float], derivatives: pydrake.systems.framework.ContinuousState_[float]) → None

Calculates the time derivatives ẋ꜀ of the continuous state x꜀ into a given output argument. Prefer EvalTimeDerivatives() instead to avoid unnecessary recomputation.

This method solves the System equations in explicit form:

ẋ꜀ = fₑ(𝓒)

where 𝓒 = {a, p, t, x, u} is the current value of the given Context from which accuracy a, parameters p, time t, state x (={x꜀ xd xₐ}) and input values u are obtained.

Parameter context:
The source for time, state, inputs, etc. defining the point at which the derivatives should be calculated.
Parameter derivatives:
The time derivatives ẋ꜀. Must be the same size as the continuous state vector in context.

See also

EvalTimeDerivatives() for more information.

See also

CalcImplicitTimeDerivativesResidual() for the implicit form of these equations.

CreateDefaultContext(self: pydrake.systems.framework.System_[float]) → pydrake.systems.framework.Context_[float]

This convenience method allocates a context using AllocateContext() and sets its default values using SetDefaultContext().

DeclareInputPort(*args, **kwargs)

Overloaded function.

  1. DeclareInputPort(self: pydrake.systems.framework.System_[float], name: Union[str, pydrake.systems.framework.UseDefaultName], type: pydrake.systems.framework.PortDataType, size: int, random_type: Optional[pydrake.common._module_py.RandomDistribution] = None) -> pydrake.systems.framework.InputPort_[float]

Adds a port with the specified type and size to the input topology.

Input port names must be unique for this system (passing in a duplicate name will throw RuntimeError). If name is given as kUseDefaultName, then a default value of e.g. “u2”, where 2 is the input number will be provided. An empty name is not permitted.

If the port is intended to model a random noise or disturbance input, random_type can (optionally) be used to label it as such; doing so enables algorithms for design and analysis (e.g. state estimation) to reason explicitly about randomness at the system level. All random input ports are assumed to be statistically independent.

Precondition:
name must not be empty.
Raises:RuntimeError for a duplicate port name.
Returns:the declared port.
  1. DeclareInputPort(self: pydrake.systems.framework.System_[float], type: pydrake.systems.framework.PortDataType, size: int, random_type: Optional[pydrake.common._module_py.RandomDistribution] = None) -> pydrake.systems.framework.InputPort_[float]
EvalAbstractInput(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.Context_[float], arg1: int) → pydrake.common.value.AbstractValue

Returns the value of the input port with the given port_index as an AbstractValue, which is permitted for ports of any type. Causes the value to become up to date first if necessary, delegating to our parent Diagram. Returns a pointer to the port’s value, or nullptr if the port is not connected. If you know the actual type, use one of the more-specific signatures.

Precondition:
port_index selects an existing input port of this System.

See also

EvalInputValue(), System::EvalVectorInput(), System::EvalEigenVectorInput()

EvalKineticEnergy(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float]) → float

Returns a reference to the cached value of the kinetic energy (KE), evaluating first if necessary using CalcKineticEnergy().

By definition here, kinetic energy depends only on “configuration” and “velocity” (e.g. angular and translational velocity) of moving masses which includes a subset of the state variables, and parameters that affect configuration, velocities, or mass properties. The calculated value may also be affected by the accuracy value supplied in the Context. KE cannot depend explicitly on time (∂KE/∂t = 0) or input port values (∂KE/∂u = 0).

Non-physical systems where KE is not meaningful will return KE = 0.

Parameter context:
The Context whose configuration and velocity variables may be used to evaluate kinetic energy.
Returns KE:
The kinetic energy in joules (J) represented by the configuration and velocity given in context.

See also

CalcKineticEnergy()

EvalPotentialEnergy(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float]) → float

Returns a reference to the cached value of the potential energy (PE), evaluating first if necessary using CalcPotentialEnergy().

By definition here, potential energy depends only on “configuration” (e.g. orientation and position), which includes a subset of the state variables, and parameters that affect configuration or conservative forces (such as lengths and masses). The calculated value may also be affected by the accuracy value supplied in the Context. PE cannot depend explicitly on time (∂PE/∂t = 0), velocities (∂PE/∂v = 0), or input port values (∂PE/∂u = 0).

Non-physical systems where PE is not meaningful will return PE = 0.

Parameter context:
The Context whose configuration variables may be used to evaluate potential energy.
Returns PE:
The potential energy in joules (J) represented by the configuration given in context.

See also

CalcPotentialEnergy()

EvalTimeDerivatives(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.ContinuousState_[float]

Returns a reference to the cached value of the continuous state variable time derivatives, evaluating first if necessary using CalcTimeDerivatives().

This method returns the time derivatives ẋ꜀ of the continuous state x꜀. The referenced return object will correspond elementwise with the continuous state in the given Context. Thus, if the state in the Context has second-order structure x꜀ = [q v z], that same structure applies to the derivatives so we will have ẋ꜀ = [q̇ ̇v̇ ż].

Parameter context:
The Context whose time, input port, parameter, state, and accuracy values may be used to evaluate the derivatives.
Returns xcdot:
Time derivatives ẋ꜀ of x꜀ returned as a reference to an object of the same type and size as context’s continuous state.

See also

CalcTimeDerivatives(), CalcImplicitTimeDerivativesResidual(), get_time_derivatives_cache_entry()

EvalVectorInput(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.Context_[float], arg1: int) → pydrake.systems.framework.BasicVector_[float]

Returns the value of the vector-valued input port with the given port_index as a BasicVector or a specific subclass Vec derived from BasicVector. Causes the value to become up to date first if necessary. See EvalAbstractInput() for more information.

The result is returned as a pointer to the input port’s value of type Vec<T> or nullptr if the port is not connected.

Precondition:
port_index selects an existing input port of this System.
Precondition:
the port must have been declared to be vector-valued.
Precondition:
the port’s value must be of type Vec<T>.
Template parameter Vec:
The template type of the input vector, which must be a subclass of BasicVector.
FixInputPortsFrom(self: pydrake.systems.framework.System_[float], other_system: pydrake.systems.framework.System_[float], other_context: pydrake.systems.framework.Context_[float], target_context: pydrake.systems.framework.Context_[float]) → None

Fixes all of the input ports in target_context to their current values in other_context, as evaluated by other_system.

Raises:
  • RuntimeError unless other_context and target_context both
  • have the same shape as this System, and the other_system.
  • Ignores disconnected inputs.
get_input_port(*args, **kwargs)

Overloaded function.

  1. get_input_port(self: pydrake.systems.framework.System_[float], port_index: int) -> pydrake.systems.framework.InputPort_[float]

Returns the typed input port at index port_index.

  1. get_input_port(self: pydrake.systems.framework.System_[float]) -> pydrake.systems.framework.InputPort_[float]

Convenience method for the case of exactly one input port.

get_output_port(*args, **kwargs)

Overloaded function.

  1. get_output_port(self: pydrake.systems.framework.System_[float], port_index: int) -> pydrake.systems.framework.OutputPort_[float]

Returns the typed output port at index port_index.

  1. get_output_port(self: pydrake.systems.framework.System_[float]) -> pydrake.systems.framework.OutputPort_[float]

Convenience method for the case of exactly one output port.

GetGraphvizString(self: pydrake.systems.framework.System_[float], max_depth: int = 2147483647) → object

Returns a Graphviz string describing this System. To render the string, use the Graphviz tool, dot. http://www.graphviz.org/

Parameter max_depth:
Sets a limit to the depth of nested diagrams to visualize. Set to zero to render a diagram as a single system block.

See also

GenerateHtml

GetInputPort(self: pydrake.systems.framework.System_[float], port_name: str) → pydrake.systems.framework.InputPort_[float]

Returns the typed input port with the unique name port_name. The current implementation performs a linear search over strings; prefer get_input_port() when performance is a concern.

Raises:RuntimeError if port_name is not found.
GetMutableSubsystemContext(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.System_[float], arg1: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.Context_[float]

Returns a mutable reference to the subcontext that corresponds to the contained System subsystem.

Raises:RuntimeError if subsystem not contained in this System.
Precondition:
The given context is valid for use with this System.
GetMyContextFromRoot(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.Context_[float]

Returns the mutable subsystem context for this system, given a root context.

See also

GetMyContextFromRoot()

GetMyMutableContextFromRoot(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.Context_[float]

Returns the mutable subsystem context for this system, given a root context.

See also

GetMyContextFromRoot()

GetOutputPort(self: pydrake.systems.framework.System_[float], port_name: str) → pydrake.systems.framework.OutputPort_[float]

Returns the typed output port with the unique name port_name. The current implementation performs a linear search over strings; prefer get_output_port() when performance is a concern.

Raises:RuntimeError if port_name is not found.
GetSubsystemContext(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.System_[float], arg1: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.Context_[float]

Returns a mutable reference to the subcontext that corresponds to the contained System subsystem.

Raises:RuntimeError if subsystem not contained in this System.
Precondition:
The given context is valid for use with this System.
GetUniquePeriodicDiscreteUpdateAttribute(self: pydrake.systems.framework.System_[float]) → Optional[pydrake.systems.framework.PeriodicEventData]

Gets whether there exists a unique periodic attribute that triggers one or more discrete update events (and, if so, returns that unique periodic attribute). Thus, this method can be used (1) as a test to determine whether a system’s dynamics are at least partially governed by difference equations and (2) to obtain the difference equation update times.

Returns:optional<PeriodicEventData> Contains the periodic trigger attributes if the unique periodic attribute exists, otherwise nullopt.
GetWitnessFunctions(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float]) → List[pydrake.systems.framework.WitnessFunction_[float]]

Derived classes can override this method to provide witness functions active for the given state. The default implementation does nothing. On entry to this function, the context will have already been validated and the vector of witness functions will have been validated to be both empty and non-null. Note: The above is for the C++ documentation. For Python, use witnesses = GetWitnessFunctions(context)

HasAnyDirectFeedthrough(self: pydrake.systems.framework.System_[float]) → bool

Returns True if any of the inputs to the system might be directly fed through to any of its outputs and False otherwise.

HasDirectFeedthrough(*args, **kwargs)

Overloaded function.

  1. HasDirectFeedthrough(self: pydrake.systems.framework.System_[float], output_port: int) -> bool

Returns true if there might be direct-feedthrough from any input port to the given output_port, and false otherwise.

  1. HasDirectFeedthrough(self: pydrake.systems.framework.System_[float], input_port: int, output_port: int) -> bool

Returns true if there might be direct-feedthrough from the given input_port to the given output_port, and false otherwise.

IsDifferenceEquationSystem(self: pydrake.systems.framework.System_[float]) → Tuple[bool, float]

Returns true iff the state dynamics of this system are governed exclusively by a difference equation on a single discrete state group and with a unique periodic update (having zero offset). E.g., it is amenable to analysis of the form: x[n+1] = f(x[n], u[n]) Note that we do NOT consider the number of input ports here, because in practice many systems of interest (e.g. MultibodyPlant) have input ports that are safely treated as constant during the analysis. Consider using get_input_port_selection() to choose one.

Parameter time_period:
if non-null, then iff the function returns True, then time_period is set to the period data returned from GetUniquePeriodicDiscreteUpdateAttribute(). If the function returns False (the system is not a difference equation system), then time_period does not receive a value.

Note: The above is for the C++ documentation. For Python, use is_diff_eq, period = IsDifferenceEquationSystem()

Publish(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.Context_[float]) → None

Forces a publish on the system, given a context. The publish event will have a trigger type of kForced, with no additional data, attribute or custom callback. The Simulator can be configured to call this in Simulator::Initialize() and at the start of each continuous integration step. See the Simulator API for more details.

SetDefaultContext(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.Context_[float]) → None

Sets Context fields to their default values. User code should not override.

SetRandomContext(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float], generator: pydrake.common._module_py.RandomGenerator) → None

Sets Context fields to random values. User code should not override.

ToAutoDiffXd(self: pydrake.systems.framework.System_[float]) → drake::systems::System<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Creates a deep copy of this System, transmogrified to use the autodiff scalar type, with a dynamic-sized vector of partial derivatives. The result is never nullptr.

Raises:RuntimeError if this System does not support autodiff

See system_scalar_conversion for detailed background and examples related to scalar-type conversion support.

ToAutoDiffXdMaybe(self: pydrake.systems.framework.System_[float]) → drake::systems::System<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Creates a deep copy of this system exactly like ToAutoDiffXd(), but returns nullptr if this System does not support autodiff, instead of throwing an exception.

ToSymbolic(self: pydrake.systems.framework.System_[float]) → drake::systems::System<drake::symbolic::Expression>

Creates a deep copy of this System, transmogrified to use the symbolic scalar type. The result is never nullptr.

Raises:RuntimeError if this System does not support symbolic

See system_scalar_conversion for detailed background and examples related to scalar-type conversion support.

ToSymbolicMaybe(self: pydrake.systems.framework.System_[float]) → drake::systems::System<drake::symbolic::Expression>

Creates a deep copy of this system exactly like ToSymbolic(), but returns nullptr if this System does not support symbolic, instead of throwing an exception.

class pydrake.systems.framework.System_[AutoDiffXd]

Bases: pydrake.systems.framework.SystemBase

Base class for all System functionality that is dependent on the templatized scalar type T for input, state, parameters, and outputs.

__init__

Initialize self. See help(type(self)) for accurate signature.

AllocateContext(self: pydrake.systems.framework.System_[AutoDiffXd]) → pydrake.systems.framework.Context_[AutoDiffXd]

Returns a Context<T> suitable for use with this System<T>.

AllocateDiscreteVariables(self: pydrake.systems.framework.System_[AutoDiffXd]) → pydrake.systems.framework.DiscreteValues_[AutoDiffXd]

Returns a DiscreteValues of the same dimensions as the discrete_state allocated in CreateDefaultContext. The simulator will provide this state as the output argument to Update.

AllocateOutput(self: pydrake.systems.framework.System_[AutoDiffXd]) → pydrake.systems.framework.SystemOutput_[AutoDiffXd]

Returns a container that can hold the values of all of this System’s output ports. It is sized with the number of output ports and uses each output port’s allocation method to provide an object of the right type for that port.

AllocateTimeDerivatives(self: pydrake.systems.framework.System_[AutoDiffXd]) → pydrake.systems.framework.ContinuousState_[AutoDiffXd]

Returns a ContinuousState of the same size as the continuous_state allocated in CreateDefaultContext. The simulator will provide this state as the output argument to EvalTimeDerivatives.

CalcConservativePower(self: pydrake.systems.framework.System_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.autodiffutils.AutoDiffXd

Calculates and returns the conservative power represented by the current contents of the given context. Prefer EvalConservativePower() to avoid unnecessary recalculation.

See also

EvalConservativePower() for more information.

CalcDiscreteVariableUpdates(self: pydrake.systems.framework.System_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], discrete_state: pydrake.systems.framework.DiscreteValues_[AutoDiffXd]) → None

This method forces a discrete update on the system given a context, and the updated discrete state is stored in discrete_state. The discrete update event will have a trigger type of kForced, with no attribute or custom callback.

CalcKineticEnergy(self: pydrake.systems.framework.System_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.autodiffutils.AutoDiffXd

Calculates and returns the kinetic energy represented by the current configuration and velocity provided in context. Prefer EvalKineticEnergy() to avoid unnecessary recalculation.

See also

EvalKineticEnergy() for more information.

CalcNonConservativePower(self: pydrake.systems.framework.System_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.autodiffutils.AutoDiffXd

Calculates and returns the non-conservative power represented by the current contents of the given context. Prefer EvalNonConservativePower() to avoid unnecessary recalculation.

See also

EvalNonConservativePower() for more information.

CalcOutput(self: pydrake.systems.framework.System_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], outputs: pydrake.systems.framework.SystemOutput_[AutoDiffXd]) → None

Utility method that computes for every output port i the value y(i) that should result from the current contents of the given Context. Note that individual output port values can be calculated using get_output_port(i).Calc(); this method invokes that for each output port in index order. The result may depend on time and the current values of input ports, parameters, and state variables. The result is written to outputs which must already have been allocated to have the right number of entries of the right types.

CalcPotentialEnergy(self: pydrake.systems.framework.System_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.autodiffutils.AutoDiffXd

Calculates and returns the potential energy represented by the current configuration provided in context. Prefer EvalPotentialEnergy() to avoid unnecessary recalculation.

See also

EvalPotentialEnergy() for more information.

CalcTimeDerivatives(self: pydrake.systems.framework.System_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], derivatives: pydrake.systems.framework.ContinuousState_[AutoDiffXd]) → None

Calculates the time derivatives ẋ꜀ of the continuous state x꜀ into a given output argument. Prefer EvalTimeDerivatives() instead to avoid unnecessary recomputation.

This method solves the System equations in explicit form:

ẋ꜀ = fₑ(𝓒)

where 𝓒 = {a, p, t, x, u} is the current value of the given Context from which accuracy a, parameters p, time t, state x (={x꜀ xd xₐ}) and input values u are obtained.

Parameter context:
The source for time, state, inputs, etc. defining the point at which the derivatives should be calculated.
Parameter derivatives:
The time derivatives ẋ꜀. Must be the same size as the continuous state vector in context.

See also

EvalTimeDerivatives() for more information.

See also

CalcImplicitTimeDerivativesResidual() for the implicit form of these equations.

CreateDefaultContext(self: pydrake.systems.framework.System_[AutoDiffXd]) → pydrake.systems.framework.Context_[AutoDiffXd]

This convenience method allocates a context using AllocateContext() and sets its default values using SetDefaultContext().

DeclareInputPort(*args, **kwargs)

Overloaded function.

  1. DeclareInputPort(self: pydrake.systems.framework.System_[AutoDiffXd], name: Union[str, pydrake.systems.framework.UseDefaultName], type: pydrake.systems.framework.PortDataType, size: int, random_type: Optional[pydrake.common._module_py.RandomDistribution] = None) -> pydrake.systems.framework.InputPort_[AutoDiffXd]

Adds a port with the specified type and size to the input topology.

Input port names must be unique for this system (passing in a duplicate name will throw RuntimeError). If name is given as kUseDefaultName, then a default value of e.g. “u2”, where 2 is the input number will be provided. An empty name is not permitted.

If the port is intended to model a random noise or disturbance input, random_type can (optionally) be used to label it as such; doing so enables algorithms for design and analysis (e.g. state estimation) to reason explicitly about randomness at the system level. All random input ports are assumed to be statistically independent.

Precondition:
name must not be empty.
Raises:RuntimeError for a duplicate port name.
Returns:the declared port.
  1. DeclareInputPort(self: pydrake.systems.framework.System_[AutoDiffXd], type: pydrake.systems.framework.PortDataType, size: int, random_type: Optional[pydrake.common._module_py.RandomDistribution] = None) -> pydrake.systems.framework.InputPort_[AutoDiffXd]
EvalAbstractInput(self: pydrake.systems.framework.System_[AutoDiffXd], arg0: pydrake.systems.framework.Context_[AutoDiffXd], arg1: int) → pydrake.common.value.AbstractValue

Returns the value of the input port with the given port_index as an AbstractValue, which is permitted for ports of any type. Causes the value to become up to date first if necessary, delegating to our parent Diagram. Returns a pointer to the port’s value, or nullptr if the port is not connected. If you know the actual type, use one of the more-specific signatures.

Precondition:
port_index selects an existing input port of this System.

See also

EvalInputValue(), System::EvalVectorInput(), System::EvalEigenVectorInput()

EvalKineticEnergy(self: pydrake.systems.framework.System_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.autodiffutils.AutoDiffXd

Returns a reference to the cached value of the kinetic energy (KE), evaluating first if necessary using CalcKineticEnergy().

By definition here, kinetic energy depends only on “configuration” and “velocity” (e.g. angular and translational velocity) of moving masses which includes a subset of the state variables, and parameters that affect configuration, velocities, or mass properties. The calculated value may also be affected by the accuracy value supplied in the Context. KE cannot depend explicitly on time (∂KE/∂t = 0) or input port values (∂KE/∂u = 0).

Non-physical systems where KE is not meaningful will return KE = 0.

Parameter context:
The Context whose configuration and velocity variables may be used to evaluate kinetic energy.
Returns KE:
The kinetic energy in joules (J) represented by the configuration and velocity given in context.

See also

CalcKineticEnergy()

EvalPotentialEnergy(self: pydrake.systems.framework.System_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.autodiffutils.AutoDiffXd

Returns a reference to the cached value of the potential energy (PE), evaluating first if necessary using CalcPotentialEnergy().

By definition here, potential energy depends only on “configuration” (e.g. orientation and position), which includes a subset of the state variables, and parameters that affect configuration or conservative forces (such as lengths and masses). The calculated value may also be affected by the accuracy value supplied in the Context. PE cannot depend explicitly on time (∂PE/∂t = 0), velocities (∂PE/∂v = 0), or input port values (∂PE/∂u = 0).

Non-physical systems where PE is not meaningful will return PE = 0.

Parameter context:
The Context whose configuration variables may be used to evaluate potential energy.
Returns PE:
The potential energy in joules (J) represented by the configuration given in context.

See also

CalcPotentialEnergy()

EvalTimeDerivatives(self: pydrake.systems.framework.System_[AutoDiffXd], arg0: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.systems.framework.ContinuousState_[AutoDiffXd]

Returns a reference to the cached value of the continuous state variable time derivatives, evaluating first if necessary using CalcTimeDerivatives().

This method returns the time derivatives ẋ꜀ of the continuous state x꜀. The referenced return object will correspond elementwise with the continuous state in the given Context. Thus, if the state in the Context has second-order structure x꜀ = [q v z], that same structure applies to the derivatives so we will have ẋ꜀ = [q̇ ̇v̇ ż].

Parameter context:
The Context whose time, input port, parameter, state, and accuracy values may be used to evaluate the derivatives.
Returns xcdot:
Time derivatives ẋ꜀ of x꜀ returned as a reference to an object of the same type and size as context’s continuous state.

See also

CalcTimeDerivatives(), CalcImplicitTimeDerivativesResidual(), get_time_derivatives_cache_entry()

EvalVectorInput(self: pydrake.systems.framework.System_[AutoDiffXd], arg0: pydrake.systems.framework.Context_[AutoDiffXd], arg1: int) → pydrake.systems.framework.BasicVector_[AutoDiffXd]

Returns the value of the vector-valued input port with the given port_index as a BasicVector or a specific subclass Vec derived from BasicVector. Causes the value to become up to date first if necessary. See EvalAbstractInput() for more information.

The result is returned as a pointer to the input port’s value of type Vec<T> or nullptr if the port is not connected.

Precondition:
port_index selects an existing input port of this System.
Precondition:
the port must have been declared to be vector-valued.
Precondition:
the port’s value must be of type Vec<T>.
Template parameter Vec:
The template type of the input vector, which must be a subclass of BasicVector.
FixInputPortsFrom(self: pydrake.systems.framework.System_[AutoDiffXd], other_system: pydrake.systems.framework.System_[float], other_context: pydrake.systems.framework.Context_[float], target_context: pydrake.systems.framework.Context_[AutoDiffXd]) → None

Fixes all of the input ports in target_context to their current values in other_context, as evaluated by other_system.

Raises:
  • RuntimeError unless other_context and target_context both
  • have the same shape as this System, and the other_system.
  • Ignores disconnected inputs.
get_input_port(*args, **kwargs)

Overloaded function.

  1. get_input_port(self: pydrake.systems.framework.System_[AutoDiffXd], port_index: int) -> pydrake.systems.framework.InputPort_[AutoDiffXd]

Returns the typed input port at index port_index.

  1. get_input_port(self: pydrake.systems.framework.System_[AutoDiffXd]) -> pydrake.systems.framework.InputPort_[AutoDiffXd]

Convenience method for the case of exactly one input port.

get_output_port(*args, **kwargs)

Overloaded function.

  1. get_output_port(self: pydrake.systems.framework.System_[AutoDiffXd], port_index: int) -> pydrake.systems.framework.OutputPort_[AutoDiffXd]

Returns the typed output port at index port_index.

  1. get_output_port(self: pydrake.systems.framework.System_[AutoDiffXd]) -> pydrake.systems.framework.OutputPort_[AutoDiffXd]

Convenience method for the case of exactly one output port.

GetGraphvizString(self: pydrake.systems.framework.System_[AutoDiffXd], max_depth: int = 2147483647) → object

Returns a Graphviz string describing this System. To render the string, use the Graphviz tool, dot. http://www.graphviz.org/

Parameter max_depth:
Sets a limit to the depth of nested diagrams to visualize. Set to zero to render a diagram as a single system block.

See also

GenerateHtml

GetInputPort(self: pydrake.systems.framework.System_[AutoDiffXd], port_name: str) → pydrake.systems.framework.InputPort_[AutoDiffXd]

Returns the typed input port with the unique name port_name. The current implementation performs a linear search over strings; prefer get_input_port() when performance is a concern.

Raises:RuntimeError if port_name is not found.
GetMutableSubsystemContext(self: pydrake.systems.framework.System_[AutoDiffXd], arg0: pydrake.systems.framework.System_[AutoDiffXd], arg1: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.systems.framework.Context_[AutoDiffXd]

Returns a mutable reference to the subcontext that corresponds to the contained System subsystem.

Raises:RuntimeError if subsystem not contained in this System.
Precondition:
The given context is valid for use with this System.
GetMyContextFromRoot(self: pydrake.systems.framework.System_[AutoDiffXd], arg0: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.systems.framework.Context_[AutoDiffXd]

Returns the mutable subsystem context for this system, given a root context.

See also

GetMyContextFromRoot()

GetMyMutableContextFromRoot(self: pydrake.systems.framework.System_[AutoDiffXd], arg0: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.systems.framework.Context_[AutoDiffXd]

Returns the mutable subsystem context for this system, given a root context.

See also

GetMyContextFromRoot()

GetOutputPort(self: pydrake.systems.framework.System_[AutoDiffXd], port_name: str) → pydrake.systems.framework.OutputPort_[AutoDiffXd]

Returns the typed output port with the unique name port_name. The current implementation performs a linear search over strings; prefer get_output_port() when performance is a concern.

Raises:RuntimeError if port_name is not found.
GetSubsystemContext(self: pydrake.systems.framework.System_[AutoDiffXd], arg0: pydrake.systems.framework.System_[AutoDiffXd], arg1: pydrake.systems.framework.Context_[AutoDiffXd]) → pydrake.systems.framework.Context_[AutoDiffXd]

Returns a mutable reference to the subcontext that corresponds to the contained System subsystem.

Raises:RuntimeError if subsystem not contained in this System.
Precondition:
The given context is valid for use with this System.
GetUniquePeriodicDiscreteUpdateAttribute(self: pydrake.systems.framework.System_[AutoDiffXd]) → Optional[pydrake.systems.framework.PeriodicEventData]

Gets whether there exists a unique periodic attribute that triggers one or more discrete update events (and, if so, returns that unique periodic attribute). Thus, this method can be used (1) as a test to determine whether a system’s dynamics are at least partially governed by difference equations and (2) to obtain the difference equation update times.

Returns:optional<PeriodicEventData> Contains the periodic trigger attributes if the unique periodic attribute exists, otherwise nullopt.
GetWitnessFunctions(self: pydrake.systems.framework.System_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd]) → List[pydrake.systems.framework.WitnessFunction_[AutoDiffXd]]

Derived classes can override this method to provide witness functions active for the given state. The default implementation does nothing. On entry to this function, the context will have already been validated and the vector of witness functions will have been validated to be both empty and non-null. Note: The above is for the C++ documentation. For Python, use witnesses = GetWitnessFunctions(context)

HasAnyDirectFeedthrough(self: pydrake.systems.framework.System_[AutoDiffXd]) → bool

Returns True if any of the inputs to the system might be directly fed through to any of its outputs and False otherwise.

HasDirectFeedthrough(*args, **kwargs)

Overloaded function.

  1. HasDirectFeedthrough(self: pydrake.systems.framework.System_[AutoDiffXd], output_port: int) -> bool

Returns true if there might be direct-feedthrough from any input port to the given output_port, and false otherwise.

  1. HasDirectFeedthrough(self: pydrake.systems.framework.System_[AutoDiffXd], input_port: int, output_port: int) -> bool

Returns true if there might be direct-feedthrough from the given input_port to the given output_port, and false otherwise.

IsDifferenceEquationSystem(self: pydrake.systems.framework.System_[AutoDiffXd]) → Tuple[bool, float]

Returns true iff the state dynamics of this system are governed exclusively by a difference equation on a single discrete state group and with a unique periodic update (having zero offset). E.g., it is amenable to analysis of the form: x[n+1] = f(x[n], u[n]) Note that we do NOT consider the number of input ports here, because in practice many systems of interest (e.g. MultibodyPlant) have input ports that are safely treated as constant during the analysis. Consider using get_input_port_selection() to choose one.

Parameter time_period:
if non-null, then iff the function returns True, then time_period is set to the period data returned from GetUniquePeriodicDiscreteUpdateAttribute(). If the function returns False (the system is not a difference equation system), then time_period does not receive a value.

Note: The above is for the C++ documentation. For Python, use is_diff_eq, period = IsDifferenceEquationSystem()

Publish(self: pydrake.systems.framework.System_[AutoDiffXd], arg0: pydrake.systems.framework.Context_[AutoDiffXd]) → None

Forces a publish on the system, given a context. The publish event will have a trigger type of kForced, with no additional data, attribute or custom callback. The Simulator can be configured to call this in Simulator::Initialize() and at the start of each continuous integration step. See the Simulator API for more details.

SetDefaultContext(self: pydrake.systems.framework.System_[AutoDiffXd], arg0: pydrake.systems.framework.Context_[AutoDiffXd]) → None

Sets Context fields to their default values. User code should not override.

SetRandomContext(self: pydrake.systems.framework.System_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], generator: pydrake.common._module_py.RandomGenerator) → None

Sets Context fields to random values. User code should not override.

ToAutoDiffXd(self: pydrake.systems.framework.System_[AutoDiffXd]) → pydrake.systems.framework.System_[AutoDiffXd]

Creates a deep copy of this System, transmogrified to use the autodiff scalar type, with a dynamic-sized vector of partial derivatives. The result is never nullptr.

Raises:RuntimeError if this System does not support autodiff

See system_scalar_conversion for detailed background and examples related to scalar-type conversion support.

ToAutoDiffXdMaybe(self: pydrake.systems.framework.System_[AutoDiffXd]) → pydrake.systems.framework.System_[AutoDiffXd]

Creates a deep copy of this system exactly like ToAutoDiffXd(), but returns nullptr if this System does not support autodiff, instead of throwing an exception.

ToSymbolic(self: pydrake.systems.framework.System_[AutoDiffXd]) → drake::systems::System<drake::symbolic::Expression>

Creates a deep copy of this System, transmogrified to use the symbolic scalar type. The result is never nullptr.

Raises:RuntimeError if this System does not support symbolic

See system_scalar_conversion for detailed background and examples related to scalar-type conversion support.

ToSymbolicMaybe(self: pydrake.systems.framework.System_[AutoDiffXd]) → drake::systems::System<drake::symbolic::Expression>

Creates a deep copy of this system exactly like ToSymbolic(), but returns nullptr if this System does not support symbolic, instead of throwing an exception.

class pydrake.systems.framework.System_[Expression]

Bases: pydrake.systems.framework.SystemBase

Base class for all System functionality that is dependent on the templatized scalar type T for input, state, parameters, and outputs.

__init__

Initialize self. See help(type(self)) for accurate signature.

AllocateContext(self: pydrake.systems.framework.System_[Expression]) → pydrake.systems.framework.Context_[Expression]

Returns a Context<T> suitable for use with this System<T>.

AllocateDiscreteVariables(self: pydrake.systems.framework.System_[Expression]) → pydrake.systems.framework.DiscreteValues_[Expression]

Returns a DiscreteValues of the same dimensions as the discrete_state allocated in CreateDefaultContext. The simulator will provide this state as the output argument to Update.

AllocateOutput(self: pydrake.systems.framework.System_[Expression]) → pydrake.systems.framework.SystemOutput_[Expression]

Returns a container that can hold the values of all of this System’s output ports. It is sized with the number of output ports and uses each output port’s allocation method to provide an object of the right type for that port.

AllocateTimeDerivatives(self: pydrake.systems.framework.System_[Expression]) → pydrake.systems.framework.ContinuousState_[Expression]

Returns a ContinuousState of the same size as the continuous_state allocated in CreateDefaultContext. The simulator will provide this state as the output argument to EvalTimeDerivatives.

CalcConservativePower(self: pydrake.systems.framework.System_[Expression], context: pydrake.systems.framework.Context_[Expression]) → pydrake.symbolic.Expression

Calculates and returns the conservative power represented by the current contents of the given context. Prefer EvalConservativePower() to avoid unnecessary recalculation.

See also

EvalConservativePower() for more information.

CalcDiscreteVariableUpdates(self: pydrake.systems.framework.System_[Expression], context: pydrake.systems.framework.Context_[Expression], discrete_state: pydrake.systems.framework.DiscreteValues_[Expression]) → None

This method forces a discrete update on the system given a context, and the updated discrete state is stored in discrete_state. The discrete update event will have a trigger type of kForced, with no attribute or custom callback.

CalcKineticEnergy(self: pydrake.systems.framework.System_[Expression], context: pydrake.systems.framework.Context_[Expression]) → pydrake.symbolic.Expression

Calculates and returns the kinetic energy represented by the current configuration and velocity provided in context. Prefer EvalKineticEnergy() to avoid unnecessary recalculation.

See also

EvalKineticEnergy() for more information.

CalcNonConservativePower(self: pydrake.systems.framework.System_[Expression], context: pydrake.systems.framework.Context_[Expression]) → pydrake.symbolic.Expression

Calculates and returns the non-conservative power represented by the current contents of the given context. Prefer EvalNonConservativePower() to avoid unnecessary recalculation.

See also

EvalNonConservativePower() for more information.

CalcOutput(self: pydrake.systems.framework.System_[Expression], context: pydrake.systems.framework.Context_[Expression], outputs: pydrake.systems.framework.SystemOutput_[Expression]) → None

Utility method that computes for every output port i the value y(i) that should result from the current contents of the given Context. Note that individual output port values can be calculated using get_output_port(i).Calc(); this method invokes that for each output port in index order. The result may depend on time and the current values of input ports, parameters, and state variables. The result is written to outputs which must already have been allocated to have the right number of entries of the right types.

CalcPotentialEnergy(self: pydrake.systems.framework.System_[Expression], context: pydrake.systems.framework.Context_[Expression]) → pydrake.symbolic.Expression

Calculates and returns the potential energy represented by the current configuration provided in context. Prefer EvalPotentialEnergy() to avoid unnecessary recalculation.

See also

EvalPotentialEnergy() for more information.

CalcTimeDerivatives(self: pydrake.systems.framework.System_[Expression], context: pydrake.systems.framework.Context_[Expression], derivatives: pydrake.systems.framework.ContinuousState_[Expression]) → None

Calculates the time derivatives ẋ꜀ of the continuous state x꜀ into a given output argument. Prefer EvalTimeDerivatives() instead to avoid unnecessary recomputation.

This method solves the System equations in explicit form:

ẋ꜀ = fₑ(𝓒)

where 𝓒 = {a, p, t, x, u} is the current value of the given Context from which accuracy a, parameters p, time t, state x (={x꜀ xd xₐ}) and input values u are obtained.

Parameter context:
The source for time, state, inputs, etc. defining the point at which the derivatives should be calculated.
Parameter derivatives:
The time derivatives ẋ꜀. Must be the same size as the continuous state vector in context.

See also

EvalTimeDerivatives() for more information.

See also

CalcImplicitTimeDerivativesResidual() for the implicit form of these equations.

CreateDefaultContext(self: pydrake.systems.framework.System_[Expression]) → pydrake.systems.framework.Context_[Expression]

This convenience method allocates a context using AllocateContext() and sets its default values using SetDefaultContext().

DeclareInputPort(*args, **kwargs)

Overloaded function.

  1. DeclareInputPort(self: pydrake.systems.framework.System_[Expression], name: Union[str, pydrake.systems.framework.UseDefaultName], type: pydrake.systems.framework.PortDataType, size: int, random_type: Optional[pydrake.common._module_py.RandomDistribution] = None) -> pydrake.systems.framework.InputPort_[Expression]

Adds a port with the specified type and size to the input topology.

Input port names must be unique for this system (passing in a duplicate name will throw RuntimeError). If name is given as kUseDefaultName, then a default value of e.g. “u2”, where 2 is the input number will be provided. An empty name is not permitted.

If the port is intended to model a random noise or disturbance input, random_type can (optionally) be used to label it as such; doing so enables algorithms for design and analysis (e.g. state estimation) to reason explicitly about randomness at the system level. All random input ports are assumed to be statistically independent.

Precondition:
name must not be empty.
Raises:RuntimeError for a duplicate port name.
Returns:the declared port.
  1. DeclareInputPort(self: pydrake.systems.framework.System_[Expression], type: pydrake.systems.framework.PortDataType, size: int, random_type: Optional[pydrake.common._module_py.RandomDistribution] = None) -> pydrake.systems.framework.InputPort_[Expression]
EvalAbstractInput(self: pydrake.systems.framework.System_[Expression], arg0: pydrake.systems.framework.Context_[Expression], arg1: int) → pydrake.common.value.AbstractValue

Returns the value of the input port with the given port_index as an AbstractValue, which is permitted for ports of any type. Causes the value to become up to date first if necessary, delegating to our parent Diagram. Returns a pointer to the port’s value, or nullptr if the port is not connected. If you know the actual type, use one of the more-specific signatures.

Precondition:
port_index selects an existing input port of this System.

See also

EvalInputValue(), System::EvalVectorInput(), System::EvalEigenVectorInput()

EvalKineticEnergy(self: pydrake.systems.framework.System_[Expression], context: pydrake.systems.framework.Context_[Expression]) → pydrake.symbolic.Expression

Returns a reference to the cached value of the kinetic energy (KE), evaluating first if necessary using CalcKineticEnergy().

By definition here, kinetic energy depends only on “configuration” and “velocity” (e.g. angular and translational velocity) of moving masses which includes a subset of the state variables, and parameters that affect configuration, velocities, or mass properties. The calculated value may also be affected by the accuracy value supplied in the Context. KE cannot depend explicitly on time (∂KE/∂t = 0) or input port values (∂KE/∂u = 0).

Non-physical systems where KE is not meaningful will return KE = 0.

Parameter context:
The Context whose configuration and velocity variables may be used to evaluate kinetic energy.
Returns KE:
The kinetic energy in joules (J) represented by the configuration and velocity given in context.

See also

CalcKineticEnergy()

EvalPotentialEnergy(self: pydrake.systems.framework.System_[Expression], context: pydrake.systems.framework.Context_[Expression]) → pydrake.symbolic.Expression

Returns a reference to the cached value of the potential energy (PE), evaluating first if necessary using CalcPotentialEnergy().

By definition here, potential energy depends only on “configuration” (e.g. orientation and position), which includes a subset of the state variables, and parameters that affect configuration or conservative forces (such as lengths and masses). The calculated value may also be affected by the accuracy value supplied in the Context. PE cannot depend explicitly on time (∂PE/∂t = 0), velocities (∂PE/∂v = 0), or input port values (∂PE/∂u = 0).

Non-physical systems where PE is not meaningful will return PE = 0.

Parameter context:
The Context whose configuration variables may be used to evaluate potential energy.
Returns PE:
The potential energy in joules (J) represented by the configuration given in context.

See also

CalcPotentialEnergy()

EvalTimeDerivatives(self: pydrake.systems.framework.System_[Expression], arg0: pydrake.systems.framework.Context_[Expression]) → pydrake.systems.framework.ContinuousState_[Expression]

Returns a reference to the cached value of the continuous state variable time derivatives, evaluating first if necessary using CalcTimeDerivatives().

This method returns the time derivatives ẋ꜀ of the continuous state x꜀. The referenced return object will correspond elementwise with the continuous state in the given Context. Thus, if the state in the Context has second-order structure x꜀ = [q v z], that same structure applies to the derivatives so we will have ẋ꜀ = [q̇ ̇v̇ ż].

Parameter context:
The Context whose time, input port, parameter, state, and accuracy values may be used to evaluate the derivatives.
Returns xcdot:
Time derivatives ẋ꜀ of x꜀ returned as a reference to an object of the same type and size as context’s continuous state.

See also

CalcTimeDerivatives(), CalcImplicitTimeDerivativesResidual(), get_time_derivatives_cache_entry()

EvalVectorInput(self: pydrake.systems.framework.System_[Expression], arg0: pydrake.systems.framework.Context_[Expression], arg1: int) → pydrake.systems.framework.BasicVector_[Expression]

Returns the value of the vector-valued input port with the given port_index as a BasicVector or a specific subclass Vec derived from BasicVector. Causes the value to become up to date first if necessary. See EvalAbstractInput() for more information.

The result is returned as a pointer to the input port’s value of type Vec<T> or nullptr if the port is not connected.

Precondition:
port_index selects an existing input port of this System.
Precondition:
the port must have been declared to be vector-valued.
Precondition:
the port’s value must be of type Vec<T>.
Template parameter Vec:
The template type of the input vector, which must be a subclass of BasicVector.
FixInputPortsFrom(self: pydrake.systems.framework.System_[Expression], other_system: pydrake.systems.framework.System_[float], other_context: pydrake.systems.framework.Context_[float], target_context: pydrake.systems.framework.Context_[Expression]) → None

Fixes all of the input ports in target_context to their current values in other_context, as evaluated by other_system.

Raises:
  • RuntimeError unless other_context and target_context both
  • have the same shape as this System, and the other_system.
  • Ignores disconnected inputs.
get_input_port(*args, **kwargs)

Overloaded function.

  1. get_input_port(self: pydrake.systems.framework.System_[Expression], port_index: int) -> pydrake.systems.framework.InputPort_[Expression]

Returns the typed input port at index port_index.

  1. get_input_port(self: pydrake.systems.framework.System_[Expression]) -> pydrake.systems.framework.InputPort_[Expression]

Convenience method for the case of exactly one input port.

get_output_port(*args, **kwargs)

Overloaded function.

  1. get_output_port(self: pydrake.systems.framework.System_[Expression], port_index: int) -> pydrake.systems.framework.OutputPort_[Expression]

Returns the typed output port at index port_index.

  1. get_output_port(self: pydrake.systems.framework.System_[Expression]) -> pydrake.systems.framework.OutputPort_[Expression]

Convenience method for the case of exactly one output port.

GetGraphvizString(self: pydrake.systems.framework.System_[Expression], max_depth: int = 2147483647) → object

Returns a Graphviz string describing this System. To render the string, use the Graphviz tool, dot. http://www.graphviz.org/

Parameter max_depth:
Sets a limit to the depth of nested diagrams to visualize. Set to zero to render a diagram as a single system block.

See also

GenerateHtml

GetInputPort(self: pydrake.systems.framework.System_[Expression], port_name: str) → pydrake.systems.framework.InputPort_[Expression]

Returns the typed input port with the unique name port_name. The current implementation performs a linear search over strings; prefer get_input_port() when performance is a concern.

Raises:RuntimeError if port_name is not found.
GetMutableSubsystemContext(self: pydrake.systems.framework.System_[Expression], arg0: pydrake.systems.framework.System_[Expression], arg1: pydrake.systems.framework.Context_[Expression]) → pydrake.systems.framework.Context_[Expression]

Returns a mutable reference to the subcontext that corresponds to the contained System subsystem.

Raises:RuntimeError if subsystem not contained in this System.
Precondition:
The given context is valid for use with this System.
GetMyContextFromRoot(self: pydrake.systems.framework.System_[Expression], arg0: pydrake.systems.framework.Context_[Expression]) → pydrake.systems.framework.Context_[Expression]

Returns the mutable subsystem context for this system, given a root context.

See also

GetMyContextFromRoot()

GetMyMutableContextFromRoot(self: pydrake.systems.framework.System_[Expression], arg0: pydrake.systems.framework.Context_[Expression]) → pydrake.systems.framework.Context_[Expression]

Returns the mutable subsystem context for this system, given a root context.

See also

GetMyContextFromRoot()

GetOutputPort(self: pydrake.systems.framework.System_[Expression], port_name: str) → pydrake.systems.framework.OutputPort_[Expression]

Returns the typed output port with the unique name port_name. The current implementation performs a linear search over strings; prefer get_output_port() when performance is a concern.

Raises:RuntimeError if port_name is not found.
GetSubsystemContext(self: pydrake.systems.framework.System_[Expression], arg0: pydrake.systems.framework.System_[Expression], arg1: pydrake.systems.framework.Context_[Expression]) → pydrake.systems.framework.Context_[Expression]

Returns a mutable reference to the subcontext that corresponds to the contained System subsystem.

Raises:RuntimeError if subsystem not contained in this System.
Precondition:
The given context is valid for use with this System.
GetUniquePeriodicDiscreteUpdateAttribute(self: pydrake.systems.framework.System_[Expression]) → Optional[pydrake.systems.framework.PeriodicEventData]

Gets whether there exists a unique periodic attribute that triggers one or more discrete update events (and, if so, returns that unique periodic attribute). Thus, this method can be used (1) as a test to determine whether a system’s dynamics are at least partially governed by difference equations and (2) to obtain the difference equation update times.

Returns:optional<PeriodicEventData> Contains the periodic trigger attributes if the unique periodic attribute exists, otherwise nullopt.
GetWitnessFunctions(self: pydrake.systems.framework.System_[Expression], context: pydrake.systems.framework.Context_[Expression]) → List[pydrake.systems.framework.WitnessFunction_[Expression]]

Derived classes can override this method to provide witness functions active for the given state. The default implementation does nothing. On entry to this function, the context will have already been validated and the vector of witness functions will have been validated to be both empty and non-null. Note: The above is for the C++ documentation. For Python, use witnesses = GetWitnessFunctions(context)

HasAnyDirectFeedthrough(self: pydrake.systems.framework.System_[Expression]) → bool

Returns True if any of the inputs to the system might be directly fed through to any of its outputs and False otherwise.

HasDirectFeedthrough(*args, **kwargs)

Overloaded function.

  1. HasDirectFeedthrough(self: pydrake.systems.framework.System_[Expression], output_port: int) -> bool

Returns true if there might be direct-feedthrough from any input port to the given output_port, and false otherwise.

  1. HasDirectFeedthrough(self: pydrake.systems.framework.System_[Expression], input_port: int, output_port: int) -> bool

Returns true if there might be direct-feedthrough from the given input_port to the given output_port, and false otherwise.

IsDifferenceEquationSystem(self: pydrake.systems.framework.System_[Expression]) → Tuple[bool, float]

Returns true iff the state dynamics of this system are governed exclusively by a difference equation on a single discrete state group and with a unique periodic update (having zero offset). E.g., it is amenable to analysis of the form: x[n+1] = f(x[n], u[n]) Note that we do NOT consider the number of input ports here, because in practice many systems of interest (e.g. MultibodyPlant) have input ports that are safely treated as constant during the analysis. Consider using get_input_port_selection() to choose one.

Parameter time_period:
if non-null, then iff the function returns True, then time_period is set to the period data returned from GetUniquePeriodicDiscreteUpdateAttribute(). If the function returns False (the system is not a difference equation system), then time_period does not receive a value.

Note: The above is for the C++ documentation. For Python, use is_diff_eq, period = IsDifferenceEquationSystem()

Publish(self: pydrake.systems.framework.System_[Expression], arg0: pydrake.systems.framework.Context_[Expression]) → None

Forces a publish on the system, given a context. The publish event will have a trigger type of kForced, with no additional data, attribute or custom callback. The Simulator can be configured to call this in Simulator::Initialize() and at the start of each continuous integration step. See the Simulator API for more details.

SetDefaultContext(self: pydrake.systems.framework.System_[Expression], arg0: pydrake.systems.framework.Context_[Expression]) → None

Sets Context fields to their default values. User code should not override.

SetRandomContext(self: pydrake.systems.framework.System_[Expression], context: pydrake.systems.framework.Context_[Expression], generator: pydrake.common._module_py.RandomGenerator) → None

Sets Context fields to random values. User code should not override.

ToAutoDiffXd(self: pydrake.systems.framework.System_[Expression]) → pydrake.systems.framework.System_[AutoDiffXd]

Creates a deep copy of this System, transmogrified to use the autodiff scalar type, with a dynamic-sized vector of partial derivatives. The result is never nullptr.

Raises:RuntimeError if this System does not support autodiff

See system_scalar_conversion for detailed background and examples related to scalar-type conversion support.

ToAutoDiffXdMaybe(self: pydrake.systems.framework.System_[Expression]) → pydrake.systems.framework.System_[AutoDiffXd]

Creates a deep copy of this system exactly like ToAutoDiffXd(), but returns nullptr if this System does not support autodiff, instead of throwing an exception.

ToSymbolic(self: pydrake.systems.framework.System_[Expression]) → pydrake.systems.framework.System_[Expression]

Creates a deep copy of this System, transmogrified to use the symbolic scalar type. The result is never nullptr.

Raises:RuntimeError if this System does not support symbolic

See system_scalar_conversion for detailed background and examples related to scalar-type conversion support.

ToSymbolicMaybe(self: pydrake.systems.framework.System_[Expression]) → pydrake.systems.framework.System_[Expression]

Creates a deep copy of this system exactly like ToSymbolic(), but returns nullptr if this System does not support symbolic, instead of throwing an exception.

class pydrake.systems.framework.System_[float]

Bases: pydrake.systems.framework.SystemBase

Base class for all System functionality that is dependent on the templatized scalar type T for input, state, parameters, and outputs.

__init__

Initialize self. See help(type(self)) for accurate signature.

AllocateContext(self: pydrake.systems.framework.System_[float]) → pydrake.systems.framework.Context_[float]

Returns a Context<T> suitable for use with this System<T>.

AllocateDiscreteVariables(self: pydrake.systems.framework.System_[float]) → pydrake.systems.framework.DiscreteValues_[float]

Returns a DiscreteValues of the same dimensions as the discrete_state allocated in CreateDefaultContext. The simulator will provide this state as the output argument to Update.

AllocateOutput(self: pydrake.systems.framework.System_[float]) → pydrake.systems.framework.SystemOutput_[float]

Returns a container that can hold the values of all of this System’s output ports. It is sized with the number of output ports and uses each output port’s allocation method to provide an object of the right type for that port.

AllocateTimeDerivatives(self: pydrake.systems.framework.System_[float]) → pydrake.systems.framework.ContinuousState_[float]

Returns a ContinuousState of the same size as the continuous_state allocated in CreateDefaultContext. The simulator will provide this state as the output argument to EvalTimeDerivatives.

CalcConservativePower(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float]) → float

Calculates and returns the conservative power represented by the current contents of the given context. Prefer EvalConservativePower() to avoid unnecessary recalculation.

See also

EvalConservativePower() for more information.

CalcDiscreteVariableUpdates(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float], discrete_state: pydrake.systems.framework.DiscreteValues_[float]) → None

This method forces a discrete update on the system given a context, and the updated discrete state is stored in discrete_state. The discrete update event will have a trigger type of kForced, with no attribute or custom callback.

CalcKineticEnergy(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float]) → float

Calculates and returns the kinetic energy represented by the current configuration and velocity provided in context. Prefer EvalKineticEnergy() to avoid unnecessary recalculation.

See also

EvalKineticEnergy() for more information.

CalcNonConservativePower(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float]) → float

Calculates and returns the non-conservative power represented by the current contents of the given context. Prefer EvalNonConservativePower() to avoid unnecessary recalculation.

See also

EvalNonConservativePower() for more information.

CalcOutput(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float], outputs: pydrake.systems.framework.SystemOutput_[float]) → None

Utility method that computes for every output port i the value y(i) that should result from the current contents of the given Context. Note that individual output port values can be calculated using get_output_port(i).Calc(); this method invokes that for each output port in index order. The result may depend on time and the current values of input ports, parameters, and state variables. The result is written to outputs which must already have been allocated to have the right number of entries of the right types.

CalcPotentialEnergy(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float]) → float

Calculates and returns the potential energy represented by the current configuration provided in context. Prefer EvalPotentialEnergy() to avoid unnecessary recalculation.

See also

EvalPotentialEnergy() for more information.

CalcTimeDerivatives(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float], derivatives: pydrake.systems.framework.ContinuousState_[float]) → None

Calculates the time derivatives ẋ꜀ of the continuous state x꜀ into a given output argument. Prefer EvalTimeDerivatives() instead to avoid unnecessary recomputation.

This method solves the System equations in explicit form:

ẋ꜀ = fₑ(𝓒)

where 𝓒 = {a, p, t, x, u} is the current value of the given Context from which accuracy a, parameters p, time t, state x (={x꜀ xd xₐ}) and input values u are obtained.

Parameter context:
The source for time, state, inputs, etc. defining the point at which the derivatives should be calculated.
Parameter derivatives:
The time derivatives ẋ꜀. Must be the same size as the continuous state vector in context.

See also

EvalTimeDerivatives() for more information.

See also

CalcImplicitTimeDerivativesResidual() for the implicit form of these equations.

CreateDefaultContext(self: pydrake.systems.framework.System_[float]) → pydrake.systems.framework.Context_[float]

This convenience method allocates a context using AllocateContext() and sets its default values using SetDefaultContext().

DeclareInputPort(*args, **kwargs)

Overloaded function.

  1. DeclareInputPort(self: pydrake.systems.framework.System_[float], name: Union[str, pydrake.systems.framework.UseDefaultName], type: pydrake.systems.framework.PortDataType, size: int, random_type: Optional[pydrake.common._module_py.RandomDistribution] = None) -> pydrake.systems.framework.InputPort_[float]

Adds a port with the specified type and size to the input topology.

Input port names must be unique for this system (passing in a duplicate name will throw RuntimeError). If name is given as kUseDefaultName, then a default value of e.g. “u2”, where 2 is the input number will be provided. An empty name is not permitted.

If the port is intended to model a random noise or disturbance input, random_type can (optionally) be used to label it as such; doing so enables algorithms for design and analysis (e.g. state estimation) to reason explicitly about randomness at the system level. All random input ports are assumed to be statistically independent.

Precondition:
name must not be empty.
Raises:RuntimeError for a duplicate port name.
Returns:the declared port.
  1. DeclareInputPort(self: pydrake.systems.framework.System_[float], type: pydrake.systems.framework.PortDataType, size: int, random_type: Optional[pydrake.common._module_py.RandomDistribution] = None) -> pydrake.systems.framework.InputPort_[float]
EvalAbstractInput(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.Context_[float], arg1: int) → pydrake.common.value.AbstractValue

Returns the value of the input port with the given port_index as an AbstractValue, which is permitted for ports of any type. Causes the value to become up to date first if necessary, delegating to our parent Diagram. Returns a pointer to the port’s value, or nullptr if the port is not connected. If you know the actual type, use one of the more-specific signatures.

Precondition:
port_index selects an existing input port of this System.

See also

EvalInputValue(), System::EvalVectorInput(), System::EvalEigenVectorInput()

EvalKineticEnergy(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float]) → float

Returns a reference to the cached value of the kinetic energy (KE), evaluating first if necessary using CalcKineticEnergy().

By definition here, kinetic energy depends only on “configuration” and “velocity” (e.g. angular and translational velocity) of moving masses which includes a subset of the state variables, and parameters that affect configuration, velocities, or mass properties. The calculated value may also be affected by the accuracy value supplied in the Context. KE cannot depend explicitly on time (∂KE/∂t = 0) or input port values (∂KE/∂u = 0).

Non-physical systems where KE is not meaningful will return KE = 0.

Parameter context:
The Context whose configuration and velocity variables may be used to evaluate kinetic energy.
Returns KE:
The kinetic energy in joules (J) represented by the configuration and velocity given in context.

See also

CalcKineticEnergy()

EvalPotentialEnergy(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float]) → float

Returns a reference to the cached value of the potential energy (PE), evaluating first if necessary using CalcPotentialEnergy().

By definition here, potential energy depends only on “configuration” (e.g. orientation and position), which includes a subset of the state variables, and parameters that affect configuration or conservative forces (such as lengths and masses). The calculated value may also be affected by the accuracy value supplied in the Context. PE cannot depend explicitly on time (∂PE/∂t = 0), velocities (∂PE/∂v = 0), or input port values (∂PE/∂u = 0).

Non-physical systems where PE is not meaningful will return PE = 0.

Parameter context:
The Context whose configuration variables may be used to evaluate potential energy.
Returns PE:
The potential energy in joules (J) represented by the configuration given in context.

See also

CalcPotentialEnergy()

EvalTimeDerivatives(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.ContinuousState_[float]

Returns a reference to the cached value of the continuous state variable time derivatives, evaluating first if necessary using CalcTimeDerivatives().

This method returns the time derivatives ẋ꜀ of the continuous state x꜀. The referenced return object will correspond elementwise with the continuous state in the given Context. Thus, if the state in the Context has second-order structure x꜀ = [q v z], that same structure applies to the derivatives so we will have ẋ꜀ = [q̇ ̇v̇ ż].

Parameter context:
The Context whose time, input port, parameter, state, and accuracy values may be used to evaluate the derivatives.
Returns xcdot:
Time derivatives ẋ꜀ of x꜀ returned as a reference to an object of the same type and size as context’s continuous state.

See also

CalcTimeDerivatives(), CalcImplicitTimeDerivativesResidual(), get_time_derivatives_cache_entry()

EvalVectorInput(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.Context_[float], arg1: int) → pydrake.systems.framework.BasicVector_[float]

Returns the value of the vector-valued input port with the given port_index as a BasicVector or a specific subclass Vec derived from BasicVector. Causes the value to become up to date first if necessary. See EvalAbstractInput() for more information.

The result is returned as a pointer to the input port’s value of type Vec<T> or nullptr if the port is not connected.

Precondition:
port_index selects an existing input port of this System.
Precondition:
the port must have been declared to be vector-valued.
Precondition:
the port’s value must be of type Vec<T>.
Template parameter Vec:
The template type of the input vector, which must be a subclass of BasicVector.
FixInputPortsFrom(self: pydrake.systems.framework.System_[float], other_system: pydrake.systems.framework.System_[float], other_context: pydrake.systems.framework.Context_[float], target_context: pydrake.systems.framework.Context_[float]) → None

Fixes all of the input ports in target_context to their current values in other_context, as evaluated by other_system.

Raises:
  • RuntimeError unless other_context and target_context both
  • have the same shape as this System, and the other_system.
  • Ignores disconnected inputs.
get_input_port(*args, **kwargs)

Overloaded function.

  1. get_input_port(self: pydrake.systems.framework.System_[float], port_index: int) -> pydrake.systems.framework.InputPort_[float]

Returns the typed input port at index port_index.

  1. get_input_port(self: pydrake.systems.framework.System_[float]) -> pydrake.systems.framework.InputPort_[float]

Convenience method for the case of exactly one input port.

get_output_port(*args, **kwargs)

Overloaded function.

  1. get_output_port(self: pydrake.systems.framework.System_[float], port_index: int) -> pydrake.systems.framework.OutputPort_[float]

Returns the typed output port at index port_index.

  1. get_output_port(self: pydrake.systems.framework.System_[float]) -> pydrake.systems.framework.OutputPort_[float]

Convenience method for the case of exactly one output port.

GetGraphvizString(self: pydrake.systems.framework.System_[float], max_depth: int = 2147483647) → object

Returns a Graphviz string describing this System. To render the string, use the Graphviz tool, dot. http://www.graphviz.org/

Parameter max_depth:
Sets a limit to the depth of nested diagrams to visualize. Set to zero to render a diagram as a single system block.

See also

GenerateHtml

GetInputPort(self: pydrake.systems.framework.System_[float], port_name: str) → pydrake.systems.framework.InputPort_[float]

Returns the typed input port with the unique name port_name. The current implementation performs a linear search over strings; prefer get_input_port() when performance is a concern.

Raises:RuntimeError if port_name is not found.
GetMutableSubsystemContext(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.System_[float], arg1: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.Context_[float]

Returns a mutable reference to the subcontext that corresponds to the contained System subsystem.

Raises:RuntimeError if subsystem not contained in this System.
Precondition:
The given context is valid for use with this System.
GetMyContextFromRoot(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.Context_[float]

Returns the mutable subsystem context for this system, given a root context.

See also

GetMyContextFromRoot()

GetMyMutableContextFromRoot(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.Context_[float]

Returns the mutable subsystem context for this system, given a root context.

See also

GetMyContextFromRoot()

GetOutputPort(self: pydrake.systems.framework.System_[float], port_name: str) → pydrake.systems.framework.OutputPort_[float]

Returns the typed output port with the unique name port_name. The current implementation performs a linear search over strings; prefer get_output_port() when performance is a concern.

Raises:RuntimeError if port_name is not found.
GetSubsystemContext(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.System_[float], arg1: pydrake.systems.framework.Context_[float]) → pydrake.systems.framework.Context_[float]

Returns a mutable reference to the subcontext that corresponds to the contained System subsystem.

Raises:RuntimeError if subsystem not contained in this System.
Precondition:
The given context is valid for use with this System.
GetUniquePeriodicDiscreteUpdateAttribute(self: pydrake.systems.framework.System_[float]) → Optional[pydrake.systems.framework.PeriodicEventData]

Gets whether there exists a unique periodic attribute that triggers one or more discrete update events (and, if so, returns that unique periodic attribute). Thus, this method can be used (1) as a test to determine whether a system’s dynamics are at least partially governed by difference equations and (2) to obtain the difference equation update times.

Returns:optional<PeriodicEventData> Contains the periodic trigger attributes if the unique periodic attribute exists, otherwise nullopt.
GetWitnessFunctions(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float]) → List[pydrake.systems.framework.WitnessFunction_[float]]

Derived classes can override this method to provide witness functions active for the given state. The default implementation does nothing. On entry to this function, the context will have already been validated and the vector of witness functions will have been validated to be both empty and non-null. Note: The above is for the C++ documentation. For Python, use witnesses = GetWitnessFunctions(context)

HasAnyDirectFeedthrough(self: pydrake.systems.framework.System_[float]) → bool

Returns True if any of the inputs to the system might be directly fed through to any of its outputs and False otherwise.

HasDirectFeedthrough(*args, **kwargs)

Overloaded function.

  1. HasDirectFeedthrough(self: pydrake.systems.framework.System_[float], output_port: int) -> bool

Returns true if there might be direct-feedthrough from any input port to the given output_port, and false otherwise.

  1. HasDirectFeedthrough(self: pydrake.systems.framework.System_[float], input_port: int, output_port: int) -> bool

Returns true if there might be direct-feedthrough from the given input_port to the given output_port, and false otherwise.

IsDifferenceEquationSystem(self: pydrake.systems.framework.System_[float]) → Tuple[bool, float]

Returns true iff the state dynamics of this system are governed exclusively by a difference equation on a single discrete state group and with a unique periodic update (having zero offset). E.g., it is amenable to analysis of the form: x[n+1] = f(x[n], u[n]) Note that we do NOT consider the number of input ports here, because in practice many systems of interest (e.g. MultibodyPlant) have input ports that are safely treated as constant during the analysis. Consider using get_input_port_selection() to choose one.

Parameter time_period:
if non-null, then iff the function returns True, then time_period is set to the period data returned from GetUniquePeriodicDiscreteUpdateAttribute(). If the function returns False (the system is not a difference equation system), then time_period does not receive a value.

Note: The above is for the C++ documentation. For Python, use is_diff_eq, period = IsDifferenceEquationSystem()

Publish(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.Context_[float]) → None

Forces a publish on the system, given a context. The publish event will have a trigger type of kForced, with no additional data, attribute or custom callback. The Simulator can be configured to call this in Simulator::Initialize() and at the start of each continuous integration step. See the Simulator API for more details.

SetDefaultContext(self: pydrake.systems.framework.System_[float], arg0: pydrake.systems.framework.Context_[float]) → None

Sets Context fields to their default values. User code should not override.

SetRandomContext(self: pydrake.systems.framework.System_[float], context: pydrake.systems.framework.Context_[float], generator: pydrake.common._module_py.RandomGenerator) → None

Sets Context fields to random values. User code should not override.

ToAutoDiffXd(self: pydrake.systems.framework.System_[float]) → drake::systems::System<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Creates a deep copy of this System, transmogrified to use the autodiff scalar type, with a dynamic-sized vector of partial derivatives. The result is never nullptr.

Raises:RuntimeError if this System does not support autodiff

See system_scalar_conversion for detailed background and examples related to scalar-type conversion support.

ToAutoDiffXdMaybe(self: pydrake.systems.framework.System_[float]) → drake::systems::System<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >

Creates a deep copy of this system exactly like ToAutoDiffXd(), but returns nullptr if this System does not support autodiff, instead of throwing an exception.

ToSymbolic(self: pydrake.systems.framework.System_[float]) → drake::systems::System<drake::symbolic::Expression>

Creates a deep copy of this System, transmogrified to use the symbolic scalar type. The result is never nullptr.

Raises:RuntimeError if this System does not support symbolic

See system_scalar_conversion for detailed background and examples related to scalar-type conversion support.

ToSymbolicMaybe(self: pydrake.systems.framework.System_[float]) → drake::systems::System<drake::symbolic::Expression>

Creates a deep copy of this system exactly like ToSymbolic(), but returns nullptr if this System does not support symbolic, instead of throwing an exception.

class pydrake.systems.framework.SystemBase

Provides non-templatized functionality shared by the templatized System classes.

Terminology: in general a Drake System is a tree structure composed of “subsystems”, which are themselves System objects. The corresponding Context is a parallel tree structure composed of “subcontexts”, which are themselves Context objects. There is a one-to-one correspondence between subsystems and subcontexts. Within a given System (Context), its child subsystems (subcontexts) are indexed using a SubsystemIndex; there is no separate SubcontextIndex since the numbering must be identical.

__init__

Initialize self. See help(type(self)) for accurate signature.

abstract_parameter_ticket(self: pydrake.systems.framework.SystemBase, index: pydrake.systems.framework.AbstractParameterIndex) → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on a particular abstract parameter paᵢ.

See also

pa_ticket() to obtain a ticket for all abstract parameters.

abstract_state_ticket(self: pydrake.systems.framework.SystemBase, index: pydrake.systems.framework.AbstractStateIndex) → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on a particular abstract state variable xaᵢ.

See also

xa_ticket() to obtain a ticket for all abstract variables.

static accuracy_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on the accuracy setting in the Context. This is the same ticket for all systems and refers to the same accuracy value.

static all_input_ports_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on all input ports u of this system.

See also

input_port_ticket() to obtain a ticket for just one input port.

static all_parameters_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on all parameters p in this system, including numeric parameters pn, and abstract parameters pa.

static all_sources_except_input_ports_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on every possible independent source value except input ports. This can be helpful in avoiding the incorrect appearance of algebraic loops in a Diagram (those always involve apparent input port dependencies). For an output port, use this ticket plus tickets for just the input ports on which the output computation actually depends. The sources included in this ticket are: time, accuracy, state, and parameters. Note that dependencies on cache entries are not included here. Usually that won’t matter since cache entries typically depend on at least one of time, accuracy, state, or parameters so will be invalidated for the same reason the current computation is. However, for a computation that depends on a cache entry that depends only on input ports, be sure that you have included those input ports in the dependency list, or include a direct dependency on the cache entry.

See also

input_port_ticket() to obtain a ticket for an input port.

See also

cache_entry_ticket() to obtain a ticket for a cache entry.

See also

all_sources_ticket() to also include all input ports as dependencies.

static all_sources_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on every possible independent source value, including time, accuracy, state, input ports, and parameters (but not cache entries). This is the default dependency for computations that have not specified anything more refined. It is equivalent to the set {all_sources_except_input_ports_ticket(), all_input_ports_ticket()}.

See also

cache_entry_ticket() to obtain a ticket for a cache entry.

static all_state_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on all state variables x in this system, including continuous variables xc, discrete (numeric) variables xd, and abstract state variables xa. This does not imply dependence on time, accuracy, parameters, or inputs; those must be specified separately. If you mean to express dependence on all possible value sources, use all_sources_ticket() instead.

cache_entry_ticket(self: pydrake.systems.framework.SystemBase, index: pydrake.systems.framework.CacheIndex) → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on the cache entry indicated by index. Note that cache entries are not included in the all_sources ticket so must be listed separately.

Precondition:
index selects an existing cache entry in this System.
static configuration_ticket() → pydrake.systems.framework.DependencyTicket
discrete_state_ticket(self: pydrake.systems.framework.SystemBase, index: pydrake.systems.framework.DiscreteStateIndex) → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on a particular discrete state variable xdᵢ (may be a vector). (We sometimes refer to this as a “discrete variable group”.)

See also

xd_ticket() to obtain a ticket for all discrete variables.

get_name(self: pydrake.systems.framework.SystemBase) → str

Returns the name last supplied to set_name(), if any. Diagrams built with DiagramBuilder will always have a default name for every contained subsystem for which no user-provided name is available. Systems created by copying with a scalar type change have the same name as the source system. An empty string is returned if no name has been set.

GetSystemName(self: pydrake.systems.framework.SystemBase) → str

Returns a human-readable name for this system, for use in messages and logging. This will be the same as returned by get_name(), unless that would be an empty string. In that case we return a non-unique placeholder name, currently just “_” (a lone underscore).

GetSystemPathname(self: pydrake.systems.framework.SystemBase) → str

Generates and returns a human-readable full path name of this subsystem, for use in messages and logging. The name starts from the root System, with “::” delimiters between parent and child subsystems, with the individual subsystems represented by their names as returned by GetSystemName().

GetSystemType(self: pydrake.systems.framework.SystemBase) → str

Returns the most-derived type of this concrete System object as a human-readable string suitable for use in error messages. The format is as generated by NiceTypeName and will include namespace qualification if present.

See also

NiceTypeName for more specifics.

input_port_ticket(self: pydrake.systems.framework.SystemBase, index: pydrake.systems.framework.InputPortIndex) → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on input port uᵢ indicated by index.

Precondition:
index selects an existing input port of this System.
static ke_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket for the cache entry that holds the kinetic energy calculation.

See also

System::EvalKineticEnergy()

static kinematics_ticket() → pydrake.systems.framework.DependencyTicket
static nothing_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating that a computation does not depend on any source value; that is, it is a constant. If this appears in a prerequisite list, it must be the only entry.

num_abstract_parameters(self: pydrake.systems.framework.SystemBase) → int

Returns the number of declared abstract parameters.

num_input_ports(self: pydrake.systems.framework.SystemBase) → int

Returns the number of input ports currently allocated in this System. These are indexed from 0 to num_input_ports()-1.

num_numeric_parameter_groups(self: pydrake.systems.framework.SystemBase) → int

Returns the number of declared numeric parameters (each of these is a vector-valued parameter).

num_output_ports(self: pydrake.systems.framework.SystemBase) → int

Returns the number of output ports currently allocated in this System. These are indexed from 0 to num_output_ports()-1.

numeric_parameter_ticket(self: pydrake.systems.framework.SystemBase, index: pydrake.systems.framework.NumericParameterIndex) → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on a particular numeric parameter pnᵢ (may be a vector).

See also

pn_ticket() to obtain a ticket for all numeric parameters.

static pa_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on all of the abstract parameters pa in the current Context.

See also

abstract_parameter_ticket() to obtain a ticket for just one abstract parameter.

static pc_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket for the cache entry that holds the conservative power calculation.

See also

System::EvalConservativePower()

static pe_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket for the cache entry that holds the potential energy calculation.

See also

System::EvalPotentialEnergy()

static pn_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on all of the numerical parameters in the current Context.

See also

numeric_parameter_ticket() to obtain a ticket for just one numeric parameter.

static pnc_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket for the cache entry that holds the non-conservative power calculation.

See also

System::EvalNonConservativePower()

static q_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating that a computation depends on configuration state variables q. There is no ticket representing just one of the state variables qᵢ.

set_name(self: pydrake.systems.framework.SystemBase, name: str) → None

Sets the name of the system. Do not use the path delimiter character ‘:’ in the name. When creating a Diagram, names of sibling subsystems should be unique. DiagramBuilder uses this method to assign a unique default name if none is provided.

static time_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on time. This is the same ticket for all systems and refers to the same time value.

static v_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on velocity state variables v. This does not also indicate a dependence on configuration variables q – you must list that explicitly or use kinematics_ticket() instead. There is no ticket representing just one of the state variables vᵢ.

static xa_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on all of the abstract state variables in the current Context.

See also

abstract_state_ticket() to obtain a ticket for just one abstract state variable.

static xc_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on all of the continuous state variables q, v, or z.

static xcdot_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket for the cache entry that holds time derivatives of the continuous variables.

See also

EvalTimeDerivatives()

static xd_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on all of the numerical discrete state variables, in any discrete variable group.

See also

discrete_state_ticket() to obtain a ticket for just one discrete state variable.

static z_ticket() → pydrake.systems.framework.DependencyTicket

Returns a ticket indicating dependence on any or all of the miscellaneous continuous state variables z. There is no ticket representing just one of the state variables zᵢ.

pydrake.systems.framework.SystemOutput

alias of pydrake.systems.framework.SystemOutput_[float]

template pydrake.systems.framework.SystemOutput_

Instantiations: SystemOutput_[float], SystemOutput_[AutoDiffXd], SystemOutput_[Expression]

class SystemOutput_[float]

Conveniently stores a snapshot of the values of every output port of a System. There is framework support for allocating the right types and filling them in but otherwise this is not used internally. Note that there is never any live connection between a SystemOutput object and the System whose output values it has captured.

A SystemOutput<T> object can only be obtained using System<T>::AllocateOutput() or by copying an existing SystemOutput object.

__init__

Initialize self. See help(type(self)) for accurate signature.

get_data(self: pydrake.systems.framework.SystemOutput_[float], arg0: int) → pydrake.common.value.AbstractValue

Returns the last-saved value of output port index as an AbstractValue. This works for any output port regardless of it actual type.

get_vector_data(self: pydrake.systems.framework.SystemOutput_[float], arg0: int) → pydrake.systems.framework.BasicVector_[float]

Returns the last-saved value of output port index as a BasicVector<T>, although the actual concrete type is preserved from the actual output port.

Raises:RuntimeError if the port is not vector-valued.
num_ports(self: pydrake.systems.framework.SystemOutput_[float]) → int

Returns the number of output ports specified for this SystemOutput during allocation.

class pydrake.systems.framework.SystemOutput_[AutoDiffXd]

Conveniently stores a snapshot of the values of every output port of a System. There is framework support for allocating the right types and filling them in but otherwise this is not used internally. Note that there is never any live connection between a SystemOutput object and the System whose output values it has captured.

A SystemOutput<T> object can only be obtained using System<T>::AllocateOutput() or by copying an existing SystemOutput object.

__init__

Initialize self. See help(type(self)) for accurate signature.

get_data(self: pydrake.systems.framework.SystemOutput_[AutoDiffXd], arg0: int) → pydrake.common.value.AbstractValue

Returns the last-saved value of output port index as an AbstractValue. This works for any output port regardless of it actual type.

get_vector_data(self: pydrake.systems.framework.SystemOutput_[AutoDiffXd], arg0: int) → pydrake.systems.framework.BasicVector_[AutoDiffXd]

Returns the last-saved value of output port index as a BasicVector<T>, although the actual concrete type is preserved from the actual output port.

Raises:RuntimeError if the port is not vector-valued.
num_ports(self: pydrake.systems.framework.SystemOutput_[AutoDiffXd]) → int

Returns the number of output ports specified for this SystemOutput during allocation.

class pydrake.systems.framework.SystemOutput_[Expression]

Conveniently stores a snapshot of the values of every output port of a System. There is framework support for allocating the right types and filling them in but otherwise this is not used internally. Note that there is never any live connection between a SystemOutput object and the System whose output values it has captured.

A SystemOutput<T> object can only be obtained using System<T>::AllocateOutput() or by copying an existing SystemOutput object.

__init__

Initialize self. See help(type(self)) for accurate signature.

get_data(self: pydrake.systems.framework.SystemOutput_[Expression], arg0: int) → pydrake.common.value.AbstractValue

Returns the last-saved value of output port index as an AbstractValue. This works for any output port regardless of it actual type.

get_vector_data(self: pydrake.systems.framework.SystemOutput_[Expression], arg0: int) → pydrake.systems.framework.BasicVector_[Expression]

Returns the last-saved value of output port index as a BasicVector<T>, although the actual concrete type is preserved from the actual output port.

Raises:RuntimeError if the port is not vector-valued.
num_ports(self: pydrake.systems.framework.SystemOutput_[Expression]) → int

Returns the number of output ports specified for this SystemOutput during allocation.

class pydrake.systems.framework.SystemOutput_[float]

Conveniently stores a snapshot of the values of every output port of a System. There is framework support for allocating the right types and filling them in but otherwise this is not used internally. Note that there is never any live connection between a SystemOutput object and the System whose output values it has captured.

A SystemOutput<T> object can only be obtained using System<T>::AllocateOutput() or by copying an existing SystemOutput object.

__init__

Initialize self. See help(type(self)) for accurate signature.

get_data(self: pydrake.systems.framework.SystemOutput_[float], arg0: int) → pydrake.common.value.AbstractValue

Returns the last-saved value of output port index as an AbstractValue. This works for any output port regardless of it actual type.

get_vector_data(self: pydrake.systems.framework.SystemOutput_[float], arg0: int) → pydrake.systems.framework.BasicVector_[float]

Returns the last-saved value of output port index as a BasicVector<T>, although the actual concrete type is preserved from the actual output port.

Raises:RuntimeError if the port is not vector-valued.
num_ports(self: pydrake.systems.framework.SystemOutput_[float]) → int

Returns the number of output ports specified for this SystemOutput during allocation.

class pydrake.systems.framework.SystemScalarConverter
__init__(self: pydrake.systems.framework.SystemScalarConverter) → None
template Add

Instantiations: Add[AutoDiffXd, float], Add[Expression, float], Add[float, AutoDiffXd], Add[Expression, AutoDiffXd], Add[float, Expression], Add[AutoDiffXd, Expression]

Add[AutoDiffXd, float](self: pydrake.systems.framework.SystemScalarConverter, arg0: Callable[[drake::systems::System<double>], drake::systems::System<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >]) → None
Add[AutoDiffXd, Expression](self: pydrake.systems.framework.SystemScalarConverter, arg0: Callable[[drake::systems::System<drake::symbolic::Expression>], drake::systems::System<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >]) → None
Add[AutoDiffXd, float](self: pydrake.systems.framework.SystemScalarConverter, arg0: Callable[[drake::systems::System<double>], drake::systems::System<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >]) → None
Add[Expression, AutoDiffXd](self: pydrake.systems.framework.SystemScalarConverter, arg0: Callable[[drake::systems::System<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >], drake::systems::System<drake::symbolic::Expression>]) → None
Add[Expression, float](self: pydrake.systems.framework.SystemScalarConverter, arg0: Callable[[drake::systems::System<double>], drake::systems::System<drake::symbolic::Expression>]) → None
Add[float, AutoDiffXd](self: pydrake.systems.framework.SystemScalarConverter, arg0: Callable[[drake::systems::System<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >], drake::systems::System<double>]) → None
Add[float, Expression](self: pydrake.systems.framework.SystemScalarConverter, arg0: Callable[[drake::systems::System<drake::symbolic::Expression>], drake::systems::System<double>]) → None
template IsConvertible

Instantiations: IsConvertible[AutoDiffXd, float], IsConvertible[Expression, float], IsConvertible[float, AutoDiffXd], IsConvertible[Expression, AutoDiffXd], IsConvertible[float, Expression], IsConvertible[AutoDiffXd, Expression]

IsConvertible[AutoDiffXd, float](self: pydrake.systems.framework.SystemScalarConverter) → bool
IsConvertible[AutoDiffXd, Expression](self: pydrake.systems.framework.SystemScalarConverter) → bool
IsConvertible[AutoDiffXd, float](self: pydrake.systems.framework.SystemScalarConverter) → bool
IsConvertible[Expression, AutoDiffXd](self: pydrake.systems.framework.SystemScalarConverter) → bool
IsConvertible[Expression, float](self: pydrake.systems.framework.SystemScalarConverter) → bool
IsConvertible[float, AutoDiffXd](self: pydrake.systems.framework.SystemScalarConverter) → bool
IsConvertible[float, Expression](self: pydrake.systems.framework.SystemScalarConverter) → bool
SupportedConversionPairs = ((<class 'pydrake.autodiffutils.AutoDiffXd'>, <class 'float'>), (<class 'pydrake.symbolic.Expression'>, <class 'float'>), (<class 'float'>, <class 'pydrake.autodiffutils.AutoDiffXd'>), (<class 'pydrake.symbolic.Expression'>, <class 'pydrake.autodiffutils.AutoDiffXd'>), (<class 'float'>, <class 'pydrake.symbolic.Expression'>), (<class 'pydrake.autodiffutils.AutoDiffXd'>, <class 'pydrake.symbolic.Expression'>))
SupportedScalars = (<class 'float'>, <class 'pydrake.autodiffutils.AutoDiffXd'>, <class 'pydrake.symbolic.Expression'>)
class pydrake.systems.framework.TriggerType

Predefined types of triggers for events. Used at run time to determine why the associated event has occurred.

Members:

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.

__init__(self: pydrake.systems.framework.TriggerType, value: int) → None
kForced = <TriggerType.kForced: 2>
kInitialization = <TriggerType.kInitialization: 1>
kPeriodic = <TriggerType.kPeriodic: 4>
kPerStep = <TriggerType.kPerStep: 5>
kTimed = <TriggerType.kTimed: 3>
kUnknown = <TriggerType.kUnknown: 0>
kWitness = <TriggerType.kWitness: 6>
name
value
pydrake.systems.framework.UnrestrictedUpdateEvent

alias of pydrake.systems.framework.UnrestrictedUpdateEvent_[float]

template pydrake.systems.framework.UnrestrictedUpdateEvent_

Instantiations: UnrestrictedUpdateEvent_[float], UnrestrictedUpdateEvent_[AutoDiffXd], UnrestrictedUpdateEvent_[Expression]

class UnrestrictedUpdateEvent_[float]

Bases: pydrake.systems.framework.Event_[float]

This class represents an unrestricted update event. It has an optional callback function to do custom handling of this event given const Context and const UnrestrictedUpdateEvent object references, and writes the updates to a mutable, non-null State object.

__init__(self: pydrake.systems.framework.UnrestrictedUpdateEvent_[float], callback: Callable[[pydrake.systems.framework.Context_[float], pydrake.systems.framework.UnrestrictedUpdateEvent_[float], drake::systems::State<double>], None]) → None

Makes a UnrestrictedUpdateEvent with no trigger type, no event data, and the specified callback function.

class pydrake.systems.framework.UnrestrictedUpdateEvent_[AutoDiffXd]

Bases: pydrake.systems.framework.Event_[AutoDiffXd]

This class represents an unrestricted update event. It has an optional callback function to do custom handling of this event given const Context and const UnrestrictedUpdateEvent object references, and writes the updates to a mutable, non-null State object.

__init__(self: pydrake.systems.framework.UnrestrictedUpdateEvent_[AutoDiffXd], callback: Callable[[pydrake.systems.framework.Context_[AutoDiffXd], pydrake.systems.framework.UnrestrictedUpdateEvent_[AutoDiffXd], drake::systems::State<Eigen::AutoDiffScalar<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >], None]) → None

Makes a UnrestrictedUpdateEvent with no trigger type, no event data, and the specified callback function.

class pydrake.systems.framework.UnrestrictedUpdateEvent_[Expression]

Bases: pydrake.systems.framework.Event_[Expression]

This class represents an unrestricted update event. It has an optional callback function to do custom handling of this event given const Context and const UnrestrictedUpdateEvent object references, and writes the updates to a mutable, non-null State object.

__init__(self: pydrake.systems.framework.UnrestrictedUpdateEvent_[Expression], callback: Callable[[pydrake.systems.framework.Context_[Expression], pydrake.systems.framework.UnrestrictedUpdateEvent_[Expression], drake::systems::State<drake::symbolic::Expression>], None]) → None

Makes a UnrestrictedUpdateEvent with no trigger type, no event data, and the specified callback function.

class pydrake.systems.framework.UnrestrictedUpdateEvent_[float]

Bases: pydrake.systems.framework.Event_[float]

This class represents an unrestricted update event. It has an optional callback function to do custom handling of this event given const Context and const UnrestrictedUpdateEvent object references, and writes the updates to a mutable, non-null State object.

__init__(self: pydrake.systems.framework.UnrestrictedUpdateEvent_[float], callback: Callable[[pydrake.systems.framework.Context_[float], pydrake.systems.framework.UnrestrictedUpdateEvent_[float], drake::systems::State<double>], None]) → None

Makes a UnrestrictedUpdateEvent with no trigger type, no event data, and the specified callback function.

class pydrake.systems.framework.UseDefaultName

(Advanced.) Tag type that indicates a system or port should use a default name, instead of a user-provided name. Most users will use the kUseDefaultName constant, without ever having to mention this type.

__init__

Initialize self. See help(type(self)) for accurate signature.

pydrake.systems.framework.VectorBase

alias of pydrake.systems.framework.VectorBase_[float]

template pydrake.systems.framework.VectorBase_

Instantiations: VectorBase_[float], VectorBase_[AutoDiffXd], VectorBase_[Expression]

class VectorBase_[float]

VectorBase is an abstract base class that real-valued signals between Systems and real-valued System state vectors must implement. Classes that inherit from VectorBase will typically provide names for the elements of the vector, and may also provide other computations for the convenience of Systems handling the signal. The vector is always a column vector. It may or may not be contiguous in memory. Contiguous subclasses should typically inherit from BasicVector, not from VectorBase directly.

__init__

Initialize self. See help(type(self)) for accurate signature.

CopyToVector(self: pydrake.systems.framework.VectorBase_[float]) → numpy.ndarray[numpy.float64[m, 1]]

Copies this entire VectorBase into a contiguous Eigen Vector.

Implementations should ensure this operation is O(N) in the size of the value and allocates only the O(N) memory that it returns.

GetAtIndex(self: pydrake.systems.framework.VectorBase_[float], index: int) → float

Returns the element at the given index in the vector.

Raises:
  • RuntimeError if the index is >= size() or negative. Consider
  • operator[]() instead if bounds-checking is unwanted.
PlusEqScaled(self: pydrake.systems.framework.VectorBase_[float], scale: float, rhs: pydrake.systems.framework.VectorBase_[float]) → pydrake.systems.framework.VectorBase_[float]

Add in scaled vector rhs to this vector.

Raises:RuntimeError if rhs is a different size than this.
SetAtIndex(self: pydrake.systems.framework.VectorBase_[float], index: int, value: float) → None

Replaces the state at the given index with the value.

Raises:
  • RuntimeError if the index is >= size(). Consider operator[]()
  • instead if bounds-checking is unwanted.
SetFrom(self: pydrake.systems.framework.VectorBase_[float], value: pydrake.systems.framework.VectorBase_[float]) → None

Replaces the entire vector with the contents of value.

Raises:RuntimeError if value is not a column vector with size() rows.

Implementations should ensure this operation is O(N) in the size of the value and allocates no memory.

SetFromVector(self: pydrake.systems.framework.VectorBase_[float], value: numpy.ndarray[numpy.float64[m, 1]]) → None

Replaces the entire vector with the contents of value.

Raises:RuntimeError if value is not a column vector with size() rows.

Implementations should ensure this operation is O(N) in the size of the value and allocate