|
12 | 12 | from pathlib import PurePath, PurePosixPath
|
13 | 13 | from scipy.optimize import minimize, Bounds, LinearConstraint
|
14 | 14 | from roboticstoolbox.tools.null import null
|
| 15 | +from ansitable import ANSITable, Column |
15 | 16 |
|
16 | 17 | # TODO maybe this needs to be abstract
|
17 | 18 | # ikine functions need: fkine, jacobe, qlim methods from subclass
|
18 | 19 |
|
19 | 20 | class Robot:
|
20 | 21 |
|
| 22 | + _color = True |
| 23 | + |
21 | 24 | def __init__(
|
22 | 25 | self,
|
23 | 26 | links,
|
@@ -200,17 +203,33 @@ def dyntable(self):
|
200 | 203 | """
|
201 | 204 | Pretty print the dynamic parameters (Robot superclass)
|
202 | 205 |
|
| 206 | + The dynamic parameters are printed in a table, with one row per link. |
| 207 | +
|
203 | 208 | Example:
|
204 | 209 |
|
205 | 210 | .. runblock:: pycon
|
206 | 211 |
|
| 212 | + >>> import roboticstoolbox as rtb |
| 213 | + >>> robot = rtb.models.DH.Puma560() |
| 214 | + >>> robot.links[2].dyntable() |
| 215 | +
|
207 | 216 | >>> import roboticstoolbox as rtb
|
208 | 217 | >>> robot = rtb.models.DH.Puma560()
|
209 | 218 | >>> robot.dyntable()
|
210 | 219 | """
|
| 220 | + table = ANSITable( |
| 221 | + Column("j", colalign=">", headalign="^"), |
| 222 | + Column("m", colalign="<", headalign="^"), |
| 223 | + Column("r", colalign="<", headalign="^"), |
| 224 | + Column("I", colalign="<", headalign="^"), |
| 225 | + Column("Jm", colalign="<", headalign="^"), |
| 226 | + Column("B", colalign="<", headalign="^"), |
| 227 | + Column("Tc", colalign="<", headalign="^"), |
| 228 | + Column("G", colalign="<", headalign="^"), border="thin") |
| 229 | + |
211 | 230 | for j, link in enumerate(self):
|
212 |
| - print(f"Link {j:d}") |
213 |
| - link.dyntable(indent=4) |
| 231 | + table.row(link.name, *link._dyn2list()) |
| 232 | + return str(table) |
214 | 233 |
|
215 | 234 | # --------------------------------------------------------------------- #
|
216 | 235 | @property
|
@@ -1021,7 +1040,7 @@ def cost(x, ub, lb, qm, N):
|
1021 | 1040 | # --------------------------------------------------------------------- #
|
1022 | 1041 |
|
1023 | 1042 | def friction(self, qd):
|
1024 |
| - """ |
| 1043 | + r""" |
1025 | 1044 | Manipulator joint friction (Robot superclass)
|
1026 | 1045 |
|
1027 | 1046 | :param qd: The joint velocities of the robot
|
@@ -1083,19 +1102,16 @@ def nofriction(self, coulomb=True, viscous=False):
|
1083 | 1102 | """
|
1084 | 1103 | Remove manipulator joint friction (Robot superclass)
|
1085 | 1104 |
|
1086 |
| - NFrobot = nofriction(coulomb, viscous) copies the robot and returns |
1087 |
| - a robot with the same parameters except, the Coulomb and/or viscous |
1088 |
| - friction parameter set to zero |
1089 |
| -
|
1090 |
| - NFrobot = nofriction(coulomb, viscous) copies the robot and returns |
1091 |
| - a robot with the same parameters except the Coulomb friction parameter |
1092 |
| - is set to zero |
1093 |
| -
|
1094 |
| - :param coulomb: if True, will set the coulomb friction to 0 |
| 1105 | + :param coulomb: set the Coulomb friction to 0 |
1095 | 1106 | :type coulomb: bool
|
1096 |
| -
|
| 1107 | + :param viscous: set the viscous friction to 0 |
| 1108 | + :type viscous: bool |
1097 | 1109 | :return: A copy of the robot with dynamic parameters perturbed
|
1098 |
| - :rtype: DHRobot |
| 1110 | + :rtype: Robot subclass |
| 1111 | +
|
| 1112 | + ``nofriction()`` copies the robot and returns |
| 1113 | + a robot with the same link parameters except the Coulomb and/or viscous |
| 1114 | + friction parameter are set to zero. |
1099 | 1115 |
|
1100 | 1116 | :seealso: :func:`Robot.friction`, :func:`Link.nofriction`
|
1101 | 1117 | """
|
|
0 commit comments