Actions

class stonesoup.movable.action.move_position_action.MovePositionAction(end_time: datetime, target_value: Any, generator: Any = None)[source]

Bases: Action

This is the base class for an action that changes the position of a platform or sensor.

Parameters:
  • end_time (datetime.datetime) – Time at which modification of the attribute ends.

  • target_value (Any) – Target value.

  • generator (Any, optional) – Action generator that created the action.

act(current_time, timestamp, init_value)[source]

Return the attribute modified.

Parameters:
  • current_time (datetime.datetime) – Current time

  • timestamp (datetime.datetime) – Modification of attribute ends at this time stamp

  • init_value (Any) – Current value of the modifiable attribute

Returns:

The new value of the attribute

Return type:

Any

class stonesoup.movable.action.move_position_action.GridActionGenerator(owner: object, attribute: str, start_time: datetime, end_time: datetime, resolution: float = 1, action_space: ndarray = None, action_mapping: Sequence[int] = (0, 1))[source]

Bases: ActionGenerator

This is the base class for generators that generate actions in a grid like fashion.

Parameters:
  • owner (object) – Actionable object that has the attribute to be modified.

  • attribute (str) – The name of the attribute to be modified.

  • start_time (datetime.datetime) – Start time of action.

  • end_time (datetime.datetime) – End time of action.

  • resolution (float, optional) – The size of each grid cell. Cells are assumed square.

  • action_space (numpy.ndarray, optional) – The bounds of the action space that should not be exceeded. Of shape (ndim, 2) where ndim is the length of the action_mapping. For example, np.array([[xmin, xmax], [ymin, ymax]]).

  • action_mapping (collections.abc.Sequence, optional) – The state dimensions that actions are applied to.

action_space: ndarray

The bounds of the action space that should not be exceeded. Of shape (ndim, 2) where ndim is the length of the action_mapping. For example, np.array([[xmin, xmax], [ymin, ymax]]).

action_mapping: Sequence[int]

The state dimensions that actions are applied to.

resolution: float

The size of each grid cell. Cells are assumed square.

class stonesoup.movable.action.move_position_action.NStepDirectionalGridActionGenerator(owner: object, attribute: str, start_time: datetime, end_time: datetime, resolution: float = 1, action_space: ndarray = None, action_mapping: Sequence[int] = (0, 1), n_steps: int = 1, step_size: int = 1)[source]

Bases: GridActionGenerator

This is a grid action generator that enables movement by a number of steps in the specified directions. Actions are applied symmetrically so can move by a number of steps in positive and negative directions along the specified dimensions.

Parameters:
  • owner (object) – Actionable object that has the attribute to be modified.

  • attribute (str) – The name of the attribute to be modified.

  • start_time (datetime.datetime) – Start time of action.

  • end_time (datetime.datetime) – End time of action.

  • resolution (float, optional) – The size of each grid cell. Cells are assumed square.

  • action_space (numpy.ndarray, optional) – The bounds of the action space that should not be exceeded. Of shape (ndim, 2) where ndim is the length of the action_mapping. For example, np.array([[xmin, xmax], [ymin, ymax]]).

  • action_mapping (collections.abc.Sequence, optional) – The state dimensions that actions are applied to.

  • n_steps (int, optional) – The number of steps that can be moved in either direction along specified dimensions

  • step_size (int, optional) – The number of grid cells per step

n_steps: int

The number of steps that can be moved in either direction along specified dimensions

step_size: int

The number of grid cells per step

property default_action

The default action to modify the property if there is no given action.