feat: object filter on car parts
This commit is contained in:
		@@ -140,6 +140,7 @@ AdjustFromObjectPosition modify steering value according object positions
 | 
				
			|||||||
*/
 | 
					*/
 | 
				
			||||||
func (c *GridCorrector) AdjustFromObjectPosition(currentSteering float64, objs []*events.Object) float64 {
 | 
					func (c *GridCorrector) AdjustFromObjectPosition(currentSteering float64, objs []*events.Object) float64 {
 | 
				
			||||||
	objects := c.filter_big_objects(objs, c.imgWidth, c.imgHeight, c.sizeThreshold)
 | 
						objects := c.filter_big_objects(objs, c.imgWidth, c.imgHeight, c.sizeThreshold)
 | 
				
			||||||
 | 
						objects = c.filter_bottom_images(objects)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	zap.S().Debugf("%v objects to avoid", len(objects))
 | 
						zap.S().Debugf("%v objects to avoid", len(objects))
 | 
				
			||||||
	if len(objects) == 0 {
 | 
						if len(objects) == 0 {
 | 
				
			||||||
@@ -234,6 +235,16 @@ func (c *GridCorrector) filter_big_objects(objts []*events.Object, imgWidth int,
 | 
				
			|||||||
	return objectFiltred
 | 
						return objectFiltred
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (c *GridCorrector) filter_bottom_images(objts []*events.Object) []*events.Object {
 | 
				
			||||||
 | 
						objectFiltred := make([]*events.Object, 0, len(objts))
 | 
				
			||||||
 | 
						for _, o := range objts {
 | 
				
			||||||
 | 
							if o.Top > 0.90 {
 | 
				
			||||||
 | 
								objectFiltred = append(objectFiltred, o)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return objectFiltred
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func NewGridMapFromJson(fileName string) (*GridMap, error) {
 | 
					func NewGridMapFromJson(fileName string) (*GridMap, error) {
 | 
				
			||||||
	content, err := os.ReadFile(fileName)
 | 
						content, err := os.ReadFile(fileName)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user