gt-space / servo

Control server software that coordinates actions between all other systems.
0 stars 0 forks source link

Configuration Checks for Sequences #4

Open AndrewCarlisleECE opened 7 months ago

AndrewCarlisleECE commented 7 months ago

In developing the sequences system, we recognized that associating sequences with configurations is a good idea. If an operator attempts to execute a sequence that is tied to a configuration that is not currently active, then they should receive a warning on the GUI side. This is to prevent runtime errors when running the sequence on the wrong configuration.

For example, suppose a configuration is active with the sensors KBPT and WTPT set. Now, suppose an operator attempts to run a sequence like the following:

while WTPT < 120 psi: if VHPT > 180 psi: BBV.open() else: BBV.close()

As you can see, the terms VHPT and BBV are not defined for the current configuration, so running this sequence will result in a runtime error. This is unlikely to be the operator's intention.

To fix this, if a request comes in to run a sequence that has a mismatching configuration, initially return a code 400 Bad Request if the "force" option of the RunSequenceRequest is either Some(false) or None. However, if the "force" option is Some(true), then execute the sequence anyway. The GUI knows that it should send a non-forced request and then a forced request if directed by the operator.