-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
582771c
commit 552c738
Showing
8 changed files
with
136 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from kbm.exceptions import NegativeValueError as NegativeValueError | ||
from kbm.model import KinematicBicycleModel as KinematicBicycleModel |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class NegativeValueError(Exception): | ||
def __init__(self, argument: str) -> None: | ||
super().__init__(f"{argument} must be positive.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from typing import ReadOnly, TypedDict | ||
|
||
class VehicleState(TypedDict): | ||
x: ReadOnly[float] | ||
y: ReadOnly[float] | ||
yaw: ReadOnly[float] | ||
steer: ReadOnly[float] | ||
velocity: ReadOnly[float] | ||
angular_velocity: ReadOnly[float] | ||
|
||
class KinematicBicycleModel: | ||
def __init__(self, wheelbase: float, max_steer: float, delta_time: float = 0.05) -> None: | ||
""" | ||
Summary | ||
------- | ||
This class implements the 2D Kinematic Bicycle Model for vehicle dynamics | ||
Attributes | ||
---------- | ||
wheelbase (float) : vehicle's wheelbase [m] | ||
max_steer (float) : vehicle's steering limits [rad] | ||
delta_time (float) : discrete time period [s] | ||
Methods | ||
------- | ||
update(x, y, yaw, steer, velocity, acceleration) -> VehicleState | ||
updates the vehicle's state using the kinematic bicycle model | ||
""" | ||
def update( | ||
self, | ||
x: float, | ||
y: float, | ||
yaw: float, | ||
steer: float, | ||
velocity: float, | ||
acceleration: float, | ||
) -> VehicleState: | ||
""" | ||
Summary | ||
------- | ||
updates the vehicle's state using the kinematic bicycle model | ||
Parameters | ||
---------- | ||
x (int) : vehicle's x-coordinate [m] | ||
y (int) : vehicle's y-coordinate [m] | ||
yaw (int) : vehicle's heading [rad] | ||
steer (int) : vehicle's steering angle [rad] | ||
velocity (int) : vehicle's velocity in the x-axis [m/s] | ||
acceleration (int) : vehicle's accleration [m/s^2] | ||
Returns | ||
------- | ||
vehicle_state (VehicleState) : updated vehicle state dictionary | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
from Cython.Build import cythonize | ||
from setuptools import find_packages, setup | ||
from setuptools import Extension, find_packages, setup | ||
|
||
extensions = [ | ||
Extension("kbm.model", ["kbm/model/model.pyx"]), | ||
] | ||
|
||
setup( | ||
name="kbm", | ||
packages=find_packages(include=["kbm", "kbm.*"]), | ||
ext_modules=cythonize("kbm/*.pyx"), # pyright: ignore [reportUnknownArgumentType] | ||
ext_modules=cythonize(extensions), # pyright: ignore [reportUnknownArgumentType] | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.