├── .gitignore
├── Cargo.toml
├── LICENSE
├── README.md
├── assets
├── ctm2f110
│ ├── ctm2f110.bin
│ └── ctm2f110.gltf
└── ur5
│ ├── ur5.bin
│ └── ur5.gltf
├── index.html
├── media
├── demo-web.png
└── demo.png
├── rust-toolchain.toml
└── src
├── draw_trail.rs
├── gripper_ctm2f110.rs
├── main.rs
└── robot_ur5.rs
/.gitignore:
--------------------------------------------------------------------------------
1 | # Generated by Cargo
2 | # will have compiled files and executables
3 | debug/
4 | target/
5 |
6 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
7 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
8 | Cargo.lock
9 |
10 | # These are backup files generated by rustfmt
11 | **/*.rs.bk
12 |
13 | # MSVC Windows builds of rustc generate these, which store debugging information
14 | *.pdb
15 |
16 | .idea/
17 |
18 | dist/
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "demo-bevy_robot"
3 | version = "0.2.0"
4 | edition = "2021"
5 |
6 |
7 | [dependencies]
8 | nalgebra = "0.33"
9 | bevy_egui = "0.34"
10 | bevy_panorbit_camera = { version = "0.26", features = [ "bevy_egui" ] }
11 | flume = "0.11"
12 | wasm-bindgen = "0.2"
13 |
14 | [dependencies.bevy]
15 | version = "0.16"
16 | default-features = false
17 | features = [
18 | "bevy_asset", "bevy_core_pipeline", "bevy_gizmos", "bevy_gltf", "bevy_pbr", "bevy_render", "bevy_scene",
19 | "bevy_sprite", "bevy_text", "bevy_ui", "bevy_winit", "ktx2", "tonemapping_luts", "zstd", "default_font",
20 | "webgl2"
21 | ]
22 |
23 | [target.wasm32-unknown-unknown.dependencies]
24 | web-sys = { version = "0.3", features = ["Window", "Document", "HtmlElement", "Element", "CustomEvent"] }
25 | serde = { version = "1.0", features = ["derive"] }
26 | serde-wasm-bindgen = "0.6"
27 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 sanri
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # demo-bevy_robot
2 | Display UR5 robots using the bevy engine
3 |
4 |
5 |
6 |
7 |
8 | ## native application
9 |
10 | ### build
11 |
12 | Run cmd
13 | ```shell
14 | cargo build --release
15 | ```
16 |
17 | ### run
18 |
19 | Run cmd
20 | ```shell
21 | cargo run --release
22 | ```
23 |
24 | ## single page web application
25 |
26 | ### build
27 |
28 | Compile to wasm, refer to [trunk](https://trunkrs.dev/). the generated files are in the path "./dist".
29 | ```shell
30 | trunk build --release
31 | ```
32 |
33 | ### run
34 |
35 | use [static-web-server](https://static-web-server.net/) or others web-server.
36 |
37 | ```shell
38 | static-web-server -p 8080 --root ./dist/
39 | ```
40 |
--------------------------------------------------------------------------------
/assets/ctm2f110/ctm2f110.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanri/demo-bevy_robot/018420c83cc85f40344324e82d4cd640a5528fb9/assets/ctm2f110/ctm2f110.bin
--------------------------------------------------------------------------------
/assets/ctm2f110/ctm2f110.gltf:
--------------------------------------------------------------------------------
1 | {
2 | "asset":{
3 | "generator":"Khronos glTF Blender I/O v3.5.30",
4 | "version":"2.0"
5 | },
6 | "scene":0,
7 | "scenes":[
8 | { "name":"main", "nodes":[ 0 ] },
9 | { "name":"driving", "nodes":[ 1 ] },
10 | { "name":"follower", "nodes":[ 2 ] },
11 | { "name":"finger", "nodes":[ 3 ] }
12 | ],
13 | "nodes":[
14 | { "mesh":0, "name":"main" },
15 | { "mesh":1, "name":"driving" },
16 | { "mesh":2, "name":"follower" },
17 | { "mesh":3, "name":"finger" }
18 | ],
19 | "meshes":[
20 | {
21 | "name":"main",
22 | "primitives":[
23 | {
24 | "attributes":{
25 | "COLOR_0":0,
26 | "POSITION":1,
27 | "TEXCOORD_0":2,
28 | "NORMAL":3
29 | },
30 | "indices":4
31 | }
32 | ]
33 | },
34 | {
35 | "name":"driving",
36 | "primitives":[
37 | {
38 | "attributes":{
39 | "COLOR_0":5,
40 | "POSITION":6,
41 | "TEXCOORD_0":7,
42 | "NORMAL":8
43 | },
44 | "indices":9
45 | }
46 | ]
47 | },
48 | {
49 | "name":"follower",
50 | "primitives":[
51 | {
52 | "attributes":{
53 | "COLOR_0":10,
54 | "POSITION":11,
55 | "TEXCOORD_0":12,
56 | "NORMAL":13
57 | },
58 | "indices":14
59 | }
60 | ]
61 | },
62 | {
63 | "name":"fingertip",
64 | "primitives":[
65 | {
66 | "attributes":{
67 | "COLOR_0":15,
68 | "POSITION":16,
69 | "TEXCOORD_0":17,
70 | "NORMAL":18
71 | },
72 | "indices":19
73 | }
74 | ]
75 | }
76 | ],
77 | "accessors":[
78 | {
79 | "bufferView":0,
80 | "componentType":5126,
81 | "count":18422,
82 | "type":"VEC4"
83 | },
84 | {
85 | "bufferView":1,
86 | "componentType":5126,
87 | "count":18422,
88 | "max":[
89 | 0.06299400329589844,
90 | 0.03749829903244972,
91 | 0.10074099898338318
92 | ],
93 | "min":[
94 | -0.06299400329589844,
95 | -0.03749829903244972,
96 | 3.679869919892553e-08
97 | ],
98 | "type":"VEC3"
99 | },
100 | {
101 | "bufferView":2,
102 | "componentType":5126,
103 | "count":18422,
104 | "type":"VEC2"
105 | },
106 | {
107 | "bufferView":3,
108 | "componentType":5126,
109 | "count":18422,
110 | "type":"VEC3"
111 | },
112 | {
113 | "bufferView":4,
114 | "componentType":5123,
115 | "count":57162,
116 | "type":"SCALAR"
117 | },
118 | {
119 | "bufferView":5,
120 | "componentType":5126,
121 | "count":11322,
122 | "type":"VEC4"
123 | },
124 | {
125 | "bufferView":6,
126 | "componentType":5126,
127 | "count":11322,
128 | "max":[
129 | 0.06099399924278259,
130 | 0.011994400061666965,
131 | 0.029997700825333595
132 | ],
133 | "min":[
134 | -0.011997600086033344,
135 | -0.01199449971318245,
136 | -0.029997700825333595
137 | ],
138 | "type":"VEC3"
139 | },
140 | {
141 | "bufferView":7,
142 | "componentType":5126,
143 | "count":11322,
144 | "type":"VEC2"
145 | },
146 | {
147 | "bufferView":8,
148 | "componentType":5126,
149 | "count":11322,
150 | "type":"VEC3"
151 | },
152 | {
153 | "bufferView":9,
154 | "componentType":5123,
155 | "count":39252,
156 | "type":"SCALAR"
157 | },
158 | {
159 | "bufferView":10,
160 | "componentType":5126,
161 | "count":8070,
162 | "type":"VEC4"
163 | },
164 | {
165 | "bufferView":11,
166 | "componentType":5126,
167 | "count":8070,
168 | "max":[
169 | 0.06099399924278259,
170 | 0.005999989807605743,
171 | 0.012597699649631977
172 | ],
173 | "min":[
174 | -0.0059939902275800705,
175 | -0.006000009831041098,
176 | -0.012597699649631977
177 | ],
178 | "type":"VEC3"
179 | },
180 | {
181 | "bufferView":12,
182 | "componentType":5126,
183 | "count":8070,
184 | "type":"VEC2"
185 | },
186 | {
187 | "bufferView":13,
188 | "componentType":5126,
189 | "count":8070,
190 | "type":"VEC3"
191 | },
192 | {
193 | "bufferView":14,
194 | "componentType":5123,
195 | "count":28812,
196 | "type":"SCALAR"
197 | },
198 | {
199 | "bufferView":15,
200 | "componentType":5126,
201 | "count":4428,
202 | "type":"VEC4"
203 | },
204 | {
205 | "bufferView":16,
206 | "componentType":5126,
207 | "count":4428,
208 | "max":[
209 | 0.050476301461458206,
210 | 0.010999999940395355,
211 | 0.011500000022351742
212 | ],
213 | "min":[
214 | -0.017983200028538704,
215 | -0.03899409994482994,
216 | -0.011500000022351742
217 | ],
218 | "type":"VEC3"
219 | },
220 | {
221 | "bufferView":17,
222 | "componentType":5126,
223 | "count":4428,
224 | "type":"VEC2"
225 | },
226 | {
227 | "bufferView":18,
228 | "componentType":5126,
229 | "count":4428,
230 | "type":"VEC3"
231 | },
232 | {
233 | "bufferView":19,
234 | "componentType":5123,
235 | "count":14880,
236 | "type":"SCALAR"
237 | }
238 | ],
239 | "bufferViews":[
240 | {
241 | "buffer":0,
242 | "byteLength":294752,
243 | "byteOffset":0,
244 | "target":34962
245 | },
246 | {
247 | "buffer":0,
248 | "byteLength":221064,
249 | "byteOffset":294752,
250 | "target":34962
251 | },
252 | {
253 | "buffer":0,
254 | "byteLength":147376,
255 | "byteOffset":515816,
256 | "target":34962
257 | },
258 | {
259 | "buffer":0,
260 | "byteLength":221064,
261 | "byteOffset":663192,
262 | "target":34962
263 | },
264 | {
265 | "buffer":0,
266 | "byteLength":114324,
267 | "byteOffset":884256,
268 | "target":34963
269 | },
270 | {
271 | "buffer":0,
272 | "byteLength":181152,
273 | "byteOffset":998580,
274 | "target":34962
275 | },
276 | {
277 | "buffer":0,
278 | "byteLength":135864,
279 | "byteOffset":1179732,
280 | "target":34962
281 | },
282 | {
283 | "buffer":0,
284 | "byteLength":90576,
285 | "byteOffset":1315596,
286 | "target":34962
287 | },
288 | {
289 | "buffer":0,
290 | "byteLength":135864,
291 | "byteOffset":1406172,
292 | "target":34962
293 | },
294 | {
295 | "buffer":0,
296 | "byteLength":78504,
297 | "byteOffset":1542036,
298 | "target":34963
299 | },
300 | {
301 | "buffer":0,
302 | "byteLength":129120,
303 | "byteOffset":1620540,
304 | "target":34962
305 | },
306 | {
307 | "buffer":0,
308 | "byteLength":96840,
309 | "byteOffset":1749660,
310 | "target":34962
311 | },
312 | {
313 | "buffer":0,
314 | "byteLength":64560,
315 | "byteOffset":1846500,
316 | "target":34962
317 | },
318 | {
319 | "buffer":0,
320 | "byteLength":96840,
321 | "byteOffset":1911060,
322 | "target":34962
323 | },
324 | {
325 | "buffer":0,
326 | "byteLength":57624,
327 | "byteOffset":2007900,
328 | "target":34963
329 | },
330 | {
331 | "buffer":0,
332 | "byteLength":70848,
333 | "byteOffset":2065524,
334 | "target":34962
335 | },
336 | {
337 | "buffer":0,
338 | "byteLength":53136,
339 | "byteOffset":2136372,
340 | "target":34962
341 | },
342 | {
343 | "buffer":0,
344 | "byteLength":35424,
345 | "byteOffset":2189508,
346 | "target":34962
347 | },
348 | {
349 | "buffer":0,
350 | "byteLength":53136,
351 | "byteOffset":2224932,
352 | "target":34962
353 | },
354 | {
355 | "buffer":0,
356 | "byteLength":29760,
357 | "byteOffset":2278068,
358 | "target":34963
359 | }
360 | ],
361 | "buffers":[
362 | {
363 | "byteLength":2307828,
364 | "uri":"ctm2f110.bin"
365 | }
366 | ]
367 | }
368 |
--------------------------------------------------------------------------------
/assets/ur5/ur5.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanri/demo-bevy_robot/018420c83cc85f40344324e82d4cd640a5528fb9/assets/ur5/ur5.bin
--------------------------------------------------------------------------------
/assets/ur5/ur5.gltf:
--------------------------------------------------------------------------------
1 | {
2 | "asset":{
3 | "generator":"Khronos glTF Blender I/O v3.5.30",
4 | "version":"2.0"
5 | },
6 | "scene":0,
7 | "scenes":[
8 | { "name":"Base", "nodes":[ 6 ] },
9 | { "name":"Arm1", "nodes":[ 4 ] },
10 | { "name":"Arm2", "nodes":[ 3 ] },
11 | { "name":"Arm3", "nodes":[ 2 ] },
12 | { "name":"Arm4", "nodes":[ 5 ] },
13 | { "name":"Arm5", "nodes":[ 0 ] },
14 | { "name":"Arm6", "nodes":[ 1 ] }
15 | ],
16 | "nodes":[
17 | {
18 | "mesh":0,
19 | "name":"UR5_Arm5"
20 | },
21 | {
22 | "mesh":1,
23 | "name":"UR5_Arm6"
24 | },
25 | {
26 | "mesh":2,
27 | "name":"UR5_Arm3"
28 | },
29 | {
30 | "mesh":3,
31 | "name":"UR5_Arm2"
32 | },
33 | {
34 | "mesh":4,
35 | "name":"UR5_Arm1"
36 | },
37 | {
38 | "mesh":5,
39 | "name":"UR5_Arm4"
40 | },
41 | {
42 | "mesh":6,
43 | "name":"UR5_Base"
44 | }
45 | ],
46 | "meshes":[
47 | {
48 | "name":"UR5_Arm5",
49 | "primitives":[
50 | {
51 | "attributes":{
52 | "COLOR_0":0,
53 | "POSITION":1,
54 | "TEXCOORD_0":2,
55 | "NORMAL":3
56 | },
57 | "indices":4
58 | }
59 | ]
60 | },
61 | {
62 | "name":"UR5_Arm6",
63 | "primitives":[
64 | {
65 | "attributes":{
66 | "COLOR_0":5,
67 | "POSITION":6,
68 | "TEXCOORD_0":7,
69 | "NORMAL":8
70 | },
71 | "indices":9
72 | }
73 | ]
74 | },
75 | {
76 | "name":"UR5_Arm3",
77 | "primitives":[
78 | {
79 | "attributes":{
80 | "COLOR_0":10,
81 | "POSITION":11,
82 | "TEXCOORD_0":12,
83 | "NORMAL":13
84 | },
85 | "indices":14
86 | }
87 | ]
88 | },
89 | {
90 | "name":"UR5_Arm2",
91 | "primitives":[
92 | {
93 | "attributes":{
94 | "COLOR_0":15,
95 | "POSITION":16,
96 | "TEXCOORD_0":17,
97 | "NORMAL":18
98 | },
99 | "indices":19
100 | }
101 | ]
102 | },
103 | {
104 | "name":"UR5_Arm1",
105 | "primitives":[
106 | {
107 | "attributes":{
108 | "COLOR_0":20,
109 | "POSITION":21,
110 | "TEXCOORD_0":22,
111 | "NORMAL":23
112 | },
113 | "indices":24
114 | }
115 | ]
116 | },
117 | {
118 | "name":"UR5_Arm4",
119 | "primitives":[
120 | {
121 | "attributes":{
122 | "COLOR_0":25,
123 | "POSITION":26,
124 | "TEXCOORD_0":27,
125 | "NORMAL":28
126 | },
127 | "indices":29
128 | }
129 | ]
130 | },
131 | {
132 | "name":"UR5_Base",
133 | "primitives":[
134 | {
135 | "attributes":{
136 | "COLOR_0":30,
137 | "POSITION":31,
138 | "TEXCOORD_0":32,
139 | "NORMAL":33
140 | },
141 | "indices":34
142 | }
143 | ]
144 | }
145 | ],
146 | "accessors":[
147 | {
148 | "bufferView":0,
149 | "componentType":5126,
150 | "count":39197,
151 | "type":"VEC4"
152 | },
153 | {
154 | "bufferView":1,
155 | "componentType":5126,
156 | "count":39197,
157 | "max":[
158 | 0.0393499992787838,
159 | 0.048500001430511475,
160 | 0.0393357016146183
161 | ],
162 | "min":[
163 | -0.0393499992787838,
164 | -0.05803060159087181,
165 | -0.04625000059604645
166 | ],
167 | "type":"VEC3"
168 | },
169 | {
170 | "bufferView":2,
171 | "componentType":5126,
172 | "count":39197,
173 | "type":"VEC2"
174 | },
175 | {
176 | "bufferView":3,
177 | "componentType":5126,
178 | "count":39197,
179 | "type":"VEC3"
180 | },
181 | {
182 | "bufferView":4,
183 | "componentType":5123,
184 | "count":114669,
185 | "type":"SCALAR"
186 | },
187 | {
188 | "bufferView":5,
189 | "componentType":5126,
190 | "count":2117,
191 | "type":"VEC4"
192 | },
193 | {
194 | "bufferView":6,
195 | "componentType":5126,
196 | "count":2117,
197 | "max":[
198 | 0.03748060017824173,
199 | 0.03749990090727806,
200 | -4.582820167797763e-08
201 | ],
202 | "min":[
203 | -0.03748060017824173,
204 | -0.03749990090727806,
205 | -0.032999999821186066
206 | ],
207 | "type":"VEC3"
208 | },
209 | {
210 | "bufferView":7,
211 | "componentType":5126,
212 | "count":2117,
213 | "type":"VEC2"
214 | },
215 | {
216 | "bufferView":8,
217 | "componentType":5126,
218 | "count":2117,
219 | "type":"VEC3"
220 | },
221 | {
222 | "bufferView":9,
223 | "componentType":5123,
224 | "count":5448,
225 | "type":"SCALAR"
226 | },
227 | {
228 | "bufferView":10,
229 | "componentType":5126,
230 | "count":51118,
231 | "type":"VEC4"
232 | },
233 | {
234 | "bufferView":11,
235 | "componentType":5126,
236 | "count":51118,
237 | "max":[
238 | 0.43160000443458557,
239 | 0.057999998331069946,
240 | 0.05803050100803375
241 | ],
242 | "min":[
243 | -0.05796470120549202,
244 | -0.05794690176844597,
245 | -0.052549999207258224
246 | ],
247 | "type":"VEC3"
248 | },
249 | {
250 | "bufferView":12,
251 | "componentType":5126,
252 | "count":51118,
253 | "type":"VEC2"
254 | },
255 | {
256 | "bufferView":13,
257 | "componentType":5126,
258 | "count":51118,
259 | "type":"VEC3"
260 | },
261 | {
262 | "bufferView":14,
263 | "componentType":5123,
264 | "count":130191,
265 | "type":"SCALAR"
266 | },
267 | {
268 | "bufferView":15,
269 | "componentType":5126,
270 | "count":92711,
271 | "type":"VEC4"
272 | },
273 | {
274 | "bufferView":16,
275 | "componentType":5126,
276 | "count":92711,
277 | "max":[
278 | 0.48510000109672546,
279 | 0.060100000351667404,
280 | 0.07347720116376877
281 | ],
282 | "min":[
283 | -0.060100000351667404,
284 | -0.060100000351667404,
285 | -0.06639999896287918
286 | ],
287 | "type":"VEC3"
288 | },
289 | {
290 | "bufferView":17,
291 | "componentType":5126,
292 | "count":92711,
293 | "type":"VEC2"
294 | },
295 | {
296 | "bufferView":18,
297 | "componentType":5126,
298 | "count":92711,
299 | "type":"VEC3"
300 | },
301 | {
302 | "bufferView":19,
303 | "componentType":5125,
304 | "count":236400,
305 | "type":"SCALAR"
306 | },
307 | {
308 | "bufferView":20,
309 | "componentType":5126,
310 | "count":35886,
311 | "type":"VEC4"
312 | },
313 | {
314 | "bufferView":21,
315 | "componentType":5126,
316 | "count":35886,
317 | "max":[
318 | 0.060062799602746964,
319 | 0.06780000030994415,
320 | 0.07347720116376877
321 | ],
322 | "min":[
323 | -0.060100000351667404,
324 | -0.060100000351667404,
325 | -0.06639999896287918
326 | ],
327 | "type":"VEC3"
328 | },
329 | {
330 | "bufferView":22,
331 | "componentType":5126,
332 | "count":35886,
333 | "type":"VEC2"
334 | },
335 | {
336 | "bufferView":23,
337 | "componentType":5126,
338 | "count":35886,
339 | "type":"VEC3"
340 | },
341 | {
342 | "bufferView":24,
343 | "componentType":5123,
344 | "count":99063,
345 | "type":"SCALAR"
346 | },
347 | {
348 | "bufferView":25,
349 | "componentType":5126,
350 | "count":39197,
351 | "type":"VEC4"
352 | },
353 | {
354 | "bufferView":26,
355 | "componentType":5126,
356 | "count":39197,
357 | "max":[
358 | 0.0393499992787838,
359 | 0.048500001430511475,
360 | 0.0393357016146183
361 | ],
362 | "min":[
363 | -0.0393499992787838,
364 | -0.05803050100803375,
365 | -0.04625000059604645
366 | ],
367 | "type":"VEC3"
368 | },
369 | {
370 | "bufferView":27,
371 | "componentType":5126,
372 | "count":39197,
373 | "type":"VEC2"
374 | },
375 | {
376 | "bufferView":28,
377 | "componentType":5126,
378 | "count":39197,
379 | "type":"VEC3"
380 | },
381 | {
382 | "bufferView":29,
383 | "componentType":5123,
384 | "count":114597,
385 | "type":"SCALAR"
386 | },
387 | {
388 | "bufferView":30,
389 | "componentType":5126,
390 | "count":2508,
391 | "type":"VEC4"
392 | },
393 | {
394 | "bufferView":31,
395 | "componentType":5126,
396 | "count":2508,
397 | "max":[
398 | 0.07450000196695328,
399 | 0.07445459812879562,
400 | 0.02280000038444996
401 | ],
402 | "min":[
403 | -0.07450000196695328,
404 | -0.07445459812879562,
405 | 9.315980200993728e-18
406 | ],
407 | "type":"VEC3"
408 | },
409 | {
410 | "bufferView":32,
411 | "componentType":5126,
412 | "count":2508,
413 | "type":"VEC2"
414 | },
415 | {
416 | "bufferView":33,
417 | "componentType":5126,
418 | "count":2508,
419 | "type":"VEC3"
420 | },
421 | {
422 | "bufferView":34,
423 | "componentType":5123,
424 | "count":6456,
425 | "type":"SCALAR"
426 | }
427 | ],
428 | "bufferViews":[
429 | {
430 | "buffer":0,
431 | "byteLength":627152,
432 | "byteOffset":0,
433 | "target":34962
434 | },
435 | {
436 | "buffer":0,
437 | "byteLength":470364,
438 | "byteOffset":627152,
439 | "target":34962
440 | },
441 | {
442 | "buffer":0,
443 | "byteLength":313576,
444 | "byteOffset":1097516,
445 | "target":34962
446 | },
447 | {
448 | "buffer":0,
449 | "byteLength":470364,
450 | "byteOffset":1411092,
451 | "target":34962
452 | },
453 | {
454 | "buffer":0,
455 | "byteLength":229338,
456 | "byteOffset":1881456,
457 | "target":34963
458 | },
459 | {
460 | "buffer":0,
461 | "byteLength":33872,
462 | "byteOffset":2110796,
463 | "target":34962
464 | },
465 | {
466 | "buffer":0,
467 | "byteLength":25404,
468 | "byteOffset":2144668,
469 | "target":34962
470 | },
471 | {
472 | "buffer":0,
473 | "byteLength":16936,
474 | "byteOffset":2170072,
475 | "target":34962
476 | },
477 | {
478 | "buffer":0,
479 | "byteLength":25404,
480 | "byteOffset":2187008,
481 | "target":34962
482 | },
483 | {
484 | "buffer":0,
485 | "byteLength":10896,
486 | "byteOffset":2212412,
487 | "target":34963
488 | },
489 | {
490 | "buffer":0,
491 | "byteLength":817888,
492 | "byteOffset":2223308,
493 | "target":34962
494 | },
495 | {
496 | "buffer":0,
497 | "byteLength":613416,
498 | "byteOffset":3041196,
499 | "target":34962
500 | },
501 | {
502 | "buffer":0,
503 | "byteLength":408944,
504 | "byteOffset":3654612,
505 | "target":34962
506 | },
507 | {
508 | "buffer":0,
509 | "byteLength":613416,
510 | "byteOffset":4063556,
511 | "target":34962
512 | },
513 | {
514 | "buffer":0,
515 | "byteLength":260382,
516 | "byteOffset":4676972,
517 | "target":34963
518 | },
519 | {
520 | "buffer":0,
521 | "byteLength":1483376,
522 | "byteOffset":4937356,
523 | "target":34962
524 | },
525 | {
526 | "buffer":0,
527 | "byteLength":1112532,
528 | "byteOffset":6420732,
529 | "target":34962
530 | },
531 | {
532 | "buffer":0,
533 | "byteLength":741688,
534 | "byteOffset":7533264,
535 | "target":34962
536 | },
537 | {
538 | "buffer":0,
539 | "byteLength":1112532,
540 | "byteOffset":8274952,
541 | "target":34962
542 | },
543 | {
544 | "buffer":0,
545 | "byteLength":945600,
546 | "byteOffset":9387484,
547 | "target":34963
548 | },
549 | {
550 | "buffer":0,
551 | "byteLength":574176,
552 | "byteOffset":10333084,
553 | "target":34962
554 | },
555 | {
556 | "buffer":0,
557 | "byteLength":430632,
558 | "byteOffset":10907260,
559 | "target":34962
560 | },
561 | {
562 | "buffer":0,
563 | "byteLength":287088,
564 | "byteOffset":11337892,
565 | "target":34962
566 | },
567 | {
568 | "buffer":0,
569 | "byteLength":430632,
570 | "byteOffset":11624980,
571 | "target":34962
572 | },
573 | {
574 | "buffer":0,
575 | "byteLength":198126,
576 | "byteOffset":12055612,
577 | "target":34963
578 | },
579 | {
580 | "buffer":0,
581 | "byteLength":627152,
582 | "byteOffset":12253740,
583 | "target":34962
584 | },
585 | {
586 | "buffer":0,
587 | "byteLength":470364,
588 | "byteOffset":12880892,
589 | "target":34962
590 | },
591 | {
592 | "buffer":0,
593 | "byteLength":313576,
594 | "byteOffset":13351256,
595 | "target":34962
596 | },
597 | {
598 | "buffer":0,
599 | "byteLength":470364,
600 | "byteOffset":13664832,
601 | "target":34962
602 | },
603 | {
604 | "buffer":0,
605 | "byteLength":229194,
606 | "byteOffset":14135196,
607 | "target":34963
608 | },
609 | {
610 | "buffer":0,
611 | "byteLength":40128,
612 | "byteOffset":14364392,
613 | "target":34962
614 | },
615 | {
616 | "buffer":0,
617 | "byteLength":30096,
618 | "byteOffset":14404520,
619 | "target":34962
620 | },
621 | {
622 | "buffer":0,
623 | "byteLength":20064,
624 | "byteOffset":14434616,
625 | "target":34962
626 | },
627 | {
628 | "buffer":0,
629 | "byteLength":30096,
630 | "byteOffset":14454680,
631 | "target":34962
632 | },
633 | {
634 | "buffer":0,
635 | "byteLength":12912,
636 | "byteOffset":14484776,
637 | "target":34963
638 | }
639 | ],
640 | "buffers":[
641 | {
642 | "byteLength":14497688,
643 | "uri":"ur5.bin"
644 | }
645 | ]
646 | }
647 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | demo-bevy_robot
5 |
6 |
7 |
36 |
37 |
53 |
54 |
55 |
56 |
57 | demo-bevy_robot
58 |
59 |
60 |
61 |
66 |
67 |
68 |
69 |
70 |
122 |
123 |
175 |
176 |
185 |
186 |
187 |
188 |
189 |
--------------------------------------------------------------------------------
/media/demo-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanri/demo-bevy_robot/018420c83cc85f40344324e82d4cd640a5528fb9/media/demo-web.png
--------------------------------------------------------------------------------
/media/demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanri/demo-bevy_robot/018420c83cc85f40344324e82d4cd640a5528fb9/media/demo.png
--------------------------------------------------------------------------------
/rust-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "1.87.0"
3 |
--------------------------------------------------------------------------------
/src/draw_trail.rs:
--------------------------------------------------------------------------------
1 | use bevy::prelude::*;
2 | use std::collections::{BTreeMap, VecDeque};
3 |
4 | pub struct DrawTrailPlugin;
5 |
6 | impl Plugin for DrawTrailPlugin {
7 | fn build(&self, app: &mut App) {
8 | app.insert_resource(Trails::default())
9 | .add_systems(Update, Trails::draw_trails);
10 | }
11 | }
12 |
13 | struct Trail {
14 | duration: f32,
15 | color: Color,
16 | data: VecDeque<(f32, Vec3)>, // ( time, point )
17 | }
18 |
19 | #[derive(Resource)]
20 | pub struct Trails {
21 | map: BTreeMap,
22 | }
23 |
24 | impl Trails {
25 | pub fn add_point(&mut self, id: u64, time: f32, point: Vec3, duration: f32, color: Color) {
26 | let trail = self.map.entry(id).or_insert(Trail {
27 | duration,
28 | color,
29 | data: VecDeque::new(),
30 | });
31 |
32 | trail.duration = duration.abs();
33 | trail.color = color;
34 | trail.data.push_back((time.abs(), point));
35 | }
36 |
37 | fn draw_trails(mut gizmos: Gizmos, mut trails: ResMut, time: Res