Merge branch 'develop' into frank-dev2
This commit is contained in:
commit
e74f0fd895
@ -94,9 +94,9 @@ func replaySanitizeFunc() flow.MapFunc {
|
|||||||
}
|
}
|
||||||
sd.Timestamp = sd.Servertime.Add(time.Duration(lastOff))
|
sd.Timestamp = sd.Servertime.Add(time.Duration(lastOff))
|
||||||
}
|
}
|
||||||
if sd.Servertime.Before(time.Unix(1608422400, 0)) && sd.Speed != 0 && sd.Source() == SOURCE_SERIAL {
|
//if sd.Servertime.Before(time.Unix(1608422400, 0)) && sd.Speed != 0 && sd.Source() == SOURCE_SERIAL {
|
||||||
sd.Speed = sd.Speed * 3.6
|
// sd.Speed = sd.Speed * 3.6
|
||||||
}
|
//}
|
||||||
return sd
|
return sd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,7 +99,7 @@ func (t *TrackingService) IsRecording() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// creates a new Pipeline with requested collectors
|
// 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")
|
logrus.Info("SERVICE: NEW PIPELINE")
|
||||||
// check if state machine is in right state
|
// check if state machine is in right state
|
||||||
if t.opMode == RECORDING {
|
if t.opMode == RECORDING {
|
||||||
@ -107,6 +107,11 @@ func (t *TrackingService) StartPipeline(cols ...CollectorType) (string, error) {
|
|||||||
logrus.Warn(txt)
|
logrus.Warn(txt)
|
||||||
return "RECORDING", errors.New(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 {
|
if t.opMode == LIVE {
|
||||||
txt := "trackingservice: stop tracking running stream before creating new one"
|
txt := "trackingservice: stop tracking running stream before creating new one"
|
||||||
logrus.Warnln(txt)
|
logrus.Warnln(txt)
|
||||||
@ -215,11 +220,17 @@ func (t *TrackingService) StopAll() (*TrackingMetadata, error) {
|
|||||||
// retrieves tracking with all data and starts replay pipeline if desired.
|
// retrieves tracking with all data and starts replay pipeline if desired.
|
||||||
// in that case the application behaves like in live mode.
|
// in that case the application behaves like in live mode.
|
||||||
func (t *TrackingService) LoadTracking(trackingId uuid.UUID, replay bool) (*Tracking, error) {
|
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()
|
t.StopAll()
|
||||||
}
|
}
|
||||||
logrus.Info("LOAD TRACKING from database")
|
logrus.Info("LOAD TRACKING from database")
|
||||||
tracking, err := t.store.Load(trackingId)
|
tracking, err := t.store.Load(trackingId)
|
||||||
|
fixSpeedValues(tracking)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -247,3 +258,18 @@ func (t *TrackingService) safelyReplaceTracking(tr Tracking) {
|
|||||||
*t.tracking = tr
|
*t.tracking = tr
|
||||||
t.recSem.Release(1)
|
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
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
# gyropsc ⚡
|
# gyropsc ⚡
|
||||||
**Realtime Location Dashboard 🚀**
|
**Realtime Location Dashboard 🚀**
|
||||||
## Quickstart
|
## 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
|
### Requirements
|
||||||
* Win, Linux or Mac Computer, ideally with serial port and WiFi
|
* 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
|
## Build from source
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|||||||
@ -199,7 +199,7 @@ window.addEventListener("load", function(evt) {
|
|||||||
checkBoxSmartphone.disabled = false;
|
checkBoxSmartphone.disabled = false;
|
||||||
checkBoxUblox.disabled = false;
|
checkBoxUblox.disabled = false;
|
||||||
document.getElementById("tracking state").innerHTML = "Tracking state: PIPELINE CLOSED"
|
document.getElementById("tracking state").innerHTML = "Tracking state: PIPELINE CLOSED"
|
||||||
ws.close();
|
//ws.close();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -108,7 +108,7 @@ func startPipelineHandler(s *core.TrackingService, c *core.Configuration) fiber.
|
|||||||
if tcp == "true" {
|
if tcp == "true" {
|
||||||
collecs = append(collecs, core.TCP)
|
collecs = append(collecs, core.TCP)
|
||||||
}
|
}
|
||||||
res, err := s.StartPipeline(collecs...)
|
res, err := s.StartLivetracking(collecs...)
|
||||||
|
|
||||||
prepres := make(map[string]interface{})
|
prepres := make(map[string]interface{})
|
||||||
prepres["tracking_state"] = res
|
prepres["tracking_state"] = res
|
||||||
@ -209,7 +209,7 @@ func createFiberWebsocketHandler(s core.Subscriber) func(conn *websocket.Conn) {
|
|||||||
logrus.Traceln("write to ws:", cmsg)
|
logrus.Traceln("write to ws:", cmsg)
|
||||||
err := c.WriteMessage(websocket.TextMessage, []byte(cmsg))
|
err := c.WriteMessage(websocket.TextMessage, []byte(cmsg))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Info("close websocket connection")
|
logrus.Infoln("close websocket connection", err)
|
||||||
c.Close()
|
c.Close()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user