Skip to content

Commit 340bb00

Browse files
committed
generate markdown table for inclusion in wiki
better table formatting
1 parent f1a7b82 commit 340bb00

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

roboticstoolbox/robot/ikine_evaluate.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
T = SE3(0.7, 0.2, 0.1) * SE3.OA([0, 1, 0], [0, 0, -1])
2424
q0 = robot.qz
2525

26+
2627
# build the list of IK methods to test
2728
# it's a tuple:
2829
# - the method to execute
@@ -44,7 +45,11 @@
4445
(lambda T, q0: robot.ikine_min(T, q0, qlim=True), #numerical solution with constraints
4546
"ikine_min(qlim=True)",
4647
"sol = robot.ikine_min(T, q0, qlim=True)"
47-
)
48+
),
49+
# (robot.ikine_mmc, #numerical solution with no constraints
50+
# "ikine_min(qlim=False)",
51+
# "sol = robot.ikine_min(T, q0)"
52+
# ),
4853
]
4954
if hasattr(robot, "ikine_a"):
5055
a = (robot.ikine_a, # analytic solution
@@ -61,8 +66,8 @@
6166

6267
# setup results table
6368
table = ANSITable(
64-
Column("Operation", headalign="^"),
65-
Column("Time (μs)", headalign="^", fmt="{:.2f}"),
69+
Column("Operation", headalign="^", colalign='<'),
70+
Column("Time (ms)", headalign="^", fmt="{:.2g}"),
6671
Column("Error", headalign="^", fmt="{:.3g}"),
6772
border="thick")
6873

@@ -91,7 +96,8 @@
9196
t = 0
9297

9398
# add it to the output table
94-
table.row(ik[1], t/N*1e6, err)
99+
table.row(f"`{ik[1]}`", t/N*1e3, err)
95100

96101
# pretty print the results
97102
table.print()
103+
print(table.markdown())

0 commit comments

Comments
 (0)