|
@@ -25,12 +25,12 @@ var (
|
|
|
count1 int = 0
|
|
|
|
|
|
//定义园区4个信号灯的坐标
|
|
|
- point2 = Point{39.72975930689718, 116.48861102824081}
|
|
|
- point3 = Point{39.7288805296616, 116.48812315228867}
|
|
|
- point4 = Point{39.73061430369551, 116.49225103553502}
|
|
|
- point5 = Point{39.73077491578002, 116.49060085035634}
|
|
|
+ //point = Point{39.72975930689718, 116.48861102824081}
|
|
|
+ point = Point{39.7288805296616, 116.48812315228867}
|
|
|
+ //point4 = Point{39.73061430369551, 116.49225103553502}
|
|
|
+ //point5 = Point{39.73077491578002, 116.49060085035634}
|
|
|
|
|
|
- pointlist = []Point{point2, point3, point4, point5}
|
|
|
+ //pointlist = []Point{point2, point3, point4, point5}
|
|
|
)
|
|
|
|
|
|
func Rule(shareVars *sync.Map, data *pjisuv_msgs.PerceptionLocalization) string {
|
|
@@ -40,27 +40,27 @@ func Rule(shareVars *sync.Map, data *pjisuv_msgs.PerceptionLocalization) string
|
|
|
}
|
|
|
}()
|
|
|
if count1%10 == 0 {
|
|
|
- enterflag := IfEnter(pointlist, 25.0, data.Latitude, data.Longitude)
|
|
|
- velocityXOfCicvLocation, ok := shareVars.Load("VelocityXOfCicvLocation")
|
|
|
- if ok {
|
|
|
- if enterflag && velocityXOfCicvLocation.(float64) >= 1 {
|
|
|
- return Label()
|
|
|
- }
|
|
|
+
|
|
|
+ enterflag := IfEnter(point, 25.0, data.Latitude, data.Longitude)
|
|
|
+ VelocityXOfCicvLocation, _ := shareVars.Load("VelocityXOfCicvLocation")
|
|
|
+ if enterflag && VelocityXOfCicvLocation.(float64) > 1 {
|
|
|
+ //eventLabel := "FindTrafficLight"
|
|
|
+ //fmt.Println(eventLabel)
|
|
|
+ return "FindTrafficLightP1"
|
|
|
}
|
|
|
}
|
|
|
count1++
|
|
|
return ""
|
|
|
}
|
|
|
|
|
|
-func IfEnter(pointlist []Point, radius float64, lat, lon float64) bool {
|
|
|
+func IfEnter(point Point, radius float64, lat, lon float64) bool {
|
|
|
// 判断是否进入点列表中的区域
|
|
|
point1 := Point{Latitude: lat, Longitude: lon}
|
|
|
- for _, point := range pointlist {
|
|
|
- d := distance(point1, point)
|
|
|
- if d <= radius {
|
|
|
- return true
|
|
|
- }
|
|
|
+ d := distance(point1, point)
|
|
|
+ if d <= radius {
|
|
|
+ return true
|
|
|
}
|
|
|
+
|
|
|
return false
|
|
|
}
|
|
|
|