mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-11-17 04:02:21 -05:00
cleanupses
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
install_self_update_support() {
|
||||
local quoted_repo_root
|
||||
printf -v quoted_repo_root '%q' "$REPO_ROOT"
|
||||
printf 'ROVERD_REPO_DIR=%s\n' "$quoted_repo_root" > /etc/roverd-update.env
|
||||
chmod 0600 /etc/roverd-update.env
|
||||
install -D -o root -g root -m 0755 rover/bin/roverd-self-update.sh /usr/local/sbin/roverd-self-update.new
|
||||
# Keep the running updater on its original inode until it exits.
|
||||
mv -f /usr/local/sbin/roverd-self-update.new /usr/local/sbin/roverd-self-update
|
||||
log "Registered update checkout at $REPO_ROOT"
|
||||
}
|
||||
@@ -30,7 +30,7 @@ with open(path, 'w') as f:
|
||||
PYCONFIG
|
||||
/usr/local/bin/roverd -config /etc/roverd.json.new -check-config
|
||||
mv /etc/roverd.json.new /etc/roverd.json
|
||||
echo 'Set name, serverUrl, devices, and enabled profiles in /etc/roverd.json before starting roverd.'
|
||||
echo 'Initial configuration created. Configure devices and enabled profiles through Fleet Management.'
|
||||
fi
|
||||
install -m 0644 rover/systemd/roverd.service /etc/systemd/system/roverd.service
|
||||
# Use this checkout directly for catalogs and command resources.
|
||||
@@ -38,9 +38,13 @@ install -d /etc/systemd/system/roverd.service.d
|
||||
printf '[Service]\nExecStart=\nExecStart=/usr/local/bin/roverd -config /etc/roverd.json -repo "%s"\n' "$REPO_ROOT" > /etc/systemd/system/roverd.service.d/repository.conf
|
||||
install -m 0755 rover/bin/chromegtts-daemon.py /usr/local/bin/chromegtts-daemon
|
||||
bash rover/bin/setup-tts.sh
|
||||
log() { echo "$*"; }
|
||||
source rover/install/self_update.sh
|
||||
install_self_update_support
|
||||
printf -v quoted_repo_root '%q' "$REPO_ROOT"
|
||||
printf 'ROVERD_REPO_DIR=%s\n' "$quoted_repo_root" > /etc/roverd-update.env
|
||||
chmod 0600 /etc/roverd-update.env
|
||||
install -D -o root -g root -m 0755 rover/bin/roverd-self-update.sh /usr/local/sbin/roverd-self-update.new
|
||||
# Keep the running updater on its original inode until it exits.
|
||||
mv -f /usr/local/sbin/roverd-self-update.new /usr/local/sbin/roverd-self-update
|
||||
echo "Registered update checkout at $REPO_ROOT"
|
||||
systemctl daemon-reload
|
||||
systemctl enable roverd.service
|
||||
echo 'Installation complete; caller can now restart roverd.'
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
if ! command -v ffmpeg >/dev/null || ! command -v arecord >/dev/null; then
|
||||
apt-get update && apt-get install -y ffmpeg alsa-utils
|
||||
fi
|
||||
run: &run |
|
||||
run: |
|
||||
exec ffmpeg -nostdin -f alsa -ar "$ROVER_AUDIO_SAMPLE_RATE" -ac "$ROVER_AUDIO_CHANNELS" -i "$ROVER_AUDIO_INPUT_DEVICE" -c:a libopus -b:a "$ROVER_AUDIO_BITRATE" -f rtsp -rtsp_transport tcp "$ROVER_AUDIO_PUBLISH_URL"
|
||||
- id: aiy
|
||||
name: Google AIY Voice HAT microphone
|
||||
@@ -33,4 +33,5 @@
|
||||
if ! command -v ffmpeg >/dev/null || ! command -v aplay >/dev/null; then
|
||||
apt-get update && apt-get install -y ffmpeg alsa-utils
|
||||
fi
|
||||
run: *run
|
||||
run: |
|
||||
exec ffmpeg -nostdin -f alsa -ar "$ROVER_AUDIO_SAMPLE_RATE" -ac "$ROVER_AUDIO_CHANNELS" -i "$ROVER_AUDIO_INPUT_DEVICE" -c:a libopus -b:a "$ROVER_AUDIO_BITRATE" -f rtsp -rtsp_transport tcp "$ROVER_AUDIO_PUBLISH_URL"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
if ! command -v ffmpeg >/dev/null || ! command -v aplay >/dev/null; then
|
||||
apt-get update && apt-get install -y ffmpeg alsa-utils
|
||||
fi
|
||||
run: &run |
|
||||
run: |
|
||||
filters=()
|
||||
if [ "$ROVER_AUDIO_NORMALIZE" = true ]; then filters=(-af "$ROVER_AUDIO_NORMALIZE_FILTER"); fi
|
||||
exec ffmpeg -nostdin -rtsp_transport tcp -i "$ROVER_AUDIO_PLAYBACK_URL" -vn "${filters[@]}" -f alsa "$ROVER_AUDIO_OUTPUT_DEVICE"
|
||||
@@ -35,4 +35,7 @@
|
||||
if ! command -v ffmpeg >/dev/null || ! command -v aplay >/dev/null; then
|
||||
apt-get update && apt-get install -y ffmpeg alsa-utils
|
||||
fi
|
||||
run: *run
|
||||
run: |
|
||||
filters=()
|
||||
if [ "$ROVER_AUDIO_NORMALIZE" = true ]; then filters=(-af "$ROVER_AUDIO_NORMALIZE_FILTER"); fi
|
||||
exec ffmpeg -nostdin -rtsp_transport tcp -i "$ROVER_AUDIO_PLAYBACK_URL" -vn "${filters[@]}" -f alsa "$ROVER_AUDIO_OUTPUT_DEVICE"
|
||||
|
||||
@@ -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