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.
This commit is contained in:
parent
7fbfe1c5f7
commit
b0aac111a2
@ -65,6 +65,9 @@ controller: ControllerConfig = .{
|
|||||||
.parking_posture = .{ .azimuth = 180, .elevation = 90 },
|
.parking_posture = .{ .azimuth = 180, .elevation = 90 },
|
||||||
.angle_tolerance = .{ .azimuth = 1, .elevation = 1 },
|
.angle_tolerance = .{ .azimuth = 1, .elevation = 1 },
|
||||||
.angle_offset = .{ .azimuth = 0, .elevation = 0 },
|
.angle_offset = .{ .azimuth = 0, .elevation = 0 },
|
||||||
|
// this is a symmetric mask, so the minimum usable elevation is elevation_mask deg
|
||||||
|
// and the maximum usable elevation is 180 - elevation_mask deg
|
||||||
|
.elevation_mask = 0.0,
|
||||||
},
|
},
|
||||||
|
|
||||||
pub const VoltAngle = struct { voltage: f64, angle: f64 };
|
pub const VoltAngle = struct { voltage: f64, angle: f64 };
|
||||||
@ -115,6 +118,7 @@ const ControllerConfig = struct {
|
|||||||
parking_posture: AzEl,
|
parking_posture: AzEl,
|
||||||
angle_tolerance: AzEl,
|
angle_tolerance: AzEl,
|
||||||
angle_offset: AzEl,
|
angle_offset: AzEl,
|
||||||
|
elevation_mask: f64,
|
||||||
|
|
||||||
const OutPair = struct {
|
const OutPair = struct {
|
||||||
increase: lj.DigitalOutputChannel,
|
increase: lj.DigitalOutputChannel,
|
||||||
|
@ -40,7 +40,13 @@ pub fn setTarget(self: LabjackYaesu, target: AzEl) void {
|
|||||||
defer self.lock.unlock();
|
defer self.lock.unlock();
|
||||||
|
|
||||||
const controller = @constCast(self.controller);
|
const controller = @constCast(self.controller);
|
||||||
controller.target = target;
|
controller.target = .{
|
||||||
|
.azimuth = target.azimuth,
|
||||||
|
.elevation = @min(
|
||||||
|
@max(target.elevation, config.controller.elevation_mask),
|
||||||
|
180.0 - config.controller.elevation_mask,
|
||||||
|
),
|
||||||
|
};
|
||||||
controller.requested_state = .running;
|
controller.requested_state = .running;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user