Skip to content

Commit

Permalink
Allow setting position of moving platforms, provided their transition…
Browse files Browse the repository at this point in the history
… model is not set.
  • Loading branch information
erogers-dstl committed Apr 17, 2020
1 parent 4813a1e commit e7995b5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion stonesoup/platform/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,15 @@ def is_moving(self) -> bool:
return np.any(self.velocity != 0)

def _set_position(self, value):
raise AttributeError('Cannot set the position of a moving platform')
# The logic below is this: if a moving platform is being built from (say) input
# real-world data then its transition model would not be set, and so it would be fine to
# set its position. However, if the transition model is set, then setting the position is
# both unexpected and may cause odd effects, so is forbidden
if self.transition_model is None:
self.state_vector[self.position_mapping, :] = value
else:
raise AttributeError('Cannot set the position of a moving platform with a '
'transition model')

def move(self, timestamp=None, **kwargs) -> None:
"""Propagate the platform position using the :attr:`transition_model`.
Expand Down

0 comments on commit e7995b5

Please sign in to comment.