Skip to content

Commit

Permalink
no camera offset
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed May 14, 2022
1 parent 29ca763 commit 507dcdb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion common/op_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __init__(self):
"""

self.fork_params = {
'camera_offset': Param(-0.04 if TICI else 0.06, NUMBER, 'Your camera offset to use in lane_planner.py\n', live=True),
# 'camera_offset': Param(0.04 if TICI else 0.0, NUMBER, 'Your camera offset to use in lane_planner.py\n', live=True),
'torque_derivative': Param(5.0, NUMBER, 'Derivative used in the lateral torque controller', live=True),
'global_df_mod': Param(1.0, NUMBER, 'The multiplier for the current distance used by dynamic follow. The range is limited from 0.85 to 2.5\n'
'Smaller values will get you closer, larger will get you farther\n'
Expand Down
12 changes: 5 additions & 7 deletions selfdrive/controls/lib/lane_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
from common.realtime import DT_MDL
from selfdrive.hardware import TICI
from selfdrive.swaglog import cloudlog
from common.op_params import opParams
# from common.op_params import opParams


TRAJECTORY_SIZE = 33
# camera offset is meters from center car to camera
# model path is in the frame of the camera. Empirically
# model path is in the frame of the camera. Empirically
# the model knows the difference between TICI and EON
# so a path offset is not needed
PATH_OFFSET = 0.00
Expand All @@ -30,8 +30,7 @@ def __init__(self, wide_camera=False):
self.lane_width_estimate = FirstOrderFilter(3.7, 9.95, DT_MDL)
self.lane_width_certainty = FirstOrderFilter(1.0, 0.95, DT_MDL)
self.lane_width = 3.7
self.op_params = opParams()
# self.camera_offset = self.op_params.get('camera_offset')
# self.op_params = opParams()

self.lll_prob = 0.
self.rll_prob = 0.
Expand All @@ -44,13 +43,12 @@ def __init__(self, wide_camera=False):
self.r_lane_change_prob = 0.

self.camera_offset = -CAMERA_OFFSET if wide_camera else CAMERA_OFFSET
self.path_offset = 0 # self.camera_offset - MODEL_PATH_OFFSET
self.path_offset = -PATH_OFFSET if wide_camera else PATH_OFFSET

def parse_model(self, md):
lane_lines = md.laneLines
if len(lane_lines) == 4 and len(lane_lines[0].t) == TRAJECTORY_SIZE:
self.camera_offset = clip(self.op_params.get('camera_offset'), -0.5, 0.5) # update camera offset
#self.path_offset = self.camera_offset - MODEL_PATH_OFFSET
# self.camera_offset = clip(self.op_params.get('camera_offset'), -0.5, 0.5) # update camera offset

self.ll_t = (np.array(lane_lines[1].t) + np.array(lane_lines[2].t))/2
# left and right ll x is the same
Expand Down

0 comments on commit 507dcdb

Please sign in to comment.