Skip to content

Commit 44a623e

Browse files
committed
ci: added tests
1 parent 7dfecb7 commit 44a623e

File tree

8 files changed

+502
-377
lines changed

8 files changed

+502
-377
lines changed

.github/workflows/build.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Python
2+
on:
3+
workflow_call:
4+
pull_request:
5+
paths:
6+
- "src/**"
7+
- ".github/workflows/**"
8+
push:
9+
branches:
10+
- main
11+
12+
jobs:
13+
build_clang:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Install dependencies
18+
run: sudo apt install libeigen3-dev
19+
# - name: Check clang format
20+
# run: make cppcheckformat
21+
- name: Set up Python 3.11
22+
id: setup-python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.11"
26+
cache: "pip"
27+
- name: Clang build
28+
run: make clangcompile PYTHON_EXECUTABLE=${{ steps.setup-python.outputs.python-path }}
29+
30+
pythonpackage:
31+
runs-on: ubuntu-latest
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
steps:
35+
- uses: actions/checkout@v4
36+
- name: Install CPP dependencies
37+
run: sudo apt install libeigen3-dev
38+
- name: Set up Python 3.11
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: "3.11"
42+
cache: "pip"
43+
- name: Install building dependencies
44+
run: python -m pip install -r requirements.txt
45+
- name: Install wheel
46+
run: python -m pip install wheel
47+
- name: Install the package
48+
run: python -m pip install --no-build-isolation '.[dev]'
49+
# - name: Code formatting
50+
# run: make pyformat
51+
# - name: Code linting
52+
# run: make pylint
53+
- name: Check that stub files are up-to-date
54+
run: make stubgen && git diff --exit-code
55+
- name: Ensure all unittests(pytest) are passing
56+
run: make pytest

.vscode/launch.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Debug python tests",
9+
"type": "debugpy",
10+
"request": "launch",
11+
"module": "pytest",
12+
"console": "integratedTerminal",
13+
"args": ["-vv"],
14+
"justMyCode": true,
15+
"cwd": "${workspaceFolder}"
16+
},
17+
]
18+
}

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ dev = [
3434
"clang",
3535
"clang-format",
3636
"clang-tidy",
37+
"scipy",
3738
]
3839

3940
[tool.scikit-build]

src/frankik/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from frankik._core import __version__, ik, ik_full, fk
1+
from frankik._core import __version__, ik, ik_full, fk, q_max_fr3, q_max_panda, q_min_fr3, q_min_panda
22

3-
__all__ = ["__version__", "ik", "ik_full", "fk"]
3+
__all__ = ["__version__", "ik", "ik_full", "fk", "q_max_fr3", "q_max_panda", "q_min_fr3", "q_min_panda"]

src/frankik/_core.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import typing
88

99
import numpy
1010

11-
__all__: list[str] = ["fk", "ik", "ik_full"]
11+
__all__: list[str] = ["fk", "ik", "ik_full", "q_max_fr3", "q_max_panda", "q_min_fr3", "q_min_panda"]
1212

1313
def fk(
1414
q: numpy.ndarray[tuple[typing.Literal[7]], numpy.dtype[numpy.float64]]
@@ -62,3 +62,7 @@ def ik_full(
6262
"""
6363

6464
__version__: str = "0.1"
65+
q_max_fr3: list = [2.3093, 1.5133, 2.4937, -0.4461, 2.48, 4.2094, 2.6895]
66+
q_max_panda: list = [2.8973, 1.7628, 2.8973, -0.0698, 2.8973, 3.7525, 2.8973]
67+
q_min_fr3: list = [-2.3093, -1.5133, -2.4937, -2.7478, -2.48, 0.8521, -2.6895]
68+
q_min_panda: list = [-2.8973, -1.7628, -2.8973, -3.0718, -2.8973, -0.0175, -2.8973]

src/pybind/bindings.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ PYBIND11_MODULE(_core, m) {
2323
m.attr("__version__") = "dev";
2424
#endif
2525

26-
// auto frankik = m.def_submodule("frankik", "python bindings for frankik
27-
// IK/FK");
2826

29-
// function ik_full
27+
m.attr("q_min_panda") = frankik::q_min_panda;
28+
m.attr("q_max_panda") = frankik::q_max_panda;
29+
m.attr("q_min_fr3") = frankik::q_min_fr3;
30+
m.attr("q_max_fr3") = frankik::q_max_fr3;
31+
3032
m.def("ik_full", &frankik::ik_full, py::arg("O_T_EE"),
3133
py::arg("q_actual_array") = frankik::kQDefault, py::arg("q7") = M_PI_4, py::arg("is_fr3") = false,
3234
"Compute full inverse kinematics for Franka Emika Panda robot.\n\n"
@@ -39,7 +41,6 @@ PYBIND11_MODULE(_core, m) {
3941
"Returns:\n"
4042
" Eigen::Matrix<double, 4, 7>: All possible IK solutions (up to 4). "
4143
"NaN if no solution.");
42-
// function ik
4344
m.def("ik", &frankik::ik, py::arg("O_T_EE"),
4445
py::arg("q_actual_array") = frankik::kQDefault, py::arg("q7") = M_PI_4, py::arg("is_fr3") = false,
4546
"Compute one inverse kinematics solution for Franka Emika Panda "
@@ -52,7 +53,6 @@ PYBIND11_MODULE(_core, m) {
5253
" is_fr3 (bool, optional): Whether to use FR3 joint limits. Defaults to false.\n\n"
5354
"Returns:\n"
5455
" Vector7d: One IK solution. NaN if no solution.");
55-
// function fk
5656
m.def("fk", &frankik::fk, py::arg("q"),
5757
"Compute forward kinematics for Franka Emika Panda robot.\n\n"
5858
"Args:\n"

0 commit comments

Comments
 (0)