Skip to content

Commit 6c406f0

Browse files
committed
Fix more types
1 parent 6c1d3f0 commit 6c406f0

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

roboticstoolbox/robot/IK.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
import roboticstoolbox as rtb
1111
from dataclasses import dataclass
1212
from spatialmath import SE3
13-
from roboticstoolbox.tools.types import ArrayLike
13+
from roboticstoolbox.tools.types import ArrayLike, NDArray
14+
1415

1516
try:
1617
import qpsolvers as qp
@@ -395,7 +396,7 @@ def error(self, Te: np.ndarray, Tep: np.ndarray) -> Tuple[np.ndarray, float]:
395396
396397
"""
397398
e = rtb.angle_axis(Te, Tep)
398-
E = 0.5 * e @ self.We @ e
399+
E = float(0.5 * e @ self.We @ e)
399400

400401
return e, E
401402

@@ -503,7 +504,7 @@ def _check_jl(self, ets: "rtb.ETS", q: np.ndarray) -> bool:
503504
return True
504505

505506

506-
def _null_Σ(ets: "rtb.ETS", q: np.ndarray, ps: float, pi: Union[np.ndarray, float]):
507+
def _null_Σ(ets: "rtb.ETS", q: NDArray, ps: float, pi: Union[NDArray, float]):
507508
"""
508509
Formulates a relationship between joint limits and the joint velocity.
509510
When this is projected into the null-space of the differential kinematics
@@ -518,7 +519,7 @@ def _null_Σ(ets: "rtb.ETS", q: np.ndarray, ps: float, pi: Union[np.ndarray, flo
518519
:return: Σ
519520
"""
520521

521-
if isinstance(pi, float):
522+
if isinstance(pi, float) or isinstance(pi, int):
522523
pi = pi * np.ones(ets.n)
523524

524525
# Add cost to going in the direction of joint limits, if they are within
@@ -1451,7 +1452,7 @@ def step(
14511452
e, E = self.error(Te, Tep)
14521453
J = ets.jacob0(q)
14531454

1454-
if isinstance(self.pi, float):
1455+
if isinstance(self.pi, float) or isinstance(self.pi, int):
14551456
self.pi = self.pi * np.ones(ets.n)
14561457

14571458
# Quadratic component of objective function

roboticstoolbox/tools/p_servo.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
import math
66
from typing import Union
77
from roboticstoolbox.fknm import Angle_Axis
8+
from roboticstoolbox.tools.types import NDArray, ArrayLike
89

9-
ArrayLike = Union[list, np.ndarray, tuple, set]
10+
# ArrayLike = Union[list, np.ndarray, tuple, set]
1011

1112

12-
def angle_axis(T, Td):
13+
def angle_axis(T, Td) -> NDArray:
1314

1415
try:
15-
e = Angle_Axis(T, Td)
16+
e: NDArray = Angle_Axis(T, Td)
1617
except BaseException:
1718
e = angle_axis_python(T, Td)
1819

0 commit comments

Comments
 (0)