rational-linkages 2.1.0__cp311-cp311-musllinux_1_2_aarch64.whl → 2.2.3__cp311-cp311-musllinux_1_2_aarch64.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.
@@ -1,7 +1,8 @@
1
1
  from typing import Union
2
2
 
3
3
  import numpy as np
4
- import sympy as sp
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)[sp.Poly]:
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 = sp.Symbol("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 [sp.Poly(polynom, t)
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 = sp.Symbol("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
 
@@ -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 # inner import
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())
@@ -2,11 +2,9 @@ from functools import wraps
2
2
  from itertools import cycle
3
3
  from os import makedirs
4
4
  from os.path import isdir, join
5
+ from warnings import warn
5
6
 
6
- import matplotlib
7
- import matplotlib.pyplot as plt
8
7
  import numpy as np
9
- from matplotlib.widgets import Slider, TextBox
10
8
 
11
9
  from .DualQuaternion import DualQuaternion
12
10
  from .Linkage import LineSegment
@@ -19,6 +17,20 @@ from .RationalCurve import RationalCurve
19
17
  from .RationalMechanism import RationalMechanism
20
18
  from .TransfMatrix import TransfMatrix
21
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
33
+
22
34
 
23
35
  class PlotterMatplotlib:
24
36
  def __init__(self,
@@ -932,7 +944,7 @@ class PlotterMatplotlib:
932
944
  :param list list_of_angles: list of joint angles
933
945
  :param float sleep_time: time to wait between each frame
934
946
  """
935
- from time import sleep # inner import
947
+ from time import sleep # lazy import
936
948
 
937
949
  t_angle = list_of_angles
938
950