-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from UOA-FSAE/cone_map_restructure_updated
Cone map restructure updated
- Loading branch information
Showing
54 changed files
with
216 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
float32 confidence | ||
uint8 type | ||
geometry_msgs/Point position | ||
float32 radius | ||
float32 height |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
geometry_msgs/Point[] left_cones | ||
geometry_msgs/Point[] right_cones |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
50 changes: 50 additions & 0 deletions
50
src/perception/sythesis/cone_mapping/cone_mapping/cone_map_collection.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from moa_msgs.msg import Cone | ||
from geometry_msgs.msg import Point | ||
from geometry_msgs.msg import Quaternion | ||
from geometry_msgs.msg import Pose | ||
|
||
import math | ||
|
||
class ConeMapList(list): | ||
def __init__(self): | ||
super().__init__(self) | ||
|
||
def insert_cone(self, car_pose, cone_coord): | ||
car_coord = car_pose.position.x, car_pose.position.y | ||
# Insert if first cone detected | ||
if len(self) == 0: | ||
self.append(cone_coord) | ||
return | ||
|
||
# | ||
if len(self) == 1: | ||
coord0 = self[0].x, self[0].y | ||
if self.distance(car_coord, cone_coord) < self.distance(car_coord, coord0): | ||
self.insert(0, cone_coord) | ||
return | ||
else: | ||
self.append(cone_coord) | ||
return | ||
|
||
for i in range(len(self) - 1): | ||
coordi = self[i].position.x, self[i].position.y | ||
coordi1 = self[i+1].position.x, self[i+1].position.y | ||
if self.distance(coordi, cone_coord) < self.distance(coordi, coordi1): | ||
self.insert(i, cone_coord) | ||
return | ||
|
||
self.append(cone_coord) | ||
|
||
def distance(self, coord1, coord2): | ||
return math.sqrt((coord1[0].x - coord2[0].x)**2 + (coord1[1].y - coord2[1].y)**2) | ||
|
||
|
||
|
||
class ConeWithId(Cone): | ||
def __init__(self, id): | ||
super().__init__(self) | ||
|
||
|
||
|
||
|
||
cone = ConeWithId(cone, id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.