Skip to content

Commit

Permalink
cached property
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed Oct 29, 2024
1 parent 3181234 commit 279336e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions opendbc/car/ford/radar_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import math
import copy
import numpy as np
from functools import cached_property
from math import cos, sin
from dataclasses import dataclass
from opendbc.can.parser import CANParser
Expand Down Expand Up @@ -46,19 +47,19 @@ def __init__(self, pts: list[RadarPoint], cluster_id: int):
self.pts = pts
self.cluster_id = cluster_id

@property
@cached_property
def dRel(self):
return sum([p.dRel for p in self.pts]) / len(self.pts)

@property
@cached_property
def closestDRel(self):
return min([p.dRel for p in self.pts])

@property
@cached_property
def yRel(self):
return sum([p.yRel for p in self.pts]) / len(self.pts)

@property
@cached_property
def vRel(self):
return sum([p.vRel for p in self.pts]) / len(self.pts)

Expand Down

0 comments on commit 279336e

Please sign in to comment.