Reset Node

class eagerx.core.entities.ResetNode(params, *args, **kwargs)[source]

Baseclass for nodes that perform a reset routine.

Use this baseclass to implement reset nodes that will be added to the (agnostic) Graph.

Users must call make() to make the reset node subclass’ specification.

Note

Subclasses must always have at least one target registered with the eagerx.core.register.targets() decorator.

Subclasses must implement the following methods:

Use baseclass EngineNode instead, for nodes that will be added to EngineGraph when specifying an engine implementation for an Object.

Use baseclass Node instead, for regular nodes that will be added to the agnostic Graph.

abstract callback(t_n, **inputs_and_targets)[source]

An abstract method that is called at the specified node rate during the environment reset.

This method should be decorated with:

Note

This callback is skipped until the user calls reset(). Until then, the messages coming in via the connected feedthroughs are fed through as the outputs instead. For every registered output that was registered (& selected) with the eagerx.core.register.outputs() decorator by the subclass, there must be a connected feedthrough.

Parameters
Return type

Dict[str, Any]

Returns

Dictionary with outputs that were registered (& selected) with the eagerx.core.register.outputs() decorator by the subclass. In addition, the dictionary must contain message of type bool that specifies whether the requested target was reached.

classmethod info(method=None)

A helper method to get info on a method of the specified subclass.

Parameters

method (Union[List[str], str, None]) – The registered method we would like to receive info on. If no method is specified, it provides info on the class itself.

Return type

str

Returns

Info on the subclass’ method.

abstract initialize(spec)

An abstract method that initializes the node at run-time.

Parameters

spec (Union[NodeSpec, EngineSpec, ResetNodeSpec]) – Specification of the node/engine.

Return type

None

abstract classmethod make(*args, **kwargs)

An abstract method that makes the specification (also referred to as spec) of this entity.

Parameters
  • args (Any) – Arguments to the subclass’ make function.

  • kwargs (Any) – Optional Arguments to the subclass’ make function.

Returns

A (mutable) spec that can be used to build and subsequently initialize the entity (e.g. node, engine, …).

abstract reset(**states)[source]

An abstract method that resets the node to its initial state before the start of an episode.

This method should be decorated with eagerx.core.register.states() to register the states.

Parameters

states (Any) – States that were registered (& selected) with the eagerx.core.register.states() decorator by the subclass. The state messages are sent by the environment and can be used to reset the node at the start of an episode. This can be anything from an estimator’s initial state to a hyper-parameter (e.g. delay, control gains).

Return type

None

set_delay(delay, component, cname)

A method to vary the delay of an input or feedthrough.

Parameters
  • delay (float) – A non-negative delay that can be varied at the beginning of an episode (during the reset procedure).

  • component (str) – Either “inputs” or “feedthroughs”.

  • cname (str) – name of the component.

Return type

None

shutdown()

A method that can be overwritten to cleanly shutdown (e.g. release resources).

Return type

None