Skip to content

Commit

Permalink
Extended ad protocol classes
Browse files Browse the repository at this point in the history
small cleanup
improvements
  • Loading branch information
Daraan committed Sep 6, 2024
1 parent 39e17e9 commit b7df53f
Show file tree
Hide file tree
Showing 16 changed files with 446 additions and 1,511 deletions.
150 changes: 64 additions & 86 deletions PythonAPI/carla/source/carla/ad/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Warning:
some functions and attributes are still missing.
"""

from typing import Iterable, Iterator, Protocol, TypeVar, type_check_only
from typing import Iterable, Iterator, Protocol, TypeVar, overload, type_check_only

from typing_extensions import Self

Expand All @@ -21,135 +21,113 @@ __all__ = [

_T = TypeVar('_T')

@type_check_only
class _FloatLike(Protocol):
def __float__(self) -> float: ...

def __add__(self, other: float | Self) -> Self: ...

def __iadd__(self, other: float | Self) -> Self: ...

def __truediv__(self, other: float | Self) -> Self: ...

def __sub__(self, other: float | Self) -> Self: ...

def __isub(self, other: float | Self) -> Self: ...

def __lt__(self, other: float | Self) -> bool: ...

def __le__(self, other: float | Self) -> bool: ...

def __ge__(self, other: float | Self) -> bool: ...

def __gt__(self, other: float | Self) -> bool: ...

def __eq__(self, value: object) -> bool: ...


@type_check_only
class _Vector(Protocol[_T]):
# Note: __contains__, __iter__, and __reversed__ cann fall to __getitem__

def __getitem__(self, index: int) -> _T:
def append(self, item: _T, /) -> None:
...

def __delitem__(self, index: int):
def extend(self, iterable: Iterable[_T], /) -> None:
...

def __setitem__(self, index: int, value: _T) -> None:
def insert(self, index: int, item: _T, /) -> None:
...

def __len__(self) -> int:
def reverse(self) -> None:
...

def append(self, item: _T) -> None:
...
@overload
def __getitem__(self, index: slice, /) -> list[_T]: ...

def count(self, item: _T) -> int:
@overload
def __getitem__(self, index: int, /) -> _T:
...

def extend(self, iterable: Iterable[_T]) -> None:
def __delitem__(self, index: int, /):
...

def index(self, item: _T) -> int:
@overload
def __setitem__(self, arg2: slice, value: Iterable[_T], /) -> None: ...

@overload
def __setitem__(self, index: int, value: _T, /) -> None: ...

def __len__(self) -> int:
...

def insert(self, index: int, item: _T) -> None:
def __contains__(self, item: object, /) -> bool:
...

def reverse(self) -> None:
def __iter__(self) -> Iterator[_T]:
...

def __contains__(self, item: object) -> bool:
@type_check_only
class _IndexableVector(_Vector[_T], Protocol):
"""add `index` methods."""

def index(self, item: _T, /) -> int:
...

def __iter__(self) -> Iterator[_T]:
@type_check_only
class _VectorSequence(_IndexableVector[_T], Protocol):
"""Adds `count` and `index` methods."""

def index(self, item: _T, /) -> int:
...

class _Calculable(Protocol):
@type_check_only
class _Assignable(Protocol):

cMaxValue: float
cMinValue: float
cPrecisionValue: float
def assign(self, other: Self) -> Self: ...

@classmethod
def getMin(cls) -> Self:
pass
@type_check_only
class _FloatLike(Protocol):
def __float__(self) -> float: ...

@classmethod
def getMax(cls) -> Self:
pass
def __add__(self, other: float | Self) -> Self: ...

@classmethod
def getPrecision(cls) -> Self:
pass
def __iadd__(self, other: float | Self) -> Self: ...

def Valid(self) -> bool:
pass
def __truediv__(self, other: float | Self) -> Self: ...

def __sub__(self, other: float | Self) -> Self: ...

def ensureValid(self, value: Self) -> Self:
pass
def __isub(self, other: float | Self) -> Self: ...

def ensureValidNonZero(self, value: Self) -> Self:
pass
def __lt__(self, other: float | Self) -> bool: ...

def assign(self, other: Self) -> None:
pass
def __le__(self, other: float | Self) -> bool: ...

def __truediv__(self, other: Self) -> Self:
pass
def __mul__(self, other: Self) -> Self: ...

def __sub__(self, other: Self) -> Self:
pass
def __ge__(self, other: float | Self) -> bool: ...

def __isub__(self, other: Self) -> None:
pass
def __gt__(self, other: float | Self) -> bool: ...

def __le__(self, other: Self) -> bool:
pass
def __eq__(self, value: object) -> bool: ...

def __lt__(self, other: Self) -> bool:
pass
@type_check_only
class _Calculable(_Assignable, _FloatLike, Protocol):

def __mul__(self, other: Self) -> Self:
pass
cMaxValue: float
cMinValue: float
cPrecisionValue: float

def __ne__(self, other: Self) -> bool:
pass
@classmethod
def getMin(cls) -> Self: ...

def __add__(self, other: Self) -> Self:
pass
@classmethod
def getMax(cls) -> Self: ...

def __eq__(self, other: Self) -> bool:
pass
@classmethod
def getPrecision(cls) -> Self: ...

def __float__(self) -> float:
pass
@property
def Valid(self) -> bool: ...

def __ge__(self, other: Self) -> bool:
pass
def ensureValid(self, value: Self) -> Self: ...

def __gt__(self, other: Self) -> bool:
pass
def ensureValidNonZero(self, value: Self) -> Self: ...

def __hash__(self) -> int:
pass
def __hash__(self) -> int: ...
15 changes: 7 additions & 8 deletions PythonAPI/carla/source/carla/ad/map/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Any, ClassVar
from libcarla import _CarlaEnum
from ...libcarla import _CarlaEnum

from . import access, config, intersection, landmark, lane, match, point, restriction, route
from .. import rss
Expand Down Expand Up @@ -55,29 +55,28 @@ class RssSceneCreation:
RouteOnly = AppendRoadBoundariesMode.RouteOnly

__instance_size__: ClassVar[int] = 256
@classmethod
def __init__(cls, timeIndex: int, defaultEgoRssDynamics: rss.world.RssDynamics) -> None:
def __init__(self, timeIndex: int, defaultEgoRssDynamics: rss.world.RssDynamics) -> None:
"""
__init__( (object)arg1, (object)timeIndex, (RssDynamics)defaultEgoRssDynamics) -> None :
C++ signature :
void __init__(_object*,unsigned long,ad::rss::world::RssDynamics)"""
@classmethod
def appendRoadBoundaries(cls, egoObjectData: RssObjectData, route: route.FullRoute, operationMode: AppendRoadBoundariesMode):
def appendRoadBoundaries(cls, egoObjectData: RssObjectData, route: route.FullRoute, operationMode: AppendRoadBoundariesMode) -> bool:
"""
appendRoadBoundaries( (RssSceneCreation)arg1, (RssObjectData)egoObjectData, (FullRoute)route, (AppendRoadBoundariesMode)operationMode) -> bool :
C++ signature :
bool appendRoadBoundaries(ad::rss::map::RssSceneCreation {lvalue},ad::rss::map::RssObjectData,ad::map::route::FullRoute,ad::rss::map::RssSceneCreation::AppendRoadBoundariesMode)"""
@classmethod
def appendScenes(cls, *args, **kwargs):

def appendScenes(self, *args, **kwargs) -> bool:
"""
appendScenes( (RssSceneCreation)arg1, (RssObjectData)egoObjectData, (FullRoute)egoRoute, (RssObjectData)otherObjectData, (RestrictSpeedLimitMode)restrictSpeedLimitMode, (LandmarkIdSet)greenTrafficLights, (RssMode)mode) -> bool :
C++ signature :
bool appendScenes(ad::rss::map::RssSceneCreation {lvalue},ad::rss::map::RssObjectData,ad::map::route::FullRoute,ad::rss::map::RssObjectData,ad::rss::map::RssSceneCreation::RestrictSpeedLimitMode,std::set<ad::map::landmark::LandmarkId, std::less<ad::map::landmark::LandmarkId>, std::allocator<ad::map::landmark::LandmarkId> >,ad::rss::map::RssMode)"""
@classmethod
def getWorldModel(cls) -> Any:

def getWorldModel(self) -> rss.world.WorldModel:
"""
getWorldModel( (RssSceneCreation)arg1) -> WorldModel :
Expand Down
4 changes: 2 additions & 2 deletions PythonAPI/carla/source/carla/ad/map/access.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class PartitionId:
"""
...

cMaxValue = 18446744073709551615
cMaxValue: float = 18446744073709551615

cMinValue = 0
cMinValue: float = 0

def ensureValid(self, arg1: PartitionId) -> None:
"""
Expand Down
Loading

0 comments on commit b7df53f

Please sign in to comment.