debian-laptop

This commit is contained in:
legop3
2026-06-30 23:34:05 -04:00
parent 37b8f71944
commit 282cb3e135
15 changed files with 504 additions and 35 deletions
+10 -6
View File
@@ -3,18 +3,22 @@ GOOS ?= linux
GOARCH ?= arm
GOARM ?= 6
.PHONY: build pi-build dummy clean
.PHONY: build pi-build debian-laptop dummy verifier-tools clean
build:
go build -o $(BIN_DIR)/roverd ./cmd/roverd
build: pi-build debian-laptop dummy
pi-build:
GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM) go build -trimpath -ldflags="-s -w" -o $(BIN_DIR)/roverd ./cmd/roverd
verifier-tools:
GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM) go build -trimpath -ldflags="-s -w" -o $(BIN_DIR)/servoverifier ./cmd/servoverifier
GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM) go build -trimpath -ldflags="-s -w" -o $(BIN_DIR)/hornverifier ./cmd/hornverifier
pi-build: verifier-tools
GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM) go build -trimpath -ldflags="-s -w" -o $(BIN_DIR)/roverd ./cmd/roverd
debian-laptop:
GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -tags debian_laptop -o $(BIN_DIR)/roverd-debian-laptop ./cmd/roverd
dummy:
GOOS=linux GOARCH=amd64 go build -tags dummy -o $(BIN_DIR)/roverd-dummy ./cmd/roverd
clean:
rm -f $(BIN_DIR)/roverd $(BIN_DIR)/servoverifier $(BIN_DIR)/hornverifier
rm -f $(BIN_DIR)/roverd $(BIN_DIR)/roverd-debian-laptop $(BIN_DIR)/roverd-dummy $(BIN_DIR)/servoverifier $(BIN_DIR)/hornverifier
+1 -1
View File
@@ -1,4 +1,4 @@
//go:build !dummy
//go:build !dummy && !debian_laptop
package roverd
+25
View File
@@ -0,0 +1,25 @@
//go:build debian_laptop
package roverd
import (
"context"
"fmt"
"log"
)
type BRCPulser struct{}
func NewBRCPulser(_ BRCConfig, _ *log.Logger) (*BRCPulser, error) {
/*
The first Debian laptop profile keeps BRC disabled instead of pretending a
USB serial modem-control line has already been selected and tested. The
config can set brc.gpioPin: -1 to skip construction entirely; if someone
enables it, fail loudly so the rover does not silently miss wake pulses.
*/
return nil, fmt.Errorf("brc is not supported in the debian-laptop build yet")
}
func (b *BRCPulser) Close() {}
func (b *BRCPulser) Start(ctx context.Context) {}
+1 -1
View File
@@ -1,4 +1,4 @@
//go:build !dummy
//go:build !dummy && !debian_laptop
package roverd
+38
View File
@@ -0,0 +1,38 @@
//go:build debian_laptop
package roverd
import (
"fmt"
"log"
)
type CameraServo struct{}
func NewCameraServo(_ CameraServoConfig, _ *log.Logger) (*CameraServo, error) {
/*
The Debian laptop profile starts with the laptop's built-in webcam and no
Pi PWM servo. If a laptop rover eventually grows an external servo board,
it should get its own implementation instead of reusing Raspberry Pi GPIO
assumptions.
*/
return nil, fmt.Errorf("camera servo not supported in the debian-laptop build")
}
func (c *CameraServo) Close() {}
func (c *CameraServo) SetAngle(angle float64) error {
return fmt.Errorf("camera servo disabled")
}
func (c *CameraServo) Nudge(delta float64) error {
return fmt.Errorf("camera servo disabled")
}
func (c *CameraServo) SetPulseWidth(micros int) error {
return fmt.Errorf("camera servo disabled")
}
func (c *CameraServo) CurrentAngle() float64 {
return 0
}
+1 -1
View File
@@ -1,4 +1,4 @@
//go:build !dummy
//go:build !dummy && !debian_laptop
package roverd
+32
View File
@@ -0,0 +1,32 @@
//go:build debian_laptop
package roverd
import (
"fmt"
"log"
)
type GPIOToggle struct {
name string
}
func NewGPIOToggle(name string, _ GPIOToggleConfig, _ *log.Logger) (*GPIOToggle, error) {
/*
A Debian laptop has no Raspberry Pi GPIO character-device contract for
headlights or lasers. Returning an error when enabled makes bad laptop
configs fail during startup instead of advertising controls that cannot
change any hardware.
*/
return nil, fmt.Errorf("%s not supported in the debian-laptop build", name)
}
func (g *GPIOToggle) Close() {}
func (g *GPIOToggle) HandleAction(action string) error {
return fmt.Errorf("%s not supported in the debian-laptop build", g.name)
}
func (g *GPIOToggle) On() bool {
return false
}
@@ -0,0 +1,84 @@
# Sample configuration for roverd on a Debian laptop rover.
name: laptop-rover
description: "Debian laptop rover using USB serial, webcam, mic, and speakers."
color: "#4DB6AC"
serverUrl: ws://control-server.local:8080/rover
serial:
device: /dev/ttyUSB0
baud: 115200
# BRC is disabled in the first Debian laptop profile because USB serial
# RTS/DTR wake-pulse support needs adapter-specific testing before it should be
# trusted to keep a Roomba awake.
brc:
gpioPin: -1
battery:
full: 2068
warn: 1700
urgent: 1650
maxWheelSpeed: 350
media:
publishPort: 9000
manage: true
healthUrl: ""
healthInterval: 30s
video:
enabled: true
service: debian-laptop-video-publisher.service
publisher: debian-laptop-v4l2
device: /dev/video0
width: 640
height: 480
fps: 30
bitrate: 2000000
inverted: false
audioCapture:
enabled: true
service: audio-only-publisher.service
device: default
sampleRate: 48000
channels: 2
bitrate: 510000
audioPlayback:
enabled: true
service: audio-forward-listener.service
device: default
normalize: true
cameraServo:
enabled: false
audio:
ttsEnabled: false
horn:
enabled: false
headlight:
enabled: false
laser:
enabled: false
autoSideBrush:
enabled: true
speed: 20
private:
enabled: false
safety:
speedLimitEnabled: false
speedLimitMaxWheelSpeed: 250
hardOvercurrentEnabled: false
overcurrentStopMs: 300
hardBumpEnabled: false
bumpBackoffSpeed: 250
bumpBackoffMs: 350
cliffEnabled: false
cliffBackoffSpeed: 250
cliffBackoffMs: 500
triggerCooldownMs: 800