mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-08-23 01:04:05 +08:00
dragonpilot beta3
date: 2023-07-26T22:20:36 commit: c6d842c412052be1985b63d683c63be9dcb2b0eb
This commit is contained in:
@@ -2,11 +2,11 @@ import numpy as np
|
||||
from enum import Enum
|
||||
from selfdrive.mapd.lib.geo import DIRECTION, R, vectors
|
||||
|
||||
from scipy.interpolate import splev, splprep
|
||||
from scipy.interpolate import splev, splprep
|
||||
|
||||
|
||||
_TURN_CURVATURE_THRESHOLD = 0.002 # 1/mts. A curvature over this value will generate a speed limit section.
|
||||
_MAX_LAT_ACC = 2.6 # Maximum lateral acceleration in turns.
|
||||
_MAX_LAT_ACC = 2.3 # Maximum lateral acceleration in turns.
|
||||
_SPLINE_EVAL_STEP = 5 # mts for spline evaluation for curvature calculation
|
||||
_MIN_SPEED_SECTION_LENGTH = 100. # mts. Sections below this value will not be split in smaller sections.
|
||||
_MAX_CURV_DEVIATION_FOR_SPLIT = 2. # Split a speed section if the max curvature deviates from mean by this factor.
|
||||
@@ -22,24 +22,6 @@ def nodes_raw_data_array_for_wr(wr, drop_last=False):
|
||||
sl = wr.speed_limit
|
||||
data = np.array([(n.id, n.lat, n.lon, sl) for n in wr.way.nodes], dtype=float)
|
||||
|
||||
for count, node in enumerate(wr.way.nodes):
|
||||
if 'highway' in node.tags:
|
||||
if node.tags['highway'] == 'mini_roundabout':
|
||||
data[count][3] = 4.1667
|
||||
if 'direction' in node.tags and (node.tags['highway'] == 'stop' or node.tags['highway'] == 'give_way'):
|
||||
if (wr.direction == DIRECTION.BACKWARD and node.tags['direction'] == 'backward') or (wr.direction == DIRECTION.FORWARD and node.tags['direction'] == 'forward'):
|
||||
if node.tags['highway'] == 'give_way':
|
||||
data[count][3] = 2.7777
|
||||
if node.tags['highway'] == 'stop':
|
||||
data[count][3] = 0.1
|
||||
if 'traffic_calming' in node.tags:
|
||||
if node.tags['traffic_calming'] == 'yes':
|
||||
data[count][3] = 40/3.6
|
||||
if node.tags['traffic_calming'] == 'chicane' or node.tags['traffic_calming'] == 'choker':
|
||||
data[count][3] = 20/3.6
|
||||
if node.tags['traffic_calming'] == 'bump' or node.tags['traffic_calming'] == 'hump':
|
||||
data[count][3] = 2.24
|
||||
|
||||
# reverse the order if way direction is backwards
|
||||
if wr.direction == DIRECTION.BACKWARD:
|
||||
data = np.flip(data, axis=0)
|
||||
@@ -223,7 +205,7 @@ def is_wr_a_valid_divertion_from_node(wr, node_id, wr_ids):
|
||||
"""
|
||||
Evaluates if the way relation `wr` is a valid divertion from node with id `node_id`.
|
||||
A valid divertion is a way relation with an edge node with the given `node_id` that is not already included
|
||||
in the list of way relations in the route (`wr_ids`) and that can be travaled in the direction as if starting
|
||||
in the list of way relations in the route (`wr_ids`) and that can be travaled in the direction as if starting
|
||||
from node with id `node_id`
|
||||
"""
|
||||
if wr.id in wr_ids:
|
||||
|
||||
Reference in New Issue
Block a user