8000 update examples · Zyszu200/robotics-toolbox-python@d0890eb · GitHub
[go: up one dir, main page]

Skip to content

Commit d0890eb

Browse files
committed
update examples
1 parent 5457950 commit d0890eb

File tree

4 files changed

+31
-32
lines changed

4 files changed

+31
-32
lines changed

roboticstoolbox/examples/plot_swift.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,3 @@
77

88
panda = rp.models.Panda()
99
panda.plot(q=panda.qr)
10-
11-
# panda = rp.models.DH.Panda()
12-
# panda.teach2(q=panda.qr)
Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,51 @@
11
import roboticstoolbox as rtb
2-
from spatialmath import * # lgtm [py/polluting-import]
2+
from spatialmath import * # lgtm [py/polluting-import]
33
import argparse
44
import sys
55

66
parser = argparse.ArgumentParser(description="Puma trajectory demo")
77
parser.add_argument(
8-
'--backend',
9-
'-b',
10-
dest='backend',
11-
default='pyplot',
12-
help='choose backend: pyplot (default), swift, vpython',
13-
action='store')
8+
"--backend",
9+
"-b",
10+
dest="backend",
11+
default="pyplot",
12+
help="choose backend: pyplot (default), swift, vpython",
13+
action="store",
14+
)
1415
parser.add_argument(
15-
'--model',
16-
'-m',
17-
dest='model',
18-
default='DH',
19-
action='store',
20-
help='choose model: DH (default), URDF')
16+
"--model",
17+
"-m",
18+
dest="model",
19+
default="DH",
20+
action="store",
21+
help="choose model: DH (default), URDF",
22+
)
2123
args = parser.parse_args()
2224

23-
if args.model.lower() == 'dh':
25+
if args.model.lower() == "dh":
2426
robot = rtb.models.DH.Puma560()
25-
elif args.model.lower() == 'urdf':
26-
robot = rtb.models.URDF.Puma560()
27+
elif args.model.lower() == "urdf":
28+
robot = rtb.models.Puma560()
2729
else:
28-
raise ValueError('unknown model')
30+
raise ValueError("unknown model")
2931

3032
print(robot)
3133

3234
qt = rtb.tools.trajectory.jtraj(robot.qz, robot.qr, 200)
3335

34-
if args.backend.lower() == 'pyplot':
35-
if args.model.lower() != 'dh':
36-
print('PyPlot only supports DH models for now')
36+
if args.backend.lower() == "pyplot":
37+
if args.model.lower() != "dh":
38+
print("PyPlot only supports DH models for now")
3739
sys.exit(1)
38-
elif args.backend.lower() == 'vpython':
39-
if args.model.lower() != 'dh':
40-
print('VPython only supports DH models for now')
40+
elif args.backend.lower() == "vpython":
41+
if args.model.lower() != "dh":
42+
print("VPython only supports DH models for now")
4143
sys.exit(1)
42-
elif args.backend.lower() == 'swift':
43-
if args.model.lower() != 'urdf':
44-
print('Swift only supports URDF models for now')
44+
elif args.backend.lower() == "swift":
45+
if args.model.lower() != "urdf":
46+
print("Swift only supports URDF models for now")
4547
sys.exit(1)
4648
else:
47-
raise ValueError('unknown backend')
49+
raise ValueError("unknown backend")
4850

4951
robot.plot(qt.q, backend=args.backend)

roboticstoolbox/examples/puma_swift.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# Create a puma in the default zero pose
1515
puma = rp.models.Puma560()
1616
puma.q = puma.qz
17-
env.add(puma, show_robot=True, show_collision=False)
17+
env.add(puma, robot_alpha=True, collision_alpha=False)
1818

1919
dt = 0.05
2020
interp_time = 5

roboticstoolbox/examples/teach_swift.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
env.launch()
1414

1515
# Make a Panda robot and add it to Swift
16-
panda = rtb.models.Panda()
16+
panda = rtb.models.UR5()
1717
panda.q = panda.qr
1818
env.add(panda)
1919

0 commit comments

Comments
 (0)
0