8000 New file formats for Swift · Global19/robotics-toolbox-python@448247e · GitHub
[go: up one dir, main page]

Skip to content

Commit 448247e

Browse files
committed
New file formats for Swift
1 parent 8bea4b6 commit 448247e

File tree

9 files changed

+398361
-39
lines changed

9 files changed

+398361
-39
lines changed

examples/gimbal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
env = rtb.backends.Swift()
1717
env.launch()
1818

19-
path = pathlib.Path(path) / 'roboticstoolbox' / 'data'
19+
path = pathlib.Path(path) / 'rtb-data' / 'rtbdata' / 'data'
2020

2121

2222
g1 = rtb.Mesh(

examples/test.py

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,66 +3,68 @@
33
# @author Jesse Haviland
44
# """
55

6+
from math import pi
67
import roboticstoolbox as rtb
7-
import spatialmath as sm
8+
from spatialmath import SO3, SE3
89
import numpy as np
910
import pathlib
1011
import os
12+
import time
1113

1214
path = os.path.realpath('.')
1315

1416
# Launch the simulator Swift
1517
env = rtb.backends.Swift()
1618
env.launch()
1719

18-
path = pathlib.Path(path) / 'roboticstoolbox' / 'data'
20+
path = pathlib.Path(path) / 'rtb-data' / 'rtbdata' / 'data' / 'test-mesh'
1921

20-
g1 = rtb.Mesh(
21-
filename=str(path / 'gimbal-ring1.stl'),
22-
base=sm.SE3(0, 0, 1.3)
23-
)
24-
# g1.v = [0, 0, 0, 0.4, 0, 0]
2522

26-
g2 = rtb.Mesh(
27-
filename=str(path / 'gimbal-ring2.stl'),
28-
base=sm.SE3(0, 0, 1.3) * sm.SE3.Rz(np.pi/2)
29-
)
30-
g2.v = [0, 0, 0, 0.4, 0.0, 0]
23+
# obj_bug = rtb.Mesh(
24+
# filename=str(path / 'scene.gltf'),
25+
# scale=[0.001, 0.001, 0.001],
26+
# base=SE3(0, 0, 0.45) * SE3.Rx(np.pi/2) * SE3.Ry(np.pi/2)
27+
# )
3128

32-
g3 = rtb.Mesh(
33-
filename=str(path / 'gimbal-ring3.stl'),
34-
base=sm.SE3(0, 0, 1.3)
29+
dae = rtb.Mesh(
30+
filename=str(path / 'walle.dae'),
31+
base=SE3(0, -1.5, 0)
3532
)
36-
g3.v = [0, 0, 0, 0.4, 0, 0]
37-
38-
env.add(g1)
39-
env.add(g2)
40-
env.add(g3)
4133

34+
obj = rtb.Mesh(
35+
filename=str(path / 'walle.obj'),
36+
base=SE3(0, -0.5, 0)
37+
)
4238

43-
panda = rtb.models.Panda()
44-
panda.q = panda.qr
45-
env.add(panda)
39+
glb = rtb.Mesh(
40+
filename=str(path / 'walle.glb'),
41+
base=SE3(0, 0.5, 0) * SE3.Rz(-np.pi/2)
42+
)
4643

47-
j = 0
44+
ply = rtb.Mesh(
45+
filename=str(path / 'walle.ply'),
46+
base=SE3(0, 1.5, 0)
47+
)
4848

49+
# wrl = rtb.Mesh(
50+
# filename=str(path / 'walle.wrl'),
51+
# base=SE3(0, 2.0, 0)
52+
# )
4953

50-
def set_joint(j, x):
51-
print(j)
52-
panda.q[j] = x
54+
pcd = rtb.Mesh(
55+
filename=str(path / 'pcd.pcd'),
56+
base=SE3(0, 0, 1.5) * SE3.Rx(np.pi/2) * SE3.Ry(np.pi/2)
57+
)
5358

5459

55-
for link in panda.links:
56-
if link.isjoint:
60+
env.add(dae)
61+
env.add(obj)
62+
env.add(glb)
63+
env.add(ply)
64+
env.add(pcd)
5765

58-
env.add_slider(
59-
lambda x, j=j: set_joint(j, x),
60-
min=link.qlim[0], max=link.qlim[1],
61-
step=0.01, value=panda.q[j],
62-
desc='Panda Joint ' + str(j))
63-
64-
j += 1
66+
time.sleep(2)
6567

6668
while(True):
67-
env.process_events()
68-
env.step(0.05)
69+
# env.process_events()
70+
env.step(0)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Model Information:
2+
* title: Course asset (Wall-E FanArt)
3+
* source: https://sketchfab.com/3d-models/course-asset-wall-e-fanart-a867551a62f04527af338b7699c1bdee
4+
* author: VIvern (https://sketchfab.com/VIvern)
5+
6+
Model License:
7+
* license type: CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
8+
* requirements: Author must be credited. Commercial use is allowed.
9+
10+
If you use this 3D model in your project be sure to copy paste this credit wherever you share it:
11+
This work is based on "Course asset (Wall-E FanArt)" (https://sketchfab.com/3d-models/course-asset-wall-e-fanart-a867551a62f04527af338b7699c1bdee) by VIvern (https://sketchfab.com/VIvern) licensed under CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)

0 commit comments

Comments
 (0)
0