Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c496fd6
updated to compas_invocations2
chenkasirer Mar 24, 2025
5564dd3
created cpython component definitions
chenkasirer Mar 24, 2025
4041295
fixed plan cartesian motion component
chenkasirer Mar 24, 2025
ae2ca08
fixed plan motion component
chenkasirer Mar 24, 2025
eed9fcb
removed components from an alternative future
chenkasirer Mar 24, 2025
1793d74
re-introduced current timeline components
chenkasirer Mar 24, 2025
6a1b92f
cpythonized remaining components
chenkasirer Mar 24, 2025
27bf75c
fixed calls to create_id
chenkasirer Mar 24, 2025
c861d65
argname and typing in collision mesh component
chenkasirer Mar 24, 2025
10e8a9e
some more typing fixes
chenkasirer Mar 24, 2025
010cca2
removed another component that snuck in from the future
chenkasirer Mar 24, 2025
7635086
added helper functions for GH message printing
chenkasirer Mar 24, 2025
342728d
updated components with new message helpers
chenkasirer Mar 24, 2025
3c7003c
function wants Sphere in primitive form
chenkasirer Mar 24, 2025
c6a8912
updated changelog
chenkasirer Mar 24, 2025
148678b
warning using the new helper function
chenkasirer Mar 24, 2025
1695cf0
added yak template and workflow
chenkasirer Mar 24, 2025
fcab390
run workflows on LTS branch as well
chenkasirer Mar 24, 2025
b5e0e24
fixed typo in requirements
chenkasirer Mar 24, 2025
51acb99
removed python 3.8 from workflow, added 3.11, 3.12, 3.13
chenkasirer Mar 24, 2025
4e42274
add ruff and make it happy
chenkasirer Mar 24, 2025
f5de604
make formatter happy
chenkasirer Mar 24, 2025
06d51fe
removed deprecated linting and formatting tools from requirements
chenkasirer Mar 24, 2025
bc496f1
updated integratino test
chenkasirer Mar 24, 2025
2f61c0b
pinned sybil version to fix integration test
chenkasirer Mar 25, 2025
cd92dc6
import create_id from compas_ghpython and remove local implementation
chenkasirer Mar 26, 2025
fbc7bdb
updated changelog
chenkasirer Mar 26, 2025
8392c8b
fixed scene object not properly created
chenkasirer Mar 27, 2025
51afadd
same SceneObject fix in a couple other places
chenkasirer Mar 27, 2025
1e90644
untar packages which cannot be installed with ironpip
chenkasirer Mar 28, 2025
fd7e005
linting
chenkasirer Mar 28, 2025
fb3d9b7
ironpython test
chenkasirer Mar 28, 2025
9f442e9
skip ros integration tests
chenkasirer Mar 28, 2025
af8f1f6
formatting
chenkasirer Mar 28, 2025
0ea8d3b
needs skip on every line
chenkasirer Mar 28, 2025
8bcf410
fixed some doctest skipping statements
chenkasirer Apr 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
branches:
- main
- LTS-main-1.x
pull_request:
branches:
- main
- LTS-main-1.x

jobs:
build:
Expand All @@ -15,7 +17,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ['3.8', '3.9', '3.10']
python: ['3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: compas-dev/compas-actions.build@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- LTS-main-1.x
tags:
- 'v*'
pull_request_review:
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@ on:
push:
branches:
- main
- LTS-main-1.x
pull_request:
branches:
- main
- LTS-main-1.x

jobs:
build:
name: ubuntu-py38-integration
name: ubuntu-py311-integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: '3.11'
- name: Set up docker containers
run: |
docker-compose -f "tests/integration_setup/docker-compose.yml" up -d --build
docker compose -f "tests/integration_setup/docker-compose.yml" up -d --build
docker ps -a
- name: Install dependencies
run: |
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/ironpython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
branches:
- main
- LTS-main-1.x
pull_request:
branches:
- main
- LTS-main-1.x

jobs:
build:
Expand All @@ -26,6 +28,11 @@ jobs:
ipy -X:Frames -m pip install --no-deps compas.tar.gz
ipy -X:Frames -m pip install --no-deps roslibpy.tar.gz
ipy -X:Frames -m pip install --no-deps compas_robots.tar.gz

# untar and rename, these cannot be installed using ironpip because they not longer have a setup.py
tar -xf compas.tar.gz && for /d %i in (compas-*) do ren "%i" compas
tar -xf compas_robots.tar.gz && for /d %i in (compas_robots-*) do ren "%i" compas_robots

- uses: NuGet/setup-nuget@v1.0.5
- uses: compas-dev/compas-actions.ghpython_components@v5
with:
Expand All @@ -35,9 +42,9 @@ jobs:
run: |
ipy -m compas_fab
env:
IRONPYTHONPATH: ./src
IRONPYTHONPATH: ./src;./compas/src;./compas_robots/src
- name: Run tests
run: |
ipy tests/ipy_test_runner.py
env:
IRONPYTHONPATH: ./src
IRONPYTHONPATH: ./src;./compas/src;./compas_robots/src
1 change: 1 addition & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
branches:
- main
- LTS-main-1.x

jobs:
build:
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/publish_yak.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: publish_yak

on:
workflow_dispatch:
inputs:
environment:
description: "Choose deployment environment"
required: true
type: choice
options:
- test
- prod

jobs:

publish_test_yak:
runs-on: windows-latest

steps:

- name: Set test flag based on input
shell: pwsh
run: |
if ("${{ github.event.inputs.environment }}" -eq "test") {
echo "TEST_FLAG=--test-server" | Out-File -FilePath $env:GITHUB_ENV -Append
}
else {
echo "TEST_FLAG=" | Out-File -FilePath $env:GITHUB_ENV -Append
}

- name: Checkout repo
uses: actions/checkout@v4

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requiremnets-dev.txt

- name: Create CPython Grasshopper user objects
run: |
invoke build-cpython-ghuser-components

- name: Create IronPython Grasshopper user objects
run: |
choco install ironpython --version=2.7.8.1
invoke clean
invoke build-ghuser-components

- name: Create Rhino7 Yak package
shell: pwsh
run: |
invoke yakerize -m $Env:YAK_TEMPLATE\manifest.yml -l $Env:YAK_TEMPLATE\icon.png -g $Env:USER_OBJECTS -t rh7
env:
USER_OBJECTS: src\compas_fab\ghpython\components\ghuser
YAK_TEMPLATE: src\compas_fab\ghpython\yak_template

- name: Publish to Yak server (Rhino 7)
shell: pwsh
run: |
$test_flag = if ($Env:TEST_FLAG) { $Env:TEST_FLAG } else { "" }
$file = Get-ChildItem -Path dist\yak_package\*rh7*.yak -File | Select-Object -ExpandProperty Name
$command = "invoke publish-yak -y dist\yak_package\$file $test_flag".Trim()
Invoke-Expression $command
env:
YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }}

- name: Create Rhino8 Yak package
shell: pwsh
run: |
invoke yakerize -m $Env:YAK_TEMPLATE\manifest.yml -l $Env:YAK_TEMPLATE\icon.png -g $Env:USER_OBJECTS -t rh8
env:
USER_OBJECTS: src\compas_fab\ghpython\components_cpython\ghuser
YAK_TEMPLATE: src\compas_fab\ghpython\yak_template

- name: Publish to Yak server (Rhino 8)
shell: pwsh
run: |
$test_flag = if ($Env:TEST_FLAG) { $Env:TEST_FLAG } else { "" }
$file = Get-ChildItem -Path dist\yak_package\*rh8*.yak -File | Select-Object -ExpandProperty Name
$command = "invoke publish-yak -y dist\yak_package\$file $test_flag".Trim()
Invoke-Expression $command
env:
YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,4 @@ temp/**

# Grasshopper generated objects
src/compas_fab/ghpython/components/ghuser/*.ghuser
src/compas_fab/ghpython/components_cpython/ghuser/*.ghuser
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

* Added helper function `message` to `compas_fab.ghpython.components`.
* Added helper function `error` to `compas_fab.ghpython.components`.
* Added helper function `remark` to `compas_fab.ghpython.components`.
* Added helper function `warning` to `compas_fab.ghpython.components`.
* Added GH component definitions compatible with CPython in Rhino8.

### Changed

* Updated dev dependency to `compas_invocations2`.
* Fixed `AttributeError` in `inverse_kinematics_spherical_wrist()`.
* Fixed `AttributeError` in VisualizeRobot GH component.

### Removed

* Removed `create_id` from `compas_fab.ghpython.components`, using `compas_ghpython.create_id` instead.


## [1.0.2] 2024-02-22

### Added
Expand Down
31 changes: 31 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,34 @@ known_first_party = "compas_fab"
default_section = "THIRDPARTY"
forced_separate = "test_compas_fab"
skip = ["__init__.py"]

[tool.ruff]
line-length = 120
indent-width = 4
target-version = "py39"

[tool.ruff.lint]
select = ["E", "F", "I"]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["I001"]
"tests/*" = ["I001"]
"tasks.py" = ["I001"]
"src/compas_fab/ghpython/components/*/code.py" = ["F821", "F401"]
"src/compas_fab/ghpython/components_cpython/*/code.py" = ["F821", "F401"]

[tool.ruff.lint.isort]
force-single-line = true
known-first-party = [
"compas_fab"
]

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.ruff.lint.pycodestyle]
max-line-length = 179

[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = "dynamic"
11 changes: 4 additions & 7 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
attrs >=19.3.0
autopep8
black
bump2version >=1.0.1
check-manifest >=0.36
compas_invocations
doc8
flake8
compas-invocations2
ruff
importlib_metadata <5.0
invoke>=0.14
isort
pylint
pytest
pytest_mock
pytest-cov
sphinx_compas2_theme
sybil
sybil~=8.0.1
twine
tomlkit
-e .
1 change: 1 addition & 0 deletions src/compas_fab/backends/interfaces/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from compas_fab.backends.exceptions import BackendFeatureNotSupportedError


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ def inverse_kinematics_spherical_wrist(target_frame, points):
elbow_frame = Frame(p1A, elbow_dir, [0, 0, 1])
elbow_plane = (p1A, elbow_frame.normal)

_, (center, radius, normal) = intersection_sphere_sphere(sphere1, sphere2)
sphere1_prim = (sphere1.base, sphere1.radius)
sphere2_prim = (sphere2.base, sphere2.radius)

_, (center, radius, normal) = intersection_sphere_sphere(sphere1_prim, sphere2_prim)
Comment thread
chenkasirer marked this conversation as resolved.
circle = ((center, normal), radius)

intersect_pt1, intersect_pt2 = intersection_plane_circle(elbow_plane, circle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def inverse_kinematics(self, robot, frame_WCF, start_configuration=None, group=N
# I don't know what jointRanges needs to be. Erwin Coumans knows, but he isn't telling.
# https://stackoverflow.com/questions/49674179/understanding-inverse-kinematics-pybullet
# https://docs.google.com/document/d/10sXEhzFRSnvFcl3XxNGhnD4N2SedqwdAvK3dsihxVUA/preview?pru=AAABc7276PI*zazLer2rlZ8tAUI8lF98Kw#heading=h.9i02ojf4k3ve
joint_ranges = [u - l for u, l in zip(upper_limits, lower_limits)]
joint_ranges = [upper - lower for upper, lower in zip(upper_limits, lower_limits)]

if options.get("semi-constrained"):
ik_options.update(
Expand Down
4 changes: 2 additions & 2 deletions src/compas_fab/backends/pybullet/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ class PyBulletClient(PyBulletBase, ClientInterface):
Examples
--------
>>> from compas_fab.backends import PyBulletClient
>>> with PyBulletClient(connection_type='direct') as client:
... print('Connected: %s' % client.is_connected)
>>> with PyBulletClient(connection_type="direct") as client:
... print("Connected: %s" % client.is_connected)
Connected: True

"""
Expand Down
8 changes: 4 additions & 4 deletions src/compas_fab/backends/pybullet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ def redirect_stdout(to=os.devnull, enabled=True):

Examples
--------
>>> import os # doctest: +SKIP
>>> with redirect_stdout(to='filename'): # doctest: +SKIP
... print("from Python") # doctest: +SKIP
... os.system("echo non-Python applications are also supported") # doctest: +SKIP
>>> import os # doctest: +SKIP
>>> with redirect_stdout(to="filename"): # doctest: +SKIP
... print("from Python") # doctest: +SKIP
... os.system("echo non-Python applications are also supported") # doctest: +SKIP
"""

def _redirect_stdout(to_):
Expand Down
4 changes: 2 additions & 2 deletions src/compas_fab/backends/ros/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def from_local_cache_directory(cls, local_cache_directory):
False


>>> local_directory = os.path.join(os.path.expanduser('~'), 'robot_description', 'robocop')
>>> local_directory = os.path.join(os.path.expanduser("~"), "robot_description", "robocop")
>>> info = LocalCacheInfo.from_local_cache_directory(local_directory)
>>> info.use_local_cache
True
Expand Down Expand Up @@ -126,7 +126,7 @@ class RosClient(Ros, ClientInterface):

>>> from compas_fab.backends import RosClient
>>> with RosClient() as client:
... print('Connected: %s' % client.is_connected)
... print("Connected: %s" % client.is_connected)
Connected: True

Notes
Expand Down
2 changes: 1 addition & 1 deletion src/compas_fab/backends/ros/messages/geometry_msgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class Inertia(ROSmsg):

Examples
--------
>>> inertia = compas_fab.robots.Inertia([[0] * 3] * 3, 1., [0.1, 3.1, 4.4])
>>> inertia = compas_fab.robots.Inertia([[0] * 3] * 3, 1.0, [0.1, 3.1, 4.4])
>>> ros_inertia = Inertia.from_inertia(inertia)
>>> ros_inertia.msg
{'m': 1.0, 'com': {'x': 0.1, 'y': 3.1, 'z': 4.4}, 'ixx': 0.0, 'ixy': 0.0, 'ixz': 0.0, 'iyy': 0.0, 'iyz': 0.0, 'izz': 0.0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
COMPAS FAB v1.0.2
"""

from compas_ghpython import create_id
from compas_rhino.conversions import plane_to_compas_frame
from ghpythonlib.componentbase import executingcomponent as component
from scriptcontext import sticky as st

from compas_fab.ghpython.components import create_id


class PlanCartesianMotion(component):
def RunScript(
Expand Down
3 changes: 1 addition & 2 deletions src/compas_fab/ghpython/components/Cf_PlanMotion/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
COMPAS FAB v1.0.2
"""

from compas_ghpython import create_id
from ghpythonlib.componentbase import executingcomponent as component
from scriptcontext import sticky as st

from compas_fab.ghpython.components import create_id


class PlanMotion(component):
def RunScript(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
COMPAS FAB v1.0.2
"""

from compas_ghpython import create_id
from ghpythonlib.componentbase import executingcomponent as component
from scriptcontext import sticky as st

from compas_fab.ghpython.components import create_id
from compas_fab.robots import PlanningScene


Expand Down
Loading
Loading