-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from Ipuch/ground_joints
ground joints and github action
- Loading branch information
Showing
21 changed files
with
800 additions
and
459 deletions.
There are no files selected for viewing
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,55 @@ | ||
name: Run the tests | ||
|
||
on: [pull_request] | ||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-20.04 | ||
label: linux-64 | ||
prefix: /usr/share/miniconda3/envs/bionc | ||
- os: macos-latest | ||
label: osx-64 | ||
prefix: /Users/runner/miniconda3/envs/bionc | ||
- os: windows-latest | ||
label: win-64 | ||
prefix: C:\Miniconda3\envs\bionc | ||
name: ${{ matrix.label }} | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup environment | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
miniforge-variant: Mambaforge | ||
miniforge-version: latest | ||
use-mamba: true | ||
activate-environment: bionc | ||
environment-file: environment.yml | ||
|
||
- name: Print mamba info | ||
run: | | ||
mamba config --show | ||
mamba info | ||
mamba list | ||
- name: Install extra dependencies | ||
run: mamba install pytest-cov pytest pytest-cov codecov -cconda-forge | ||
|
||
- name: Run the actual tests | ||
run: pytest -v --color=yes --cov-report term-missing --cov=bionc tests | ||
|
||
- name: Test installed version of bionc | ||
run: | | ||
python setup.py install | ||
cd | ||
python -c "import bionc" | ||
- name: Upload coverage to Codecov | ||
run: codecov | ||
if: matrix.label == 'linux-64' |
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
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,43 @@ | ||
from casadi import MX | ||
import numpy as np | ||
from ..utils.enums import CartesianAxis | ||
|
||
|
||
class CartesianVector(MX): | ||
""" | ||
Class used to create a natural vector, a vector that is expressed in the natural coordinate system of a segment | ||
""" | ||
|
||
def __new__(cls, input_array: MX | np.ndarray | list | tuple): | ||
""" | ||
Create a new instance of the class. | ||
""" | ||
|
||
if not isinstance(input_array, (MX, np.ndarray)): | ||
input_array = np.array(input_array) | ||
|
||
obj = MX.__new__(cls) | ||
|
||
if isinstance(input_array, MX): | ||
size1 = input_array.shape[0] | ||
size2 = input_array.shape[1] | ||
else: | ||
size1 = input_array.shape[0] | ||
size2 = input_array.shape[1] if input_array.shape.__len__() == 2 else 1 | ||
|
||
if size1 != 3: | ||
raise ValueError("The input array must have 3 elements") | ||
|
||
if size2 != 1: | ||
raise ValueError("The position must be a 3d vector with only one column") | ||
|
||
return obj | ||
|
||
@classmethod | ||
def axis(cls, axis: CartesianAxis): | ||
if axis == CartesianAxis.X: | ||
return cls(np.array([1, 0, 0])) | ||
elif axis == CartesianAxis.Y: | ||
return cls(np.array([0, 1, 0])) | ||
elif axis == CartesianAxis.Z: | ||
return cls(np.array([0, 0, 1])) |
Oops, something went wrong.