-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Showing
1 changed file
with
14 additions
and
6 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 |
---|---|---|
@@ -1,38 +1,46 @@ | ||
"""Pytest config.""" | ||
from pathlib import Path | ||
from typing import Dict, List, Union | ||
|
||
import numpy as np | ||
import numpy.typing as npt | ||
from pytest import fixture | ||
|
||
from pybotics.kinematic_chain import MDHKinematicChain | ||
from pybotics.robot import Robot | ||
|
||
|
||
@fixture() | ||
def planar_robot(): | ||
def planar_robot() -> Robot: | ||
"""Generate planar robot.""" | ||
return Robot( | ||
MDHKinematicChain(np.array([[0, 0, 0, 0], [0, 10, 0, 0], [0, 20, 0, 0]])) | ||
MDHKinematicChain.from_parameters( | ||
np.array([[0, 0, 0, 0], [0, 10, 0, 0], [0, 20, 0, 0]]) | ||
) | ||
) | ||
|
||
|
||
@fixture() | ||
def resources_path(): | ||
def resources_path() -> Path: | ||
"""Get resources path.""" | ||
return (Path(__file__).parent / "resources").resolve() | ||
|
||
|
||
@fixture() | ||
def vector_transforms(resources_path: Path): | ||
def vector_transforms( | ||
resources_path: Path, | ||
) -> List[Dict[str, Union[npt.NDArray[np.float64], str]]]: | ||
"""Get resource data.""" | ||
data = np.genfromtxt( | ||
fname=resources_path / "vector-transforms.csv", delimiter=",", dtype=str | ||
) | ||
return [ | ||
) # type: ignore | ||
|
||
result = [ | ||
{ | ||
"vector": d[:6].astype(float), | ||
"transform": d[6:-1].astype(float), | ||
"order": d[-1], | ||
} | ||
for d in data | ||
] | ||
return result |