Create first robot model with symbolic capability
# all parameters are in SI units: m, radians, kg, kg.m2, N.m, N.m.s etc.
-from math import pi
import numpy as np
from roboticstoolbox import DHRobot, RevoluteDH
@@ -54,7 +53,15 @@ class Puma560(DHRobot):
"""
- def __init__(self):
+ def __init__(self, symbolic=False):
+
+ if symbolic:
+ import spatialmath.base.symbolic as sym
+ zero = sym.zero()
+ pi = sym.pi()
+ else:
+ from math import pi
+ zero = 0.0
deg = pi / 180
@@ -82,7 +89,7 @@ class Puma560(DHRobot):
),
RevoluteDH(
- d=0, a=0.4318, alpha=0,
+ d=0, a=0.4318, alpha=zero,
I=[0.13, 0.524, 0.539, 0, 0, 0],
r=[-0.3638, 0.006, 0.2275],
m=17.4,
@@ -130,7 +137,7 @@ class Puma560(DHRobot):
),
RevoluteDH(
- d=0, a=0, alpha=0,
+ d=0, a=0, alpha=zero,
I=[0.15e-3, 0.15e-3, 0.04e-3, 0, 0, 0],
r=[0, 0, 0.032],
m=0.09,
@@ -146,7 +153,7 @@ class Puma560(DHRobot):
L,
name="Puma 560",
manufacturer="Unimation",
- keywords=('dynamics',))
+ keywords=('dynamics', 'symbolic'))
# zero angles, L shaped pose
self.addconfiguration("qz", np.array([0, 0, 0, 0, 0, 0]))
@@ -162,6 +169,6 @@ class Puma560(DHRobot):
if __name__ == '__main__':
- puma = Puma560()
+ puma = Puma560(symbolic=True)
print(puma)
