Skip to content

Commit

Permalink
car: default now_nanos value
Browse files Browse the repository at this point in the history
  • Loading branch information
adeebshihadeh authored Aug 29, 2024
1 parent aa1d21b commit 6cb7851
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions opendbc/car/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import json
import os
import numpy as np
import time
import tomllib
from abc import abstractmethod, ABC
from enum import StrEnum
from typing import Any, NamedTuple
from typing import Any, NamedTuple, Optional
from collections.abc import Callable
from functools import cache

Expand Down Expand Up @@ -101,7 +102,9 @@ def __init__(self, CP: structs.CarParams, CarController, CarState):
dbc_name = "" if self.cp is None else self.cp.dbc_name
self.CC: CarControllerBase = CarController(dbc_name, CP)

def apply(self, c: structs.CarControl, now_nanos: int) -> tuple[structs.CarControl.Actuators, list[CanData]]:
def apply(self, c: structs.CarControl, now_nanos: Optional[int] = None) -> tuple[structs.CarControl.Actuators, list[CanData]]:
if now_nanos is None:
now_nanos = int(time.monotonic() * 1e9)
return self.CC.update(c, self.CS, now_nanos)

@staticmethod
Expand Down

0 comments on commit 6cb7851

Please sign in to comment.