Typing issue with ik
Adam-McClenaghan opened this issue · 0 comments
Describe the bug
This bug is a typing issue only, the code still runs correctly, but provides a typing error when using the ik_GN / ik_NR / ik_LM methods on a DH robot. The issue arises when using pylance and VSCode. The error occurs on all DHRobot models.
Version information
Roboticstoolbox installed via pyPI version 1.1.0
SpatialMath version 1.1.8
To Reproduce
Steps to reproduce the behavior:
import roboticstoolbox as rtb
from spatialmath import SE3
robot_1 = rtb.models.DH.KR5()
Test_pose = [0.4, 0.4, 1]
path = SE3().Trans(Test_pose)
InverseKins = robot_1.ik_GN(path)
print(InverseKins)
OUTPUT:
(array([ 0.78539657, -1.9870128 , 0.70859403, -3.14159021, 1.86320299,
-5.49780081]), 1, 121, 10, 7.202483720039119e-10)
The script provides the correct output, but the error is thrown for ik_GN(). The error message reads:
Could not bind method "ik_GN" because "KR5" is not assignable to parameter "self"
"KR5" is incompatible with protocol "KinematicsProtocol"
"_T" is an incompatible type
Type "List[NDArray[Unknown]] | NDArray[Unknown] | NDArray" cannot be assigned to type "NDArray"
"List[NDArray[Unknown]]" is incompatible with "NDArray"PylancereportGeneralTypeIssues
Expected behavior
The ik_GN method should not give a type error
Environment (please complete the following information):
MacOS Monterey 12.6, python 3.10.6, using VSCode and pylance
Additional context
Having looked through the class inheritance and function, it looks like ik_GN requires KinematicsProtocol but it doesn't look like DHRobot inherits from this.