add debug trace

This commit is contained in:
Cyrille Nofficial 2022-09-01 15:43:27 +02:00
parent 9bbbfc30d4
commit b12e2a4739
2 changed files with 3 additions and 0 deletions

View File

@ -112,6 +112,7 @@ func (c *Controller) onObjects(_ mqtt.Client, message mqtt.Message) {
c.muObjects.Lock() c.muObjects.Lock()
defer c.muObjects.Unlock() defer c.muObjects.Unlock()
c.objects = msg.GetObjects() c.objects = msg.GetObjects()
zap.S().Debugf("%v object(s) received", len(c.objects))
} }
func (c *Controller) onDriveMode(_ mqtt.Client, message mqtt.Message) { func (c *Controller) onDriveMode(_ mqtt.Client, message mqtt.Message) {
@ -201,6 +202,7 @@ func (c *Controller) Objects() []*events.Object {
defer c.muObjects.RUnlock() defer c.muObjects.RUnlock()
res := make([]*events.Object, 0, len(c.objects)) res := make([]*events.Object, 0, len(c.objects))
copy(res, c.objects) copy(res, c.objects)
zap.S().Debugf("copy object from %v to %v", c.objects, res)
return res return res
} }

View File

@ -131,6 +131,7 @@ AdjustFromObjectPosition modify steering value according object positions
: | ... | ... | ... | ... | ... | ... | : | ... | ... | ... | ... | ... | ... |
*/ */
func (c *GridCorrector) AdjustFromObjectPosition(currentSteering float64, objects []*events.Object) float64 { func (c *GridCorrector) AdjustFromObjectPosition(currentSteering float64, objects []*events.Object) float64 {
zap.S().Debugf("%v objects to avoid", len(objects))
if len(objects) == 0 { if len(objects) == 0 {
return currentSteering return currentSteering
} }