rational-linkages 2.0.0__cp310-cp310-macosx_12_0_arm64.whl → 2.2.3__cp310-cp310-macosx_12_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rational_linkages/CollisionAnalyser.py +323 -21
- rational_linkages/CollisionFreeOptimization.py +8 -4
- rational_linkages/DualQuaternion.py +5 -2
- rational_linkages/ExudynAnalysis.py +2 -1
- rational_linkages/FactorizationProvider.py +6 -5
- rational_linkages/MiniBall.py +9 -2
- rational_linkages/MotionApproximation.py +7 -3
- rational_linkages/MotionDesigner.py +553 -540
- rational_linkages/MotionFactorization.py +6 -5
- rational_linkages/MotionInterpolation.py +7 -7
- rational_linkages/NormalizedLine.py +1 -1
- rational_linkages/NormalizedPlane.py +1 -1
- rational_linkages/Plotter.py +1 -1
- rational_linkages/PlotterMatplotlib.py +27 -13
- rational_linkages/PlotterPyqtgraph.py +596 -534
- rational_linkages/PointHomogeneous.py +6 -3
- rational_linkages/RationalBezier.py +64 -4
- rational_linkages/RationalCurve.py +13 -5
- rational_linkages/RationalDualQuaternion.py +5 -4
- rational_linkages/RationalMechanism.py +48 -33
- rational_linkages/SingularityAnalysis.py +4 -5
- rational_linkages/StaticMechanism.py +4 -5
- rational_linkages/__init__.py +3 -2
- rational_linkages/utils.py +60 -3
- rational_linkages/utils_rust.cpython-310-darwin.so +0 -0
- {rational_linkages-2.0.0.dist-info → rational_linkages-2.2.3.dist-info}/METADATA +32 -18
- rational_linkages-2.2.3.dist-info/RECORD +40 -0
- rational_linkages-2.0.0.dist-info/RECORD +0 -40
- {rational_linkages-2.0.0.dist-info → rational_linkages-2.2.3.dist-info}/WHEEL +0 -0
- {rational_linkages-2.0.0.dist-info → rational_linkages-2.2.3.dist-info}/licenses/LICENSE +0 -0
- {rational_linkages-2.0.0.dist-info → rational_linkages-2.2.3.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,8 @@
|
|
1
1
|
from typing import Union
|
2
2
|
|
3
3
|
import numpy as np
|
4
|
-
|
4
|
+
|
5
|
+
from sympy import Symbol, Poly
|
5
6
|
|
6
7
|
from .DualQuaternion import DualQuaternion
|
7
8
|
from .Linkage import Linkage
|
@@ -81,7 +82,7 @@ class MotionFactorization(RationalCurve):
|
|
81
82
|
|
82
83
|
@staticmethod
|
83
84
|
def get_polynomials_from_factorization(factors: list[DualQuaternion]) -> (
|
84
|
-
list)[
|
85
|
+
list)[Poly]:
|
85
86
|
"""
|
86
87
|
Construct rational curve from Dual Quaternions equation factors
|
87
88
|
|
@@ -91,14 +92,14 @@ class MotionFactorization(RationalCurve):
|
|
91
92
|
:return: motion curve using Sympy polynomials
|
92
93
|
:rtype: RationalCurve
|
93
94
|
"""
|
94
|
-
t =
|
95
|
+
t = Symbol("t")
|
95
96
|
|
96
97
|
polynomial_t = DualQuaternion([t, 0, 0, 0, 0, 0, 0, 0])
|
97
98
|
polynomials_dq = DualQuaternion()
|
98
99
|
for i in range(len(factors)):
|
99
100
|
polynomials_dq = polynomials_dq * (polynomial_t - factors[i])
|
100
101
|
|
101
|
-
return [
|
102
|
+
return [Poly(polynom, t)
|
102
103
|
for i, polynom in enumerate(polynomials_dq.array())]
|
103
104
|
|
104
105
|
def get_symbolic_factors(self) -> list[DualQuaternion]:
|
@@ -108,7 +109,7 @@ class MotionFactorization(RationalCurve):
|
|
108
109
|
:return: list of DualQuaternions representing the curve
|
109
110
|
:rtype: list[DualQuaternion]
|
110
111
|
"""
|
111
|
-
t =
|
112
|
+
t = Symbol("t")
|
112
113
|
polynomial_t = DualQuaternion([t, 0, 0, 0, 0, 0, 0, 0])
|
113
114
|
return [polynomial_t - self.dq_axes[i] for i in range(len(self.dq_axes))]
|
114
115
|
|
@@ -1,20 +1,20 @@
|
|
1
|
-
from typing import Union
|
2
1
|
from copy import deepcopy
|
2
|
+
from typing import Union
|
3
3
|
from warnings import warn
|
4
4
|
|
5
|
-
import sympy as sp
|
6
5
|
import numpy as np
|
6
|
+
import sympy as sp
|
7
7
|
|
8
8
|
from .DualQuaternion import DualQuaternion
|
9
|
-
from .RationalCurve import RationalCurve
|
10
|
-
from .RationalDualQuaternion import RationalDualQuaternion
|
11
|
-
from .TransfMatrix import TransfMatrix
|
12
9
|
from .PointHomogeneous import PointHomogeneous
|
13
10
|
from .Quaternion import Quaternion
|
14
11
|
from .RationalBezier import RationalBezier
|
15
|
-
|
12
|
+
from .RationalCurve import RationalCurve
|
13
|
+
from .RationalDualQuaternion import RationalDualQuaternion
|
14
|
+
from .TransfMatrix import TransfMatrix
|
16
15
|
from .utils_rust import motion_interp_x3
|
17
16
|
|
17
|
+
|
18
18
|
class MotionInterpolation:
|
19
19
|
"""
|
20
20
|
Method for interpolation of poses by rational motion curve in SE(3).
|
@@ -367,7 +367,7 @@ class MotionInterpolation:
|
|
367
367
|
:return: Polynomials of rational motion curve.
|
368
368
|
:rtype: list[sp.Poly]
|
369
369
|
"""
|
370
|
-
from scipy.optimize import minimize #
|
370
|
+
from scipy.optimize import minimize # lazy import
|
371
371
|
|
372
372
|
mid_pose = DualQuaternion.random_on_study_quadric()
|
373
373
|
mid_pose_tr = TransfMatrix(mid_pose.dq2matrix())
|
rational_linkages/Plotter.py
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
from functools import wraps
|
2
2
|
from itertools import cycle
|
3
|
-
from os.path import join, isdir
|
4
3
|
from os import makedirs
|
4
|
+
from os.path import isdir, join
|
5
|
+
from warnings import warn
|
5
6
|
|
6
7
|
import numpy as np
|
7
|
-
import matplotlib
|
8
|
-
import matplotlib.pyplot as plt
|
9
|
-
from matplotlib.widgets import Slider, TextBox
|
10
8
|
|
11
9
|
from .DualQuaternion import DualQuaternion
|
10
|
+
from .Linkage import LineSegment
|
11
|
+
from .MiniBall import MiniBall
|
12
12
|
from .MotionFactorization import MotionFactorization
|
13
13
|
from .NormalizedLine import NormalizedLine
|
14
14
|
from .PointHomogeneous import PointHomogeneous, PointOrbit
|
@@ -16,8 +16,20 @@ from .RationalBezier import RationalBezier
|
|
16
16
|
from .RationalCurve import RationalCurve
|
17
17
|
from .RationalMechanism import RationalMechanism
|
18
18
|
from .TransfMatrix import TransfMatrix
|
19
|
-
|
20
|
-
|
19
|
+
|
20
|
+
# Try importing GUI components
|
21
|
+
try:
|
22
|
+
import matplotlib
|
23
|
+
import matplotlib.pyplot as plt
|
24
|
+
from matplotlib.widgets import Slider, TextBox
|
25
|
+
|
26
|
+
except (ImportError, OSError):
|
27
|
+
warn("Failed to import Matplotlib. Check the package installation.")
|
28
|
+
|
29
|
+
matplotlib = None
|
30
|
+
plt = None
|
31
|
+
Slider = None
|
32
|
+
TextBox = None
|
21
33
|
|
22
34
|
|
23
35
|
class PlotterMatplotlib:
|
@@ -501,23 +513,25 @@ class PlotterMatplotlib:
|
|
501
513
|
show_tool = kwargs.pop('show_tool', False)
|
502
514
|
t = kwargs.pop('t', 0)
|
503
515
|
|
516
|
+
self._plot_tool_path(mechanism, **kwargs)
|
517
|
+
|
504
518
|
# plot factorizations
|
505
519
|
for factorization in mechanism.factorizations:
|
506
|
-
self._plot_motion_factorization(factorization, t=t, **kwargs)
|
520
|
+
self._plot_motion_factorization(factorization, t=t, **kwargs, color='black')
|
507
521
|
|
508
522
|
if show_tool:
|
509
523
|
# plot end effector triangle
|
510
|
-
pts0 = mechanism.factorizations[0].direct_kinematics_of_tool_with_link(
|
511
|
-
|
524
|
+
pts0 = mechanism.factorizations[0].direct_kinematics_of_tool_with_link(
|
525
|
+
t, mechanism.tool_frame.dq2point_via_matrix())
|
526
|
+
pts1 = mechanism.factorizations[1].direct_kinematics_of_tool_with_link(
|
527
|
+
t, mechanism.tool_frame.dq2point_via_matrix())[::-1]
|
512
528
|
ee_points = np.concatenate((pts0, pts1))
|
513
529
|
|
514
530
|
if 'label' not in kwargs:
|
515
531
|
kwargs['label'] = "end effector"
|
516
532
|
|
517
533
|
x, y, z = zip(*ee_points)
|
518
|
-
self.ax.plot(x, y, z, **kwargs)
|
519
|
-
|
520
|
-
self._plot_tool_path(mechanism, **kwargs)
|
534
|
+
self.ax.plot(x, y, z, color='black', **kwargs)
|
521
535
|
|
522
536
|
@_plotting_decorator
|
523
537
|
def _plot_tool_path(self, mechanism: RationalMechanism, **kwargs):
|
@@ -930,7 +944,7 @@ class PlotterMatplotlib:
|
|
930
944
|
:param list list_of_angles: list of joint angles
|
931
945
|
:param float sleep_time: time to wait between each frame
|
932
946
|
"""
|
933
|
-
from time import sleep #
|
947
|
+
from time import sleep # lazy import
|
934
948
|
|
935
949
|
t_angle = list_of_angles
|
936
950
|
|