|
@@ -23,17 +23,22 @@ func Rule(shareVars *sync.Map, data *pjisuv_msgs.Trajectory) string {
|
|
|
fmt.Println("Recovered from panic:", r)
|
|
|
}
|
|
|
}()
|
|
|
- var currentCurvateres []float64
|
|
|
- for _, point := range data.Trajectoryinfo.Trajectorypoints {
|
|
|
- currentCurvateres = append(currentCurvateres, math.Abs(float64(point.Curvature)))
|
|
|
- }
|
|
|
- if len(currentCurvateres) != 0 {
|
|
|
- maxCurrent := slices.Max(currentCurvateres)
|
|
|
- maxLast := slices.Max(param.LastCurvaturesOfCicvAmrTrajectory)
|
|
|
- a := math.Abs(maxCurrent - maxLast)
|
|
|
- if a >= 0.099 {
|
|
|
- return "ControlJump"
|
|
|
+ lastCurvaturesOfCicvAmrTrajectory, ok := shareVars.Load("LastCurvaturesOfCicvAmrTrajectory")
|
|
|
+ if ok {
|
|
|
+ v := lastCurvaturesOfCicvAmrTrajectory.([]float64)
|
|
|
+ var currentCurvateres []float64
|
|
|
+ for _, point := range data.Trajectoryinfo.Trajectorypoints {
|
|
|
+ currentCurvateres = append(currentCurvateres, math.Abs(float64(point.Curvature)))
|
|
|
+ }
|
|
|
+ if len(currentCurvateres) != 0 {
|
|
|
+ maxCurrent := slices.Max(currentCurvateres)
|
|
|
+ maxLast := slices.Max(v)
|
|
|
+ a := math.Abs(maxCurrent - maxLast)
|
|
|
+ if a >= 0.099 {
|
|
|
+ return "ControlJump"
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
return ""
|
|
|
}
|