Add RecordSet field

This commit is contained in:
Cyrille Nofficial 2020-02-02 23:42:43 +01:00
parent 496471e61d
commit 03e18cd9db
8 changed files with 163 additions and 67 deletions

4
go.mod
View File

@ -4,9 +4,9 @@ go 1.13
require ( require (
github.com/cyrilix/robocar-base v0.0.0-20200103000136-b08c9be9a69a github.com/cyrilix/robocar-base v0.0.0-20200103000136-b08c9be9a69a
github.com/cyrilix/robocar-protobuf/go v0.0.0-20200125171436-7bf31bd564b8 github.com/cyrilix/robocar-protobuf/go v0.0.0-20200202123632-eda50f0cce3b
github.com/eclipse/paho.mqtt.golang v1.2.0 github.com/eclipse/paho.mqtt.golang v1.2.0
github.com/golang/protobuf v1.3.2 github.com/golang/protobuf v1.3.3
github.com/sirupsen/logrus v1.4.2 github.com/sirupsen/logrus v1.4.2
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa // indirect golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa // indirect
) )

6
go.sum
View File

@ -7,8 +7,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
github.com/cyrilix/robocar-base v0.0.0-20200103000136-b08c9be9a69a h1:Gznzd8APE9C+rkN3ePlKajYhgmNaCO7aJQ2WeNvoSt8= github.com/cyrilix/robocar-base v0.0.0-20200103000136-b08c9be9a69a h1:Gznzd8APE9C+rkN3ePlKajYhgmNaCO7aJQ2WeNvoSt8=
github.com/cyrilix/robocar-base v0.0.0-20200103000136-b08c9be9a69a/go.mod h1:jRQ+lJAHKkdcjwS5vt2t5LX2zM+bxX+gKffixkc2lbA= github.com/cyrilix/robocar-base v0.0.0-20200103000136-b08c9be9a69a/go.mod h1:jRQ+lJAHKkdcjwS5vt2t5LX2zM+bxX+gKffixkc2lbA=
github.com/cyrilix/robocar-protobuf/go v0.0.0-20200125171436-7bf31bd564b8 h1:8q1eiK2ii5IaztZUvW/rCaZoQMXqFR+EOP+8vUEAIgk= github.com/cyrilix/robocar-protobuf/go v0.0.0-20200202123632-eda50f0cce3b h1:HUFFtldNiyl5uHq2W2mkO7MecfgTTHi+IzdAZmr92jQ=
github.com/cyrilix/robocar-protobuf/go v0.0.0-20200125171436-7bf31bd564b8/go.mod h1:I+i6Ujns+4DmRmmUej56MItlmT4K2zlMZ35vZrHEfQ4= github.com/cyrilix/robocar-protobuf/go v0.0.0-20200202123632-eda50f0cce3b/go.mod h1:I+i6Ujns+4DmRmmUej56MItlmT4K2zlMZ35vZrHEfQ4=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v0.7.3-0.20190506211059-b20a14b54661/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v0.7.3-0.20190506211059-b20a14b54661/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
@ -23,6 +23,8 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=

View File

@ -1,29 +1,33 @@
package part package part
import ( import (
"fmt"
"github.com/cyrilix/robocar-base/service" "github.com/cyrilix/robocar-base/service"
"github.com/cyrilix/robocar-protobuf/go/events" "github.com/cyrilix/robocar-protobuf/go/events"
mqtt "github.com/eclipse/paho.mqtt.golang" mqtt "github.com/eclipse/paho.mqtt.golang"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"sync" "sync"
"time"
) )
func NewRecorder(client mqtt.Client, recordTopic, cameraTopic, steeringTopic, switchRecordTopic string) *Recorder { func NewRecorder(client mqtt.Client, recordTopic, cameraTopic, steeringTopic, switchRecordTopic string) *Recorder {
return &Recorder{ return &Recorder{
client: client, client: client,
recordTopic: recordTopic, recordTopic: recordTopic,
cameraTopic: cameraTopic, cameraTopic: cameraTopic,
steeringTopic: steeringTopic, steeringTopic: steeringTopic,
switchRecordTopic: switchRecordTopic, switchRecordTopic: switchRecordTopic,
enabled: false, enabled: false,
cancel: make(chan interface{}), idGenerator: NewDateBasedGenerator(),
recordSet: "",
cancel: make(chan interface{}),
} }
} }
type Recorder struct { type Recorder struct {
client mqtt.Client client mqtt.Client
recordTopic string recordTopic string
cameraTopic, steeringTopic, switchRecordTopic string cameraTopic, steeringTopic, switchRecordTopic string
muSteeringMsg sync.Mutex muSteeringMsg sync.Mutex
@ -32,6 +36,9 @@ type Recorder struct {
muEnabled sync.RWMutex muEnabled sync.RWMutex
enabled bool enabled bool
idGenerator IdGenerator
recordSet string
cancel chan interface { cancel chan interface {
} }
} }
@ -63,6 +70,11 @@ func (r *Recorder) onSwitchRecord(_ mqtt.Client, message mqtt.Message) {
r.muEnabled.Lock() r.muEnabled.Lock()
defer r.muEnabled.Unlock() defer r.muEnabled.Unlock()
if ! r.enabled && msg.GetEnabled() {
r.recordSet = r.idGenerator.Next()
}
r.enabled = msg.GetEnabled() r.enabled = msg.GetEnabled()
} }
@ -98,8 +110,9 @@ func (r *Recorder) onFrame(_ mqtt.Client, message mqtt.Message) {
} }
record := events.RecordMessage{ record := events.RecordMessage{
Frame: &msg, Frame: &msg,
Steering: steering, Steering: steering,
RecordSet: r.recordSet,
} }
payload, err := proto.Marshal(&record) payload, err := proto.Marshal(&record)
@ -143,3 +156,31 @@ var registerCallBacks = func(r *Recorder) {
log.Panicf("unable to register callback to %v:%v", r.switchRecordTopic, err) log.Panicf("unable to register callback to %v:%v", r.switchRecordTopic, err)
} }
} }
type IdGenerator interface {
Next() string
}
func NewDateBasedGenerator() *DateBasedGenerator {
return &DateBasedGenerator{
muCpt: sync.Mutex{},
cpt: 0,
idTemplate: "%s-%d",
start: time.Now().Format("2006011504"),
}
}
type DateBasedGenerator struct {
muCpt sync.Mutex
cpt int
idTemplate string
start string
}
func (d *DateBasedGenerator) Next() string {
d.muCpt.Lock()
defer d.muCpt.Unlock()
d.cpt += 1
return fmt.Sprintf(d.idTemplate, d.start, d.cpt)
}

View File

@ -5,13 +5,16 @@ import (
"github.com/cyrilix/robocar-protobuf/go/events" "github.com/cyrilix/robocar-protobuf/go/events"
mqtt "github.com/eclipse/paho.mqtt.golang" mqtt "github.com/eclipse/paho.mqtt.golang"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
log "github.com/sirupsen/logrus"
"io/ioutil" "io/ioutil"
"regexp"
"strings"
"sync" "sync"
"testing" "testing"
"time" "time"
) )
func TestRecorder_RecordOff(t *testing.T) { func TestRecorder_Record(t *testing.T) {
oldRegister := registerCallBacks oldRegister := registerCallBacks
oldPublish := publish oldPublish := publish
defer func() { defer func() {
@ -44,6 +47,13 @@ func TestRecorder_RecordOff(t *testing.T) {
} }
recorder := NewRecorder(nil, recordTopic, cameraTopic, steeringTopic, switchRecord) recorder := NewRecorder(nil, recordTopic, cameraTopic, steeringTopic, switchRecord)
recorder.idGenerator = &DateBasedGenerator{
muCpt: sync.Mutex{},
cpt: 0,
idTemplate: "%s-%d",
start: "record",
}
go func() { go func() {
if err := recorder.Start(); err == nil { if err := recorder.Start(); err == nil {
@ -67,9 +77,12 @@ func TestRecorder_RecordOff(t *testing.T) {
{recordMsg: &events.SwitchRecordMessage{Enabled: true}, frameMsg: nil, steeringMsg: nil, expectedRecordMsg: nil, wait: 5 * time.Millisecond}, {recordMsg: &events.SwitchRecordMessage{Enabled: true}, frameMsg: nil, steeringMsg: nil, expectedRecordMsg: nil, wait: 5 * time.Millisecond},
{recordMsg: &events.SwitchRecordMessage{Enabled: true}, frameMsg: frame1, steeringMsg: nil, expectedRecordMsg: nil, wait: 5 * time.Millisecond}, {recordMsg: &events.SwitchRecordMessage{Enabled: true}, frameMsg: frame1, steeringMsg: nil, expectedRecordMsg: nil, wait: 5 * time.Millisecond},
{recordMsg: &events.SwitchRecordMessage{Enabled: true}, frameMsg: nil, steeringMsg: &steeringRight, expectedRecordMsg: nil, wait: 5 * time.Millisecond}, {recordMsg: &events.SwitchRecordMessage{Enabled: true}, frameMsg: nil, steeringMsg: &steeringRight, expectedRecordMsg: nil, wait: 5 * time.Millisecond},
{recordMsg: &events.SwitchRecordMessage{Enabled: true}, frameMsg: frame1, steeringMsg: &steeringRight, expectedRecordMsg: &events.RecordMessage{Frame: frame1, Steering: &steeringRight}, wait: 5 * time.Millisecond}, {recordMsg: &events.SwitchRecordMessage{Enabled: true}, frameMsg: frame1, steeringMsg: &steeringRight, expectedRecordMsg: &events.RecordMessage{RecordSet: "record-1", Frame: frame1, Steering: &steeringRight}, wait: 5 * time.Millisecond},
{recordMsg: &events.SwitchRecordMessage{Enabled: true}, frameMsg: nil, steeringMsg: &steeringLeft, expectedRecordMsg: nil, wait: 5 * time.Millisecond}, {recordMsg: &events.SwitchRecordMessage{Enabled: true}, frameMsg: nil, steeringMsg: &steeringLeft, expectedRecordMsg: nil, wait: 5 * time.Millisecond},
{recordMsg: &events.SwitchRecordMessage{Enabled: true}, frameMsg: frame2, steeringMsg: &steeringLeft, expectedRecordMsg: &events.RecordMessage{Frame: frame2, Steering: &steeringLeft}, wait: 5 * time.Millisecond}, {recordMsg: &events.SwitchRecordMessage{Enabled: true}, frameMsg: frame2, steeringMsg: &steeringLeft, expectedRecordMsg: &events.RecordMessage{RecordSet: "record-1", Frame: frame2, Steering: &steeringLeft}, wait: 5 * time.Millisecond},
{recordMsg: &events.SwitchRecordMessage{Enabled: false}, frameMsg: nil, steeringMsg: nil, expectedRecordMsg: nil, wait: 5 * time.Millisecond},
{recordMsg: &events.SwitchRecordMessage{Enabled: false}, frameMsg: nil, steeringMsg: nil, expectedRecordMsg: nil, wait: 5 * time.Millisecond},
{recordMsg: &events.SwitchRecordMessage{Enabled: true}, frameMsg: frame1, steeringMsg: &steeringRight, expectedRecordMsg: &events.RecordMessage{RecordSet: "record-2", Frame: frame1, Steering: &steeringLeft}, wait: 5 * time.Millisecond},
} }
for _, c := range cases { for _, c := range cases {
@ -113,3 +126,33 @@ func loadImage(t *testing.T, imgPath string, id string) *events.FrameMessage {
} }
return msg return msg
} }
func TestDateBasedGenerator_Next(t *testing.T) {
log.SetLevel(log.InfoLevel)
expectedFmt := "[0-9]{4}[01][0-9][0-2][0-9][0-5][0-9]-[0-9]+"
r, err := regexp.Compile(expectedFmt)
if err != nil {
t.Fatalf("unable to compile expected regex: %v", err)
}
d := NewDateBasedGenerator()
id1 := d.Next()
log.Debugf("first id: %v", id1)
if !r.MatchString(id1) {
t.Errorf("Unexpected id format: %v, wants: %s", id1, expectedFmt)
}
id2 := d.Next()
log.Debugf("2nd id: %v", id2)
if strings.Split(id1, "-")[0] != strings.Split(id2, "-")[0] {
t.Errorf("ids are differentt prefixes: %v - %v", strings.Split(id1, "-")[0], strings.Split(id2, "-")[0])
}
if strings.Split(id1, "-")[1] != "1" {
t.Errorf("unexpected suffix: %v, wants %v", strings.Split(id1, "-")[1], "1")
}
if strings.Split(id2, "-")[1] != "2" {
t.Errorf("unexpected suffix: %v, wants %v", strings.Split(id2, "-")[1], "2")
}
}

View File

@ -675,6 +675,7 @@ func (m *Ellipse) GetConfidence() float32 {
type RecordMessage struct { type RecordMessage struct {
Frame *FrameMessage `protobuf:"bytes,1,opt,name=frame,proto3" json:"frame,omitempty"` Frame *FrameMessage `protobuf:"bytes,1,opt,name=frame,proto3" json:"frame,omitempty"`
Steering *SteeringMessage `protobuf:"bytes,2,opt,name=steering,proto3" json:"steering,omitempty"` Steering *SteeringMessage `protobuf:"bytes,2,opt,name=steering,proto3" json:"steering,omitempty"`
RecordSet string `protobuf:"bytes,3,opt,name=recordSet,proto3" json:"recordSet,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
@ -719,6 +720,13 @@ func (m *RecordMessage) GetSteering() *SteeringMessage {
return nil return nil
} }
func (m *RecordMessage) GetRecordSet() string {
if m != nil {
return m.RecordSet
}
return ""
}
func init() { func init() {
proto.RegisterEnum("robocar.events.DriveMode", DriveMode_name, DriveMode_value) proto.RegisterEnum("robocar.events.DriveMode", DriveMode_name, DriveMode_value)
proto.RegisterEnum("robocar.events.TypeObject", TypeObject_name, TypeObject_value) proto.RegisterEnum("robocar.events.TypeObject", TypeObject_name, TypeObject_value)
@ -739,49 +747,49 @@ func init() {
func init() { proto.RegisterFile("events/events.proto", fileDescriptor_8ec31f2d2a3db598) } func init() { proto.RegisterFile("events/events.proto", fileDescriptor_8ec31f2d2a3db598) }
var fileDescriptor_8ec31f2d2a3db598 = []byte{ var fileDescriptor_8ec31f2d2a3db598 = []byte{
// 689 bytes of a gzipped FileDescriptorProto // 696 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x4b, 0x6f, 0xd3, 0x5a, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x5b, 0x6f, 0x12, 0x51,
0x10, 0xee, 0x71, 0xe2, 0x3c, 0x26, 0xbd, 0xb9, 0xd1, 0xe9, 0xbd, 0xbd, 0xbe, 0x11, 0xa2, 0x95, 0x10, 0xee, 0x2e, 0x2c, 0xb0, 0x43, 0x45, 0x72, 0xaa, 0x75, 0x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0xa7, 0x9f, 0x1f, 0x06, 0x00, 0x5f, 0xf9, 0x5c, 0x52, 0x22, 0x87, 0x25, 0x79, 0xa2, 0x5f, 0xfd, 0x0a, 0x00, 0x00, 0xff, 0xff,
0x00, 0x5d, 0x6e, 0x23, 0x4e, 0x3d, 0x06, 0x00, 0x00,
} }

View File

@ -393,7 +393,7 @@ func (p *Buffer) Bytes() []byte { return p.buf }
// than relying on this API. // than relying on this API.
// //
// If deterministic serialization is requested, map entries will be sorted // If deterministic serialization is requested, map entries will be sorted
// by keys in lexographical order. This is an implementation detail and // by keys in lexicographical order. This is an implementation detail and
// subject to change. // subject to change.
func (p *Buffer) SetDeterministic(deterministic bool) { func (p *Buffer) SetDeterministic(deterministic bool) {
p.deterministic = deterministic p.deterministic = deterministic

View File

@ -456,6 +456,8 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error {
return nil return nil
} }
var textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
// writeAny writes an arbitrary field. // writeAny writes an arbitrary field.
func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error {
v = reflect.Indirect(v) v = reflect.Indirect(v)
@ -519,8 +521,8 @@ func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Propert
// mutating this value. // mutating this value.
v = v.Addr() v = v.Addr()
} }
if etm, ok := v.Interface().(encoding.TextMarshaler); ok { if v.Type().Implements(textMarshalerType) {
text, err := etm.MarshalText() text, err := v.Interface().(encoding.TextMarshaler).MarshalText()
if err != nil { if err != nil {
return err return err
} }

4
vendor/modules.txt vendored
View File

@ -2,12 +2,12 @@
github.com/cyrilix/robocar-base/cli github.com/cyrilix/robocar-base/cli
github.com/cyrilix/robocar-base/service github.com/cyrilix/robocar-base/service
github.com/cyrilix/robocar-base/testtools github.com/cyrilix/robocar-base/testtools
# github.com/cyrilix/robocar-protobuf/go v0.0.0-20200125171436-7bf31bd564b8 # github.com/cyrilix/robocar-protobuf/go v0.0.0-20200202123632-eda50f0cce3b
github.com/cyrilix/robocar-protobuf/go/events github.com/cyrilix/robocar-protobuf/go/events
# github.com/eclipse/paho.mqtt.golang v1.2.0 # github.com/eclipse/paho.mqtt.golang v1.2.0
github.com/eclipse/paho.mqtt.golang github.com/eclipse/paho.mqtt.golang
github.com/eclipse/paho.mqtt.golang/packets github.com/eclipse/paho.mqtt.golang/packets
# github.com/golang/protobuf v1.3.2 # github.com/golang/protobuf v1.3.3
github.com/golang/protobuf/proto github.com/golang/protobuf/proto
github.com/golang/protobuf/ptypes/timestamp github.com/golang/protobuf/ptypes/timestamp
# github.com/konsorten/go-windows-terminal-sequences v1.0.1 # github.com/konsorten/go-windows-terminal-sequences v1.0.1