dstl / Stone-Soup

A software project to provide the target tracking community with a framework for the development and testing of tracking algorithms.
https://stonesoup.rtfd.io
MIT License
384 stars 126 forks source link

Changing a platform's `movement_controller` doesn't change a sensor's `movement_controller`. #1025

Open gawebb-dstl opened 1 month ago

gawebb-dstl commented 1 month ago

I think it is rare that the movement_controller property on a platform is changed. However it is worth noting that changing a platform's movement_controller doesn't change the attached sensors' movement_controller. I've a pasted a snippet below which demostrates this.

timestamp = datetime.datetime.now()
fixed_state = State(np.array([[2], [2], [0]]),
                    timestamp)
fixed = FixedMovable(states=fixed_state, position_mapping=(0, 1, 2))
platform = MovingPlatform(movement_controller=fixed)

platform.add_sensor(DummySensor())
assert platform.movement_controller is sensor.movement_controller

moving_state = State(np.array([[2], [1], [2], [-1], [2], [0]]), timestamp)
moving = MovingMovable(states=moving_state, position_mapping=(0, 2, 4), transition_model=None)

platform.movement_controller = moving

assert platform.movement_controller is sensor.movement_controller  # This fails/
gawebb-dstl commented 1 month ago

Option 1: Make the movement_controller property read only.

I currently prefer this option. If the platform had already started moving, replacing the movement_controller would be rewriting the platform's history.

gawebb-dstl commented 1 month ago

Option 2: Add a setter for the movement_controller property.

gawebb-dstl commented 1 month ago

What are your thoughts @erogers-dstl ?