Set the movers' zeros and pan directions, swap M1/M2's patch, and model tilt in the simulator.
The front right mover is on DMX 1 and the front left on 45, so M1 and M2 swap addresses in the stage map and test.qxw. Measured on the rig, pan 0 faces forward on the front pair and into the middle on the back pair, back at 85. M1 and M4 turn anticlockwise, so movers get a pan_reverse flag. Tilt 127 now points straight down: the simulator draws a spot under the head, and past 127 the beam flips behind the pan heading. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2b0f9e2f9b
commit
fc8abf9c99
9 files changed
+124
-26
No files matched your search
+60
-12
@@ -42,9 +42,9 @@ def test_xchc_patch_matches_the_stage_map():
|
||||
assert by_id["#1"].address == 87
|
||||
assert by_id["#1"].dmx == 88
|
||||
assert by_id["#8"].address == 143
|
||||
assert by_id["M1"].address == 0
|
||||
assert by_id["M1"].dmx == 1
|
||||
assert by_id["M2"].address == 44
|
||||
assert by_id["M1"].address == 44
|
||||
assert by_id["M1"].dmx == 45
|
||||
assert by_id["M2"].address == 0
|
||||
assert by_id["M1"].channels == 43
|
||||
assert by_id["#3"].kind == "can"
|
||||
assert stage.output_ip == "192.168.1.228"
|
||||
@@ -54,14 +54,16 @@ def test_xchc_patch_matches_the_stage_map():
|
||||
assert by_id["#13"].x == -3.5 and by_id["#15"].x == 3.5
|
||||
assert by_id["#14"].x == 0.0 and by_id["#14"].y == -7.65
|
||||
assert by_id["#1"].address == 87 and by_id["#9"].address == 151
|
||||
assert by_id["#15"].address == 199 and by_id["M1"].address == 0
|
||||
assert by_id["M2"].address == 44 and by_id["#15"].channels == 8
|
||||
assert by_id["#15"].address == 199 and by_id["M2"].address == 0
|
||||
assert by_id["M1"].address == 44 and by_id["#15"].channels == 8
|
||||
assert by_id["M3"].address == 257 and by_id["M3"].channels == 43
|
||||
assert by_id["M3"].x == -1.75 and by_id["M3"].y == -7.65
|
||||
assert by_id["M4"].address == 300 and by_id["M4"].x == 1.75
|
||||
assert by_id["#1"].direction == 71 and by_id["#8"].direction == -72
|
||||
assert by_id["#3"].direction == 0 and by_id["#14"].direction == -179
|
||||
assert by_id["M1"].zero == 0 and by_id["M4"].zero == 0
|
||||
assert by_id["M2"].zero == -90 and by_id["M4"].zero == 0
|
||||
assert by_id["M1"].zero == 90 and by_id["M1"].pan_reverse and not by_id["M2"].pan_reverse
|
||||
assert by_id["M4"].pan_reverse and not by_id["M3"].pan_reverse
|
||||
assert stage.warnings == []
|
||||
|
||||
|
||||
@@ -94,16 +96,25 @@ def test_can_macro_functions():
|
||||
def test_mover_home_points_at_the_audience():
|
||||
channels = [0] * 43
|
||||
channels[0] = 128 # pan coarse, fine 0 → 32768, the centre of 540°
|
||||
channels[2] = 160
|
||||
channels[2] = 64
|
||||
channels[8] = 255
|
||||
channels[10] = 255 # red on the first pixel
|
||||
viewed = decode_mover(channels)
|
||||
assert viewed["pan_deg"] == 0
|
||||
assert viewed["r"] == 255
|
||||
assert viewed["beam_m"] > 2
|
||||
parked = [0] * 43
|
||||
parked[8] = 255
|
||||
assert decode_mover(parked)["beam_m"] >= 2.2
|
||||
|
||||
|
||||
def test_mover_tilt_goes_through_straight_down():
|
||||
def reach(tilt):
|
||||
channels = [0] * 43
|
||||
channels[2] = tilt
|
||||
return decode_mover(channels)["beam_m"]
|
||||
|
||||
assert reach(0) == 4.7 # forward and up
|
||||
assert abs(reach(127)) < 0.2 # a spot under the head
|
||||
assert reach(255) < -4.6 # behind the pan heading
|
||||
assert reach(64) > 0 > reach(192)
|
||||
assert lens_spin(0) == 0
|
||||
assert lens_spin(160) < 0
|
||||
assert lens_spin(230) > 0
|
||||
@@ -173,6 +184,43 @@ def test_map_definition_selects_the_channels():
|
||||
assert live["pan_deg"] == 0
|
||||
|
||||
|
||||
def test_front_movers_face_forward_at_pan_zero_and_back_at_85():
|
||||
stage = load_stage(ROOT / "stage" / "map.json")
|
||||
by_id = {fixture.id: fixture for fixture in stage.fixtures}
|
||||
|
||||
def heading(pan):
|
||||
frame = bytearray(512)
|
||||
for mover in (by_id["M1"], by_id["M2"]):
|
||||
frame[mover.address + mover.channel_names.index("Pan")] = pan
|
||||
live = view_stage(stage, {0: bytes(frame)})
|
||||
return {key: wrap_degrees(by_id[key].zero + live[key]["pan_deg"]) for key in ("M1", "M2")}
|
||||
|
||||
assert heading(0) == {"M1": 0, "M2": 0}
|
||||
back = heading(85)
|
||||
assert abs(abs(back["M1"]) - 180) <= 2 and abs(abs(back["M2"]) - 180) <= 2
|
||||
# M2 turns clockwise and M1 anticlockwise.
|
||||
assert heading(20)["M2"] > 0 > heading(20)["M1"]
|
||||
|
||||
|
||||
def test_back_movers_face_the_middle_at_pan_zero():
|
||||
stage = load_stage(ROOT / "stage" / "map.json")
|
||||
by_id = {fixture.id: fixture for fixture in stage.fixtures}
|
||||
|
||||
def heading(pan):
|
||||
frame = bytearray(512)
|
||||
for mover in (by_id["M3"], by_id["M4"]):
|
||||
frame[mover.address + mover.channel_names.index("Pan")] = pan
|
||||
live = view_stage(stage, {0: bytes(frame)})
|
||||
return {key: wrap_degrees(by_id[key].zero + live[key]["pan_deg"]) for key in ("M3", "M4")}
|
||||
|
||||
# M3 is on the left (-X) so the middle is +X, 90°. M4 mirrors it.
|
||||
assert heading(0) == {"M3": 90, "M4": -90}
|
||||
back = heading(85)
|
||||
assert abs(back["M3"] + 90) <= 2 and abs(back["M4"] - 90) <= 2
|
||||
# M3 turns clockwise and M4 anticlockwise, so both swing toward the back wall first.
|
||||
assert heading(20)["M3"] > 90 and heading(20)["M4"] < -90
|
||||
|
||||
|
||||
def test_view_reads_universe_bytes():
|
||||
stage = load_stage(ROOT / "stage" / "map.json")
|
||||
apply_show(stage, ROOT / "shows" / "xchc.qxw")
|
||||
@@ -203,7 +251,7 @@ def test_http_state_follows_artnet():
|
||||
with urlopen(f"http://127.0.0.1:{port}/api/state") as response:
|
||||
payload = json.load(response)
|
||||
assert payload["packets"] == 1
|
||||
assert payload["fixtures"]["M1"]["r"] == 255
|
||||
assert payload["fixtures"]["M2"]["r"] == 255
|
||||
with urlopen(f"http://127.0.0.1:{port}/api/stage") as response:
|
||||
described = json.load(response)
|
||||
assert described["fixtures"][0]["x"] == -3.5
|
||||
@@ -224,7 +272,7 @@ def test_heading_is_stored_in_the_map(tmp_path):
|
||||
assert saved["fixtures"]["#1"]["direction"] == 45
|
||||
assert saved["fixtures"]["#2"]["direction"] == before["#2"]["direction"]
|
||||
assert saved["fixtures"]["M1"]["zero"] == -30
|
||||
assert saved["fixtures"]["M2"]["zero"] == 0
|
||||
assert saved["fixtures"]["M2"]["zero"] == -90
|
||||
again = load_stage(target)
|
||||
by_id = {fixture.id: fixture for fixture in again.fixtures}
|
||||
assert by_id["#1"].direction == 45
|
||||
|
||||
Reference in new issue
Block a user