Skip to content

Commit aa6da69

Browse files
committed
understand when player incorrectly provides altitude in wrong order of magnitude
1 parent 6b5172b commit aa6da69

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ run:
134134

135135
.PHONY: test
136136
test: generate
137-
$(BUILD_VARS) $(GO) run gotest.tools/gotestsum -- $(BUILD_FLAGS) ./...
137+
$(BUILD_VARS) $(GO) run gotest.tools/gotestsum -- $(BUILD_FLAGS) $(TEST_FLAGS) ./...
138138

139139
.PHONY: benchmark-whisper
140140
benchmark-whisper: whisper

docs/CONTRIBUTING.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,12 @@ Wow, that was easy!
153153
154154
## Test
155155
156-
The canonical way to run the unit tests is by running `make test`. This can run tests for code that uses CGO. **This is the gate used for PR checks.**
156+
The canonical way to run the unit tests is by running `make test`. This can run tests for code that uses CGO. **This is the gate used for PR checks.** You can pass additional flags to `go test` using TEST_FLAGS. For example, `TEST_FLAGS=-parallel=1 make test` will run the tests without parallelism (1 test worker), which can make the logs for a failed test easier to understand.
157157
158158
I have made an effort to structure packages so that CGO is never imported directly or indirectly within packages that aren't directly related to the Speech-To-Text and Text-To-Speech models. This means that most tests can be run though Visual Studio Code without the complexity and performance hit of CGO. **This is the easiest way to test and debug during development.**
159159
160+
161+
160162
## Benchmark
161163
162164
SkyEye's performance bottleneck is speech recognition. A small benchmark suite is provided which may be useful to test different speech recognition models or hardware acceleration. Run it with

pkg/parser/declare_test.go

+13-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func TestParserDeclare(t *testing.T) {
217217
},
218218
},
219219
{
220-
text: "ANYFACE, DAGGER 1-1, DECLARE, BULZYE 01162, INJELS 18.",
220+
text: "ANYFACE, DAGGER 1-1, DECLARE, BULZYE 01162",
221221
expected: &brevity.DeclareRequest{
222222
Callsign: "dagger 1 1",
223223
Bullseye: *brevity.NewBullseye(
@@ -227,6 +227,18 @@ func TestParserDeclare(t *testing.T) {
227227
Track: brevity.UnknownDirection,
228228
},
229229
},
230+
{
231+
text: "ANYFACE, DAGGER 1-1, DECLARE, BULZYE 011 62, INJELS 18.",
232+
expected: &brevity.DeclareRequest{
233+
Callsign: "dagger 1 1",
234+
Bullseye: *brevity.NewBullseye(
235+
bearings.NewMagneticBearing(11*unit.Degree),
236+
62*unit.NauticalMile,
237+
),
238+
Altitude: 18000 * unit.Foot,
239+
Track: brevity.UnknownDirection,
240+
},
241+
},
230242
{
231243
text: "anyface, 140, declare BULLSEYE 058146",
232244
expected: &brevity.DeclareRequest{

pkg/parser/spatial.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,13 @@ func parseAltitude(scanner *bufio.Scanner) (unit.Length, bool) {
122122
if !ok {
123123
return 0, false
124124
}
125-
return unit.Length(d) * unit.Foot, true
125+
126+
altitude := unit.Length(d) * unit.Foot
127+
// Values below 100 are likely a player incorrectly saying "angels XX" intead of thousands of feet.
128+
if d < 100 {
129+
altitude = altitude * 1000
130+
}
131+
return altitude, true
126132
}
127133

128134
func parseTrack(scanner *bufio.Scanner) brevity.Track {

0 commit comments

Comments
 (0)