mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-11-17 04:02:21 -05:00
cleanupses
This commit is contained in:
@@ -27,7 +27,7 @@ type sensorMessage struct {
|
||||
|
||||
// hostStatsMessage is intentionally separate from sensorMessage because sensor
|
||||
// frames are raw Roomba Open Interface data, while these values describe the
|
||||
// Raspberry Pi host that is running roverd.
|
||||
// Linux host that is running roverd.
|
||||
type hostStatsMessage struct {
|
||||
Type string `json:"type"`
|
||||
Timestamp int64 `json:"ts"`
|
||||
@@ -66,10 +66,6 @@ type sensorStreamPayload struct {
|
||||
Enable bool `json:"enable"`
|
||||
}
|
||||
|
||||
type mediaCommand struct {
|
||||
Action string `json:"action"`
|
||||
}
|
||||
|
||||
type servoPayload struct {
|
||||
Angle *float64 `json:"angle,omitempty"`
|
||||
Nudge *float64 `json:"nudge,omitempty"`
|
||||
@@ -122,8 +118,6 @@ type rebootPayload struct {
|
||||
DelayMs int `json:"delayMs,omitempty"`
|
||||
}
|
||||
|
||||
type updatePayload struct{}
|
||||
|
||||
type ackMessage struct {
|
||||
Type string `json:"type"`
|
||||
ID string `json:"id"`
|
||||
|
||||
+1
-1
@@ -8,6 +8,7 @@ require (
|
||||
github.com/stianeikeland/go-rpio/v4 v4.6.0
|
||||
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07
|
||||
github.com/warthog618/go-gpiocdev v0.9.1
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
nhooyr.io/websocket v1.8.17
|
||||
)
|
||||
|
||||
@@ -18,5 +19,4 @@ require (
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
|
||||
golang.org/x/sys v0.38.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@@ -35,7 +35,6 @@ type managementCommand struct {
|
||||
Reboot *rebootPayload `json:"reboot"`
|
||||
Category string `json:"category"`
|
||||
Profile *MediaProfile `json:"profile"`
|
||||
Media *mediaCommand `json:"media"`
|
||||
}
|
||||
|
||||
func NewManagementClient(cfg *Config, path string, events chan RoverEvent, logger *log.Logger, restart func()) *ManagementClient {
|
||||
@@ -163,12 +162,6 @@ func (m *ManagementClient) execute(ctx context.Context, command managementComman
|
||||
}
|
||||
return m.restart, nil
|
||||
}
|
||||
if command.Type == "media" {
|
||||
if m.media == nil || command.Media == nil {
|
||||
return nil, fmt.Errorf("media supervisor unavailable")
|
||||
}
|
||||
return nil, m.media.HandleAction(ctx, command.Media.Action)
|
||||
}
|
||||
var config *Config
|
||||
var err error
|
||||
switch command.Type {
|
||||
|
||||
@@ -91,13 +91,6 @@ func (m *MediaSupervisor) selection(category string) (bool, string) {
|
||||
return m.cfg.Media.AudioPlayback.Enabled, m.cfg.Media.AudioPlayback.Profile
|
||||
}
|
||||
}
|
||||
func (m *MediaSupervisor) HandleAction(_ context.Context, action string) error {
|
||||
if action != "stop" {
|
||||
return fmt.Errorf("save configuration to start or restart media")
|
||||
}
|
||||
m.Stop()
|
||||
return nil
|
||||
}
|
||||
func (m *MediaSupervisor) supervise(ctx context.Context, category, id string) {
|
||||
var profile *MediaProfile
|
||||
for _, p := range m.profiles[category] {
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
{
|
||||
"piGpio": {
|
||||
"enabled": false,
|
||||
"brc": {
|
||||
"enabled": true,
|
||||
"gpioPin": 4,
|
||||
"gpioChip": "gpiochip0",
|
||||
"pulseEvery": "1m",
|
||||
"pulseWidth": "1s"
|
||||
},
|
||||
"cameraServo": {
|
||||
"enabled": false,
|
||||
"pin": 19,
|
||||
"freqHz": 50,
|
||||
"cycleLen": 20000,
|
||||
"minPulseUs": 900,
|
||||
"maxPulseUs": 2100,
|
||||
"minAngle": -15,
|
||||
"maxAngle": 30,
|
||||
"homeAngle": 0,
|
||||
"nudgeDegrees": 2,
|
||||
"allowRawPulse": false,
|
||||
"invert": false
|
||||
},
|
||||
"headlight": {
|
||||
"enabled": true,
|
||||
"gpioPin": 22,
|
||||
"gpioChip": "gpiochip0",
|
||||
"initialOn": false,
|
||||
"activeLow": true
|
||||
},
|
||||
"laser": {
|
||||
"enabled": false,
|
||||
"gpioPin": 27,
|
||||
"gpioChip": "gpiochip0",
|
||||
"initialOn": false,
|
||||
"activeLow": false
|
||||
}
|
||||
},
|
||||
"name": "roomba-alpha",
|
||||
"description": "Loves corners, hates cords.",
|
||||
"color": "",
|
||||
"serverUrl": "ws://control-server.local:8080/rover",
|
||||
"serial": {
|
||||
"device": "/dev/ttyAMA0",
|
||||
"baud": 115200
|
||||
},
|
||||
"battery": {
|
||||
"full": 2068,
|
||||
"warn": 1700,
|
||||
"urgent": 1650
|
||||
},
|
||||
"maxWheelSpeed": 350,
|
||||
"media": {
|
||||
"rtspPort": 8554,
|
||||
"video": {
|
||||
"profile": "rpicam",
|
||||
"enabled": true,
|
||||
"device": "/dev/video0",
|
||||
"inputFormat": "mjpeg",
|
||||
"width": 640,
|
||||
"height": 480,
|
||||
"fps": 30,
|
||||
"bitrate": 2000000,
|
||||
"inverted": true,
|
||||
"sensorMode": "1296:972"
|
||||
},
|
||||
"audioCapture": {
|
||||
"profile": "alsa",
|
||||
"enabled": false,
|
||||
"sampleRate": 48000,
|
||||
"channels": 2,
|
||||
"bitrate": 510000
|
||||
},
|
||||
"audioPlayback": {
|
||||
"profile": "alsa",
|
||||
"enabled": true,
|
||||
"normalize": true,
|
||||
"normalizeFilter": "dynaudnorm=f=75:g=15:m=10:p=0.9,alimiter=limit=0.85:level=disabled"
|
||||
}
|
||||
},
|
||||
"audio": {
|
||||
"inputDevice": "hw:0,0",
|
||||
"outputDevice": "hw:0,0",
|
||||
"mixerCard": "0",
|
||||
"outputSampleRate": 48000,
|
||||
"outputChannels": 2,
|
||||
"ttsEnabled": false,
|
||||
"defaultEngine": "flite",
|
||||
"defaultVoice": "rms",
|
||||
"defaultPitch": 50
|
||||
},
|
||||
"horn": {
|
||||
"enabled": false,
|
||||
"volume": 0.25,
|
||||
"sampleRate": 48000,
|
||||
"channels": 1,
|
||||
"sineGain": 1,
|
||||
"sawGain": 0.7,
|
||||
"maxDuration": "10s"
|
||||
},
|
||||
"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,
|
||||
"virtualWallEnabled": true,
|
||||
"virtualWallBackoffSpeed": 250,
|
||||
"virtualWallBackoffMs": 500,
|
||||
"triggerCooldownMs": 800
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
{
|
||||
"piGpio": {
|
||||
"enabled": false,
|
||||
"brc": {
|
||||
"enabled": true,
|
||||
"gpioPin": 4,
|
||||
"gpioChip": "gpiochip0",
|
||||
"pulseEvery": "1m",
|
||||
"pulseWidth": "1s"
|
||||
},
|
||||
"cameraServo": {
|
||||
"enabled": false,
|
||||
"pin": 12,
|
||||
"freqHz": 50,
|
||||
"cycleLen": 20000,
|
||||
"minPulseUs": 900,
|
||||
"maxPulseUs": 2100,
|
||||
"minAngle": -15,
|
||||
"maxAngle": 30,
|
||||
"homeAngle": 0,
|
||||
"nudgeDegrees": 2,
|
||||
"allowRawPulse": false,
|
||||
"invert": false
|
||||
},
|
||||
"headlight": {
|
||||
"enabled": true,
|
||||
"gpioPin": 22,
|
||||
"gpioChip": "gpiochip0",
|
||||
"initialOn": false,
|
||||
"activeLow": true
|
||||
},
|
||||
"laser": {
|
||||
"enabled": false,
|
||||
"gpioPin": 27,
|
||||
"gpioChip": "gpiochip0",
|
||||
"initialOn": false,
|
||||
"activeLow": false
|
||||
}
|
||||
},
|
||||
"name": "roomba-alpha",
|
||||
"description": "Loves corners, hates cords.",
|
||||
"color": "#4DB6AC",
|
||||
"serverUrl": "ws://control-server.local:8080/rover",
|
||||
"serial": {
|
||||
"device": "/dev/ttyAMA0",
|
||||
"baud": 115200
|
||||
},
|
||||
"battery": {
|
||||
"full": 2068,
|
||||
"warn": 1700,
|
||||
"urgent": 1650
|
||||
},
|
||||
"maxWheelSpeed": 350,
|
||||
"media": {
|
||||
"rtspPort": 8554,
|
||||
"video": {
|
||||
"profile": "rpicam",
|
||||
"enabled": true,
|
||||
"device": "/dev/video0",
|
||||
"inputFormat": "mjpeg",
|
||||
"width": 640,
|
||||
"height": 480,
|
||||
"fps": 30,
|
||||
"bitrate": 2000000,
|
||||
"inverted": true,
|
||||
"sensorMode": "1296:972"
|
||||
},
|
||||
"audioCapture": {
|
||||
"profile": "alsa",
|
||||
"enabled": false,
|
||||
"sampleRate": 48000,
|
||||
"channels": 2,
|
||||
"bitrate": 510000
|
||||
},
|
||||
"audioPlayback": {
|
||||
"profile": "alsa",
|
||||
"enabled": true,
|
||||
"normalize": true,
|
||||
"normalizeFilter": "dynaudnorm=f=75:g=15:m=10:p=0.9,alimiter=limit=0.85:level=disabled"
|
||||
}
|
||||
},
|
||||
"audio": {
|
||||
"inputDevice": "hw:0,0",
|
||||
"outputDevice": "hw:0,0",
|
||||
"mixerCard": "0",
|
||||
"outputSampleRate": 48000,
|
||||
"outputChannels": 2,
|
||||
"ttsEnabled": false,
|
||||
"defaultEngine": "flite",
|
||||
"defaultVoice": "rms",
|
||||
"defaultPitch": 50
|
||||
},
|
||||
"horn": {
|
||||
"enabled": false,
|
||||
"volume": 0.25,
|
||||
"sampleRate": 48000,
|
||||
"channels": 1,
|
||||
"sineGain": 1,
|
||||
"sawGain": 0.7,
|
||||
"maxDuration": "1.2s"
|
||||
},
|
||||
"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,
|
||||
"virtualWallEnabled": true,
|
||||
"virtualWallBackoffSpeed": 250,
|
||||
"virtualWallBackoffMs": 500,
|
||||
"triggerCooldownMs": 800
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
{
|
||||
"piGpio": {
|
||||
"enabled": false,
|
||||
"brc": {
|
||||
"enabled": false,
|
||||
"gpioPin": 4,
|
||||
"gpioChip": "gpiochip0",
|
||||
"pulseEvery": "1m0s",
|
||||
"pulseWidth": "1s"
|
||||
},
|
||||
"cameraServo": {
|
||||
"enabled": false,
|
||||
"pin": 12,
|
||||
"freqHz": 50,
|
||||
"cycleLen": 20000,
|
||||
"minPulseUs": 900,
|
||||
"maxPulseUs": 2100,
|
||||
"minAngle": -15,
|
||||
"maxAngle": 30,
|
||||
"homeAngle": 0,
|
||||
"nudgeDegrees": 2,
|
||||
"allowRawPulse": false,
|
||||
"invert": false
|
||||
},
|
||||
"headlight": {
|
||||
"enabled": false,
|
||||
"gpioPin": 22,
|
||||
"gpioChip": "gpiochip0",
|
||||
"initialOn": false,
|
||||
"activeLow": true
|
||||
},
|
||||
"laser": {
|
||||
"enabled": false,
|
||||
"gpioPin": 27,
|
||||
"gpioChip": "gpiochip0",
|
||||
"initialOn": false,
|
||||
"activeLow": false
|
||||
}
|
||||
},
|
||||
"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
|
||||
},
|
||||
"battery": {
|
||||
"full": 2068,
|
||||
"warn": 1700,
|
||||
"urgent": 1650
|
||||
},
|
||||
"maxWheelSpeed": 350,
|
||||
"media": {
|
||||
"rtspPort": 8554,
|
||||
"video": {
|
||||
"profile": "v4l2",
|
||||
"enabled": true,
|
||||
"device": "/dev/video0",
|
||||
"inputFormat": "mjpeg",
|
||||
"width": 640,
|
||||
"height": 480,
|
||||
"fps": 30,
|
||||
"bitrate": 2000000,
|
||||
"inverted": false,
|
||||
"sensorMode": ""
|
||||
},
|
||||
"audioCapture": {
|
||||
"profile": "alsa",
|
||||
"enabled": true,
|
||||
"sampleRate": 48000,
|
||||
"channels": 2,
|
||||
"bitrate": 510000
|
||||
},
|
||||
"audioPlayback": {
|
||||
"profile": "alsa",
|
||||
"enabled": true,
|
||||
"normalize": true,
|
||||
"normalizeFilter": "dynaudnorm=f=75:g=15:m=10:p=0.9,alimiter=limit=0.85:level=disabled"
|
||||
}
|
||||
},
|
||||
"audio": {
|
||||
"inputDevice": "hw:0,0",
|
||||
"outputDevice": "hw:0,0",
|
||||
"mixerCard": "0",
|
||||
"outputSampleRate": 48000,
|
||||
"outputChannels": 2,
|
||||
"ttsEnabled": true,
|
||||
"defaultEngine": "flite",
|
||||
"defaultVoice": "rms",
|
||||
"defaultPitch": 50
|
||||
},
|
||||
"horn": {
|
||||
"enabled": true,
|
||||
"volume": 0.25,
|
||||
"sampleRate": 48000,
|
||||
"channels": 1,
|
||||
"sineGain": 1,
|
||||
"sawGain": 0.7,
|
||||
"maxDuration": "10s"
|
||||
},
|
||||
"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,
|
||||
"virtualWallEnabled": true,
|
||||
"virtualWallBackoffSpeed": 250,
|
||||
"virtualWallBackoffMs": 500,
|
||||
"triggerCooldownMs": 800
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user