Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support compas 2 private Data API #400

Merged
merged 25 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b231f6c
Almost finished updating all the private data API
yck011522 Jan 30, 2024
e5b1cb4
New Black
yck011522 Jan 30, 2024
2621caf
Removed `Configuration` from API manifest
yck011522 Jan 30, 2024
6a0a1fe
pin compas_robots to repo main branch instead of version
yck011522 Jan 30, 2024
2514425
change logs and authors
yck011522 Jan 30, 2024
0f3c9f7
lint
yck011522 Jan 30, 2024
00299b3
Pin compas_to a branch to continue tests
yck011522 Jan 30, 2024
905c496
skip py37 testing for now
yck011522 Jan 30, 2024
1365693
Revert "skip py37 testing for now"
yck011522 Jan 30, 2024
33dfb2b
Fixed and Skipped some DocTest related to printing str representation
yck011522 Jan 30, 2024
c488225
Fixed some errors in docs
yck011522 Jan 30, 2024
cf71dfc
Update build.yml to drop python 3.7
yck011522 Jan 31, 2024
81b3238
Update setup.py to remove python 3.7 and older
yck011522 Jan 31, 2024
cee550d
Fix LocalPackageMeshLoader load location
yck011522 Jan 31, 2024
b22b981
Update build.yml for installing compas_robot
yck011522 Feb 2, 2024
6e2f37b
Update build.yml IPY points to compas 2.0.1
yck011522 Feb 2, 2024
ea5ea34
Update requirements.txt compas 2.0.1
yck011522 Feb 2, 2024
014b88e
Update .github/workflows/build.yml
gonzalocasas Feb 6, 2024
a232baa
Update requirements.txt
gonzalocasas Feb 6, 2024
d19e54f
Update src/compas_fab/robots/reachability_map/reachability_map.py
gonzalocasas Feb 6, 2024
ea14404
Update src/compas_fab/robots/reachability_map/reachability_map.py
gonzalocasas Feb 6, 2024
d1f6600
Update src/compas_fab/robots/reachability_map/reachability_map.py
gonzalocasas Feb 6, 2024
161ce22
Update src/compas_fab/robots/robot.py
gonzalocasas Feb 6, 2024
ed4c0d5
Update src/compas_fab/robots/semantics.py
gonzalocasas Feb 6, 2024
861d756
Merge branch 'compas-2.x-compat' into support_private_data
gonzalocasas Feb 6, 2024
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
10 changes: 6 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ jobs:
matrix:
name: [
"windows-py38",
"macos-py37",
"macos-py39",
"ubuntu-py39",
]
include:
- name: "windows-py38"
os: windows-latest
python-version: 3.8
- name: "macos-py37"
- name: "macos-py39"
os: macos-latest
python-version: 3.7
python-version: 3.9
- name: "ubuntu-py39"
os: ubuntu-latest
python-version: 3.9
Expand Down Expand Up @@ -57,14 +57,16 @@ jobs:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
curl -o compas.tar.gz -LJO https://pypi.debian.net/COMPAS/COMPAS-1.17.7.tar.gz
curl -o compas.tar.gz -LJO https://pypi.debian.net/COMPAS/COMPAS-2.0.1.tar.gz
curl -o roslibpy.tar.gz -LJO https://pypi.debian.net/roslibpy/latest
curl -o ironpython-pytest.tar.gz -LJO https://pypi.debian.net/ironpython-pytest/latest
curl -o compas_robots.tar.gz -LJO https://pypi.debian.net/compas_robots/latest
choco install ironpython --version=2.7.8.1
ipy -X:Frames -m ensurepip
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 ironpython-pytest.tar.gz
ipy -X:Frames -m pip install --no-deps compas_robots.tar.gz
- name: Run tests
env:
IRONPYTHONPATH: ./src
Expand Down
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ Authors
* Yijiang Huang <[email protected]> `@yijiangh <https://github.com/yijiangh>`_
* Chen Kasirer <[email protected]> `@chenkasirer <https://github.com/chenkasirer>`_
* Edvard Bruun <[email protected]> `@ebruun <https://github.com/ebruun>`_
* Victor Pok Yin Leung <[email protected]> `@yck011522 <https://github.com/yck011522>`_

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Migrate to COMPAS 2.x: add dependency to `compas_robots`
* Migrate to COMPAS 2.x: use `compas.tolerance` module instead of `compas.PRECISION`
* Changed base class of `Trajectory` to be `compas.datastructures.Datastructure`, which adds `attributes` to it.
* Fixed `data` serialization API to comply with `COMPAS 2.0` private data API.

### Removed

Expand Down
6 changes: 3 additions & 3 deletions docs/examples/01_fundamentals/02_coordinate_frames.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ before sending it as a target pose to the robot.

from compas_fab.robots import Robot

from compas.robots import RobotModel
from compas.robots import Joint
from compas.robots import Link
from compas_robots import RobotModel
from compas_robots.model import Joint
from compas_robots.model import Link

from compas.geometry import Frame
from compas.geometry import Transformation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
brick = Box.from_width_height_depth(0.11, 0.07, 0.25)

for i in range(5):
mesh = Mesh.from_vertices_and_faces(brick.vertices, brick.faces)
mesh = brick.to_mesh(triangulated=True)
cm = CollisionMesh(mesh, 'brick')
cm.frame.point.y += 0.5
cm.frame.point.z += brick.zsize * i
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import time

from compas.datastructures import Mesh
from compas_robots import LocalPackageMeshLoader
from compas_robots.resources import LocalPackageMeshLoader

import compas_fab
from compas_fab.backends import PyBulletClient
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/07_reachability_map/01_reachability_map.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ because the ``ReachabilityMap`` takes a ``Frame`` generator as input.
from compas.geometry import Sphere

# 1. Define frames on a sphere
sphere = Sphere((0.4, 0, 0), 0.15)
sphere = Sphere(radius=0.15, point=[0.4, 0, 0])

def points_on_sphere_generator(sphere):
for theta_deg in range(0, 360, 20):
Expand Down
26 changes: 13 additions & 13 deletions docs/examples/07_reachability_map/02_vector_generators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ In the example below, the given axis is visualized in red, and the generated vec
>>> max_alpha = 60
>>> for xaxis in OrthonormalVectorsFromAxisGenerator(zaxis, math.radians(max_alpha)):
... print(xaxis)
Vector(0.000, -1.000, 0.000)
Vector(0.866, -0.500, 0.000)
Vector(0.866, 0.500, 0.000)
Vector(0.000, 1.000, 0.000)
Vector(-0.866, 0.500, 0.000)
Vector(-0.866, -0.500, 0.000)
Vector(x=0.000, y=-1.000, z=0.000)
Vector(x=0.866, y=-0.500, z=0.000)
Vector(x=0.866, y=0.500, z=0.000)
Vector(x=0.000, y=1.000, z=0.000)
Vector(x=-0.866, y=0.500, z=0.000)
Vector(x=-0.866, y=-0.500, z=0.000)


Generate vectors that deviate
Expand All @@ -54,13 +54,13 @@ In the example below, the given axis is visualized in red, and the generated vec
>>> step = 1
>>> for axis in DeviationVectorsGenerator(zaxis, math.radians(max_alpha), step):
... print(axis)
Vector(0.000, 0.000, 1.000)
Vector(-0.643, 0.000, 0.766)
Vector(-0.321, -0.557, 0.766)
Vector(0.321, -0.557, 0.766)
Vector(0.643, -0.000, 0.766)
Vector(0.321, 0.557, 0.766)
Vector(-0.321, 0.557, 0.766)
Vector(x=0.000, y=0.000, z=1.000)
Vector(x=-0.643, y=0.000, z=0.766)
Vector(x=-0.321, y=-0.557, z=0.766)
Vector(x=0.321, y=-0.557, z=0.766)
Vector(x=0.643, y=-0.000, z=0.766)
Vector(x=0.321, y=0.557, z=0.766)
Vector(x=-0.321, y=0.557, z=0.766)


Or another example with using ``max_angle = 60`` and ``step = 2``.
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
compas >= 2.0.0b2
compas_robots >= 0.1.0, < 1
compas >= 2.0.1
compas_robots >= 0.2.1, < 1
roslibpy >= 1.1.0
pybullet
pyserial
5 changes: 0 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ def read(*names, **kwargs):
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
Expand Down
4 changes: 2 additions & 2 deletions src/compas_fab/backends/kinematics/solvers/spherical_wrist.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ def inverse_kinematics_spherical_wrist(target_frame, points):
Rot1 = Rotation.from_axis_and_angle([0, 0, 1], -1 * axis1_angle, point=[0, 0, 0])
p1A = p1_proj.transformed(Rot1)
elbow_dir = Vector(1, 0, 0).transformed(Rot1)
sphere1 = Sphere(lower_arm_length, p1A)
sphere2 = Sphere(upper_arm_length, wrist)
sphere1 = Sphere(lower_arm_length, point=p1A)
sphere2 = Sphere(upper_arm_length, point=wrist)
elbow_frame = Frame(p1A, elbow_dir, [0, 0, 1])
elbow_plane = (p1A, elbow_frame.normal)

Expand Down
10 changes: 6 additions & 4 deletions src/compas_fab/backends/pybullet/planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

from compas_fab.backends.interfaces.client import PlannerInterface
from compas_fab.backends.interfaces.client import forward_docstring
from compas_fab.backends.pybullet.backend_features.pybullet_add_attached_collision_mesh import \
PyBulletAddAttachedCollisionMesh
from compas_fab.backends.pybullet.backend_features.pybullet_add_attached_collision_mesh import (
PyBulletAddAttachedCollisionMesh,
)
from compas_fab.backends.pybullet.backend_features.pybullet_add_collision_mesh import PyBulletAddCollisionMesh
from compas_fab.backends.pybullet.backend_features.pybullet_append_collision_mesh import PyBulletAppendCollisionMesh
from compas_fab.backends.pybullet.backend_features.pybullet_forward_kinematics import PyBulletForwardKinematics
from compas_fab.backends.pybullet.backend_features.pybullet_inverse_kinematics import PyBulletInverseKinematics
from compas_fab.backends.pybullet.backend_features.pybullet_remove_attached_collision_mesh import \
PyBulletRemoveAttachedCollisionMesh
from compas_fab.backends.pybullet.backend_features.pybullet_remove_attached_collision_mesh import (
PyBulletRemoveAttachedCollisionMesh,
)
from compas_fab.backends.pybullet.backend_features.pybullet_remove_collision_mesh import PyBulletRemoveCollisionMesh

__all__ = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from compas_fab.backends.ros.messages import RobotState
from compas_fab.backends.ros.messages import RosDistro
from compas_fab.backends.ros.service_description import ServiceDescription
from compas_fab.robots import Duration

__all__ = [
"MoveItInverseKinematics",
Expand Down Expand Up @@ -121,7 +120,7 @@ def inverse_kinematics_async(
constraints = convert_constraints_to_rosmsg(options.get("constraints"), header)

timeout_in_secs = options.get("timeout", 2)
timeout_duration = Duration(timeout_in_secs, 0).to_data()
timeout_duration = {"secs": timeout_in_secs, "nsecs": 0}

ik_request = PositionIKRequest(
group_name=group,
Expand Down
1 change: 0 additions & 1 deletion src/compas_fab/backends/ros/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import os

from compas.tolerance import TOL
from compas_robots import RobotModel
from roslibpy import Message
from roslibpy import Param
Expand Down
4 changes: 2 additions & 2 deletions src/compas_fab/backends/ros/messages/geometry_msgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class Wrench(ROSmsg):
>>> ros_wrench.msg
{'force': {'x': 0.0, 'y': 0.0, 'z': -98.0}, 'torque': {'x': 0.0, 'y': 0.0, 'z': 0.0}}
>>> ros_wrench.wrench
Wrench(Vector(0.000, 0.000, -98.000), Vector(0.000, 0.000, 0.000))
Wrench(Vector(x=0.0, y=0.0, z=-98.0), Vector(x=0.0, y=0.0, z=0.0))
"""

ROS_MSG_TYPE = "geometry_msgs/Wrench"
Expand Down Expand Up @@ -206,7 +206,7 @@ class Inertia(ROSmsg):
>>> 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}
>>> ros_inertia.inertia
Inertia([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]], 1.0, Point(0.100, 3.100, 4.400))
Inertia([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]], 1.0, Point(x=0.1, y=3.1, z=4.4))
"""

ROS_MSG_TYPE = "geometry_msgs/Inertia"
Expand Down
6 changes: 4 additions & 2 deletions src/compas_fab/backends/ros/planner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Internal implementation of the planner backend interface for MoveIt!
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
Expand All @@ -16,8 +17,9 @@
from compas_fab.backends.ros.backend_features.move_it_plan_cartesian_motion import MoveItPlanCartesianMotion
from compas_fab.backends.ros.backend_features.move_it_plan_motion import MoveItPlanMotion
from compas_fab.backends.ros.backend_features.move_it_planning_scene import MoveItPlanningScene
from compas_fab.backends.ros.backend_features.move_it_remove_attached_collision_mesh import \
MoveItRemoveAttachedCollisionMesh
from compas_fab.backends.ros.backend_features.move_it_remove_attached_collision_mesh import (
MoveItRemoveAttachedCollisionMesh,
)
from compas_fab.backends.ros.backend_features.move_it_remove_collision_mesh import MoveItRemoveCollisionMesh

__all__ = [
Expand Down
1 change: 1 addition & 0 deletions src/compas_fab/backends/ros/service_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
This is only internal, these interfaces and their implementations
are managed internally by the RosClient class.
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
Expand Down
1 change: 1 addition & 0 deletions src/compas_fab/blender/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
of the CAD environment.

"""

try:
import bpy # noqa: F401
import mathutils # noqa: F401
Expand Down
1 change: 1 addition & 0 deletions src/compas_fab/ghpython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@


"""

import compas

if compas.RHINO:
Expand Down
1 change: 1 addition & 0 deletions src/compas_fab/ghpython/components/Cf_AttachTool/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

from compas.geometry import Frame
from compas_rhino.conversions import mesh_to_compas
from compas_rhino.conversions import plane_to_compas_frame
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

from compas_rhino.conversions import mesh_to_compas
from ghpythonlib.componentbase import executingcomponent as component

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

from compas_rhino.conversions import mesh_to_compas
from ghpythonlib.componentbase import executingcomponent as component

Expand Down
1 change: 1 addition & 0 deletions src/compas_fab/ghpython/components/Cf_ConfigMerge/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

from ghpythonlib.componentbase import executingcomponent as component


Expand Down
1 change: 1 addition & 0 deletions src/compas_fab/ghpython/components/Cf_ConfigZero/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

from ghpythonlib.componentbase import executingcomponent as component


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

import math

from ghpythonlib.componentbase import executingcomponent as component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

import math

from compas_rhino.conversions import plane_to_compas_frame
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

from ghpythonlib.componentbase import executingcomponent as component


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

from compas_rhino.conversions import plane_to_compas_frame
from ghpythonlib.componentbase import executingcomponent as component

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

from compas_rhino.conversions import plane_to_compas_frame
from ghpythonlib.componentbase import executingcomponent as component
from scriptcontext import sticky as st
Expand Down
1 change: 1 addition & 0 deletions src/compas_fab/ghpython/components/Cf_PlanMotion/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

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

Expand Down
1 change: 1 addition & 0 deletions src/compas_fab/ghpython/components/Cf_RosConnect/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

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

Expand Down
1 change: 1 addition & 0 deletions src/compas_fab/ghpython/components/Cf_RosRobot/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

from compas.scene import SceneObject
from ghpythonlib.componentbase import executingcomponent as component
from scriptcontext import sticky as st
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

import time

from ghpythonlib.componentbase import executingcomponent as component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

COMPAS FAB v0.28.0
"""

import time

import Grasshopper.Kernel
Expand Down
Loading
Loading