11 Commits

Author SHA1 Message Date
61c10df63d
controller: restructure control loop
This should have been multiple commits, but it isn't. Sue me. This
change has two main goals:

1. Sample feedback at the beginning of the control loop iteration so
   that it is always up-to-date when we are computing the actual drive
   outputs. This means we're doing twice the amount of communication
   with the labjack (previously, setting the output and reading the
   feedback was done with a singe command). However, this makes the
   loop structure much more standard, and it means that we aren't
   constantly operating on feedback that is stale by one loop
   interval.

2. Sample feedback into a (configurable size) buffer. This lets us
   operate on aggregated feedback rather than on a single instantaneous
   data point. Right now, feedback is computed as a moving average,
   which acts as a rudimentary low-pass filter, reducing spurious
   single-loop actions due to feedback spikes or other noise. However,
   the other reason to aggregate some backwards data is that it will
   let us do automatic stall detection in a simple way, although that
   is not currently done.
2024-07-18 21:47:50 -07:00
2194dd4a8c
config: make it possible not to leak
Using the GPA is a bit annoying sometimes. The other option would be to
just use page allocator to allocate the config and bypass the GPA.
2024-07-15 17:55:31 -07:00
e5d8a716b0
improve a name 2024-07-11 21:55:34 -07:00
e4393c2e5a
config: change default control loop interval
On an unloaded rotator, this fixes the rapid relay toggling without
needing to implement debouncing.

An additional configuration validation should probably be added: the
rotator rotates in azimuth about 6 deg per second. If the control loop
speed is too slow or the controller angle tolerance is small enough,
then the controller will never be able settle (imagine that the loop
interval is 1 second. That means the rotator will move approximately 6
degrees every loop iteration, so it will always overshoot.
2024-07-10 12:43:11 -07:00
dbb076f69b
Config: perform basic validation
This just makes sure the parking posture is within the valid range of
motion of the rotator.
2024-07-07 15:38:26 -07:00
b0aac111a2
controller: implement elevation mask
There's not really any analogous concept for azimuth. This is for a
specific piece of hardware, so there's no real point in making it more
generic. This is respected at the 180 degree point as well, for
software that can handle flipped rotation configurations.

This doesn't currently play well with the elevation offset setting,
which should be applied after this clamping operation. Either this
needs to be moved to the API layer or (more appropriately) the input
range validation needs to move in the controller.
2024-07-06 13:04:55 -07:00
7fbfe1c5f7
rotctl: do range validation
This is at the interface layer though it should arguably be done at the
controller layer. Oh well.
2024-07-06 12:59:48 -07:00
7105775426
labjack: use symbolic gain values
This reads better in the config file.
2024-07-06 12:58:27 -07:00
0e88022a8d
config: change default listen port
This now matches the rotctld default listen port
2024-07-06 12:56:10 -07:00
dbbb5c1748
rotctl: hook up P interface
This appears to work. Now all that remains is doing the rest of the
work.
2024-07-03 17:44:26 -07:00
c8bec6a7c5
start writing control and config functionality
In theory, this will poll the feedback lines, but in practice, it
probably crashes or catches on fire or something.
2024-07-03 16:06:49 -07:00