-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AVR-761] Lberg/refactor map api #196
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am guessing that the goal of exposing this is that we can select the elements of interest by their bounds, right?
Though for the geometry itself we will want to use get_lane_coords and get_crosswalk_coords
Is this right @lucabergamini
Exactly :) |
PTAL @anasrferreira , I've added a function to sample from the lane coords |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
@@ -15,7 +15,7 @@ | |||
CV2_SHIFT_VALUE = 2 ** CV2_SHIFT | |||
|
|||
|
|||
def elements_within_bounds(center: np.ndarray, bounds: np.ndarray, half_extent: float) -> np.ndarray: | |||
def indices_in_bounds(center: np.ndarray, bounds: np.ndarray, half_extent: float) -> np.ndarray: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this one also get moved to map_api?
7acdd5e
to
3b7aad5
Compare
* improve transform through interpolation * add comment * rename variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just minor comments 👍
INTER_METER = 0 # fixed interpolation at a given step in meters | ||
INTER_ENSURE_LEN = 1 # ensure we always get the same number of elements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you'll need to add #:
to autodoc be able to render this doc.
xyz_inter[:, 0] = np.interp(steps, xp=cum_dist, fp=xyz[:, 0]) | ||
xyz_inter[:, 1] = np.interp(steps, xp=cum_dist, fp=xyz[:, 1]) | ||
xyz_inter[:, 2] = np.interp(steps, xp=cum_dist, fp=xyz[:, 2]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about it but I think that the np.interp
would allow you to do this on a single call, but have to double check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to the docstring it's only 1D and it doesn't take axis as an argument :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave some suggestions on function names, otherwise LGTM
l5kit/l5kit/data/map_api.py
Outdated
return False | ||
traffic_el = element.element.traffic_control_element | ||
return traffic_el.HasField("traffic_light") is True | ||
|
||
def is_traffic_face_colour(self, element_id: str, colour: str) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def is_traffic_face_colour(self, element_id: str, colour: str) -> bool: | |
def check_traffic_light_state(self, element_id: str, tl_state: str) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state is something like `ACTIVE, INACTIVE, here we're just checking if the element is a traffic light face and which colour it has. It's a static info, not a dynamic one
lanes_lines[lane_type].extend([xy_left, xy_right]) | ||
for lane_area in lanes_area.reshape((-1, INTERPOLATION_POINTS * 2, 2)): | ||
# need to for-loop otherwise some of them are empty | ||
cv2.fillPoly(img, [lane_area], (17, 17, 31), **CV2_SUB_VALUES) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where does (17, 17, 31) come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no idea, it was there before I started working on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me ! 👍
Refactor of MapAPI: