Merge branch 'develop' into frank-dev2

This commit is contained in:
unknown 2021-01-07 20:00:42 +01:00
commit e74f0fd895
5 changed files with 37 additions and 9 deletions

View File

@ -94,9 +94,9 @@ func replaySanitizeFunc() flow.MapFunc {
}
sd.Timestamp = sd.Servertime.Add(time.Duration(lastOff))
}
if sd.Servertime.Before(time.Unix(1608422400, 0)) && sd.Speed != 0 && sd.Source() == SOURCE_SERIAL {
sd.Speed = sd.Speed * 3.6
}
//if sd.Servertime.Before(time.Unix(1608422400, 0)) && sd.Speed != 0 && sd.Source() == SOURCE_SERIAL {
// sd.Speed = sd.Speed * 3.6
//}
return sd
}
}

View File

@ -99,7 +99,7 @@ func (t *TrackingService) IsRecording() bool {
}
// creates a new Pipeline with requested collectors
func (t *TrackingService) StartPipeline(cols ...CollectorType) (string, error) {
func (t *TrackingService) StartLivetracking(cols ...CollectorType) (string, error) {
logrus.Info("SERVICE: NEW PIPELINE")
// check if state machine is in right state
if t.opMode == RECORDING {
@ -107,6 +107,11 @@ func (t *TrackingService) StartPipeline(cols ...CollectorType) (string, error) {
logrus.Warn(txt)
return "RECORDING", errors.New(txt)
}
if t.opMode == REPLAY {
txt := "trackingservice: please stop Replay before resetting pipeline"
logrus.Warn(txt)
return "RECORDING", errors.New(txt)
}
if t.opMode == LIVE {
txt := "trackingservice: stop tracking running stream before creating new one"
logrus.Warnln(txt)
@ -215,11 +220,17 @@ func (t *TrackingService) StopAll() (*TrackingMetadata, error) {
// retrieves tracking with all data and starts replay pipeline if desired.
// in that case the application behaves like in live mode.
func (t *TrackingService) LoadTracking(trackingId uuid.UUID, replay bool) (*Tracking, error) {
if !(t.opMode == REPLAY || t.opMode == STOPPED || t.opMode == LIVE || t.opMode == RECORDING) {
if t.opMode == RECORDING {
txt := "trackingservice: please stop recording before load another tracking"
logrus.Warn(txt)
return nil, errors.New(txt)
}
if t.opMode == REPLAY || t.opMode == LIVE {
t.StopAll()
}
logrus.Info("LOAD TRACKING from database")
tracking, err := t.store.Load(trackingId)
fixSpeedValues(tracking)
if err != nil {
return nil, err
}
@ -247,3 +258,18 @@ func (t *TrackingService) safelyReplaceTracking(tr Tracking) {
*t.tracking = tr
t.recSem.Release(1)
}
// helper function to fixSpeedValues wrong values recorded before 12/20/2020
func fixSpeedValues(tracking *Tracking) {
logrus.Debugln("fixing speed values")
for i := 0; i < len(tracking.Data); i++ {
if tracking.Data[i].Servertime.Before(time.Unix(1608422400, 0)) && tracking.Data[i].Source() == SOURCE_SERIAL && tracking.Data[i].Speed != 0 {
tracking.Data[i].Speed = tracking.Data[i].Speed * 3.6
}
}
//for _, sd := range tracking.Data {
// if sd.Servertime.Before(time.Unix(1608422400, 0)) && sd.Speed != 0 && sd.Source() == SOURCE_SERIAL {
// sd.Speed = sd.Speed * 3.6
// }
//}
}

View File

@ -1,9 +1,11 @@
# gyropsc ⚡
**Realtime Location Dashboard 🚀**
## Quickstart
First copy `example_config.yml` to `gpsconfig.yml` and adjust your parameters. if you intend to use this tool with ublox over USB or Serial, you need to set the name of your port in this config file. otherwise the program will panic.
### Requirements
* Win, Linux or Mac Computer, ideally with serial port and WiFi
*
* download latest Release and unzip it
* execute `gyropgsc-$OS`, according to your operating system
## Build from source
### Requirements

View File

@ -199,7 +199,7 @@ window.addEventListener("load", function(evt) {
checkBoxSmartphone.disabled = false;
checkBoxUblox.disabled = false;
document.getElementById("tracking state").innerHTML = "Tracking state: PIPELINE CLOSED"
ws.close();
//ws.close();
}
return false;
};

View File

@ -108,7 +108,7 @@ func startPipelineHandler(s *core.TrackingService, c *core.Configuration) fiber.
if tcp == "true" {
collecs = append(collecs, core.TCP)
}
res, err := s.StartPipeline(collecs...)
res, err := s.StartLivetracking(collecs...)
prepres := make(map[string]interface{})
prepres["tracking_state"] = res
@ -209,7 +209,7 @@ func createFiberWebsocketHandler(s core.Subscriber) func(conn *websocket.Conn) {
logrus.Traceln("write to ws:", cmsg)
err := c.WriteMessage(websocket.TextMessage, []byte(cmsg))
if err != nil {
logrus.Info("close websocket connection")
logrus.Infoln("close websocket connection", err)
c.Close()
break
}