1 | function ClassicControlMapping(name, deps) { |
||
2 | deps.logger.debug('Loaded classic control mapping plugin'); |
||
3 | } |
||
4 | |||
5 | ClassicControlMapping.prototype.getControlMappingPreset = function getControlMappingPreset(){ |
||
6 | return [ |
||
7 | { |
||
8 | "name": "OpenROV Classic RO", |
||
9 | "default": true, |
||
10 | "map": [ |
||
11 | { |
||
12 | "name": "blackbox.record", |
||
13 | "bindings": [ |
||
14 | { |
||
15 | "name": "keyboard", |
||
16 | "binding": "r" |
||
17 | } |
||
18 | ], |
||
19 | "description": "Start recording telemetry data.", |
||
20 | "defaults": { |
||
21 | "keyboard": "r" |
||
22 | } |
||
23 | }, |
||
24 | { |
||
25 | "name": "plugin.cameraServo.stepNegative", |
||
26 | "bindings": [ |
||
27 | { |
||
28 | "name": "keyboard", |
||
29 | "binding": "z" |
||
30 | }, |
||
31 | { |
||
32 | "name": "gamepad", |
||
33 | "binding": "A" |
||
34 | } |
||
35 | ], |
||
36 | "description": "Point the camera further down.", |
||
37 | "defaults": { |
||
38 | "keyboard": "z", |
||
39 | "gamepad": "A" |
||
40 | } |
||
41 | }, |
||
42 | { |
||
43 | "name": "plugin.cameraServo.center", |
||
44 | "bindings": [ |
||
45 | { |
||
46 | "name": "keyboard", |
||
47 | "binding": "a" |
||
48 | }, |
||
49 | { |
||
50 | "name": "gamepad", |
||
51 | "binding": "B" |
||
52 | } |
||
53 | ], |
||
54 | "description": "Point the camera straight ahead.", |
||
55 | "defaults": { |
||
56 | "keyboard": "a", |
||
57 | "gamepad": "B" |
||
58 | } |
||
59 | }, |
||
60 | { |
||
61 | "name": "plugin.cameraServo.stepPositive", |
||
62 | "bindings": [ |
||
63 | { |
||
64 | "name": "keyboard", |
||
65 | "binding": "q" |
||
66 | }, |
||
67 | { |
||
68 | "name": "gamepad", |
||
69 | "binding": "Y" |
||
70 | } |
||
71 | ], |
||
72 | "description": "Point the camera further up.", |
||
73 | "defaults": { |
||
74 | "keyboard": "q", |
||
75 | "gamepad": "Y" |
||
76 | } |
||
77 | }, |
||
78 | { |
||
79 | "name": "rovPilot.powerOnESC", |
||
80 | "bindings": [ |
||
81 | { |
||
82 | "name": "keyboard", |
||
83 | "binding": "[" |
||
84 | } |
||
85 | ], |
||
86 | "description": "Switches the ESCs on", |
||
87 | "defaults": { |
||
88 | "keyboard": "[" |
||
89 | } |
||
90 | }, |
||
91 | { |
||
92 | "name": "rovPilot.powerOffESC", |
||
93 | "bindings": [ |
||
94 | { |
||
95 | "name": "keyboard", |
||
96 | "binding": "]" |
||
97 | } |
||
98 | ], |
||
99 | "description": "Switches the ESCs off", |
||
100 | "defaults": { |
||
101 | "keyboard": "]" |
||
102 | } |
||
103 | }, |
||
104 | { |
||
105 | "name": "example.keyBoardMapping", |
||
106 | "bindings": [ |
||
107 | { |
||
108 | "name": "keyboard", |
||
109 | "binding": "alt+0" |
||
110 | }, |
||
111 | { |
||
112 | "name": "gamepad", |
||
113 | "binding": "X" |
||
114 | } |
||
115 | ], |
||
116 | "description": "Example for keymapping.", |
||
117 | "defaults": { |
||
118 | "keyboard": "alt+0", |
||
119 | "gamepad": "X" |
||
120 | } |
||
121 | }, |
||
122 | { |
||
123 | "name": "example.testMessage", |
||
124 | "bindings": [ |
||
125 | { |
||
126 | "name": "keyboard", |
||
127 | "binding": "alt+T" |
||
128 | } |
||
129 | ], |
||
130 | "description": "another example", |
||
131 | "defaults": { |
||
132 | "keyboard": "alt+T" |
||
133 | } |
||
134 | }, |
||
135 | { |
||
136 | "name": "plugin.externalLights.stepPositive", |
||
137 | "bindings": [ |
||
138 | { |
||
139 | "name": "keyboard", |
||
140 | "binding": "6 =" |
||
141 | } |
||
142 | ], |
||
143 | "description": "Makes the ROV lights brighter.", |
||
144 | "defaults": { |
||
145 | "keyboard": "6 =" |
||
146 | } |
||
147 | }, |
||
148 | { |
||
149 | "name": "plugin.externalLights.stepNegative", |
||
150 | "bindings": [ |
||
151 | { |
||
152 | "name": "keyboard", |
||
153 | "binding": "6 -" |
||
154 | } |
||
155 | ], |
||
156 | "description": "Makes the ROV lights dimmer.", |
||
157 | "defaults": { |
||
158 | "keyboard": "6 -" |
||
159 | } |
||
160 | }, |
||
161 | { |
||
162 | "name": "plugin.externalLights.toggle", |
||
163 | "bindings": [ |
||
164 | { |
||
165 | "name": "keyboard", |
||
166 | "binding": "6 0" |
||
167 | } |
||
168 | ], |
||
169 | "description": "Toggles the ROV lights on/off.", |
||
170 | "defaults": { |
||
171 | "keyboard": "6 0" |
||
172 | } |
||
173 | }, |
||
174 | { |
||
175 | "name": "plugin.laser.Toggle", |
||
176 | "bindings": [ |
||
177 | { |
||
178 | "name": "keyboard", |
||
179 | "binding": "l" |
||
180 | } |
||
181 | ], |
||
182 | "description": "Toggles the lasers on or off.", |
||
183 | "defaults": { |
||
184 | "keyboard": "l" |
||
185 | } |
||
186 | }, |
||
187 | { |
||
188 | "name": "plugin.lights.stepPositive", |
||
189 | "bindings": [ |
||
190 | { |
||
191 | "name": "keyboard", |
||
192 | "binding": "o" |
||
193 | }, |
||
194 | { |
||
195 | "name": "gamepad", |
||
196 | "binding": "DPAD_DOWN" |
||
197 | } |
||
198 | ], |
||
199 | "description": "Makes the ROV lights brighter.", |
||
200 | "defaults": { |
||
201 | "keyboard": "o", |
||
202 | "gamepad": "DPAD_DOWN" |
||
203 | } |
||
204 | }, |
||
205 | { |
||
206 | "name": "plugin.lights.toggle", |
||
207 | "bindings": [ |
||
208 | { |
||
209 | "name": "keyboard", |
||
210 | "binding": "i" |
||
211 | } |
||
212 | ], |
||
213 | "description": "Toggles the ROV lights on/off.", |
||
214 | "defaults": { |
||
215 | "keyboard": "i" |
||
216 | } |
||
217 | }, |
||
218 | { |
||
219 | "name": "newUi.showTelemetry", |
||
220 | "bindings": [ |
||
221 | { |
||
222 | "name": "keyboard", |
||
223 | "binding": "alt+t" |
||
224 | } |
||
225 | ], |
||
226 | "description": "Show the telemetry window.", |
||
227 | "defaults": { |
||
228 | "keyboard": "alt+t" |
||
229 | } |
||
230 | }, |
||
231 | { |
||
232 | "name": "newUi.showSerialMonitor", |
||
233 | "bindings": [ |
||
234 | { |
||
235 | "name": "keyboard", |
||
236 | "binding": "alt+s" |
||
237 | } |
||
238 | ], |
||
239 | "description": "Show the serial port window.", |
||
240 | "defaults": { |
||
241 | "keyboard": "alt+s" |
||
242 | } |
||
243 | }, |
||
244 | { |
||
245 | "name": "rovPilot.incrementPowerLevel", |
||
246 | "bindings": [], |
||
247 | "description": "Increment the thruster power level", |
||
248 | "defaults": {} |
||
249 | }, |
||
250 | { |
||
251 | "name": "rovPilot.moveForward", |
||
252 | "bindings": [ |
||
253 | { |
||
254 | "name": "keyboard", |
||
255 | "binding": "up" |
||
256 | } |
||
257 | ], |
||
258 | "description": "Set throttle forward.", |
||
259 | "defaults": { |
||
260 | "keyboard": "up" |
||
261 | } |
||
262 | }, |
||
263 | { |
||
264 | "name": "rovPilot.moveThrottle", |
||
265 | "bindings": [ |
||
266 | { |
||
267 | "name": "gamepad", |
||
268 | "binding": "LEFT_STICK_Y" |
||
269 | } |
||
270 | ], |
||
271 | "description": "Set throttle via axis input.", |
||
272 | "defaults": { |
||
273 | "gamepad": "LEFT_STICK_Y" |
||
274 | } |
||
275 | }, |
||
276 | { |
||
277 | "name": "rovPilot.moveBackwards", |
||
278 | "bindings": [ |
||
279 | { |
||
280 | "name": "keyboard", |
||
281 | "binding": "down" |
||
282 | } |
||
283 | ], |
||
284 | "description": "Set throttle backwards (aft).", |
||
285 | "defaults": { |
||
286 | "keyboard": "down" |
||
287 | } |
||
288 | }, |
||
289 | { |
||
290 | "name": "rovPilot.moveYaw", |
||
291 | "bindings": [ |
||
292 | { |
||
293 | "name": "gamepad", |
||
294 | "binding": "LEFT_STICK_X" |
||
295 | } |
||
296 | ], |
||
297 | "description": "Turn the ROV via axis input.", |
||
298 | "defaults": { |
||
299 | "gamepad": "LEFT_STICK_X" |
||
300 | } |
||
301 | }, |
||
302 | { |
||
303 | "name": "rovPilot.moveLeft", |
||
304 | "bindings": [ |
||
305 | { |
||
306 | "name": "keyboard", |
||
307 | "binding": "left" |
||
308 | } |
||
309 | ], |
||
310 | "description": "Turn the ROV to the port side (left).", |
||
311 | "defaults": { |
||
312 | "keyboard": "left" |
||
313 | } |
||
314 | }, |
||
315 | { |
||
316 | "name": "rovPilot.moveRight", |
||
317 | "bindings": [ |
||
318 | { |
||
319 | "name": "keyboard", |
||
320 | "binding": "right" |
||
321 | } |
||
322 | ], |
||
323 | "description": "Turn the ROV to the starboard side (right).", |
||
324 | "defaults": { |
||
325 | "keyboard": "right" |
||
326 | } |
||
327 | }, |
||
328 | { |
||
329 | "name": "rovPilot.moveLift", |
||
330 | "bindings": [ |
||
331 | { |
||
332 | "name": "gamepad", |
||
333 | "binding": "RIGHT_STICK_Y" |
||
334 | } |
||
335 | ], |
||
336 | "description": "Bring the ROV shallower or deeper via axis input.", |
||
337 | "defaults": { |
||
338 | "gamepad": "RIGHT_STICK_Y" |
||
339 | } |
||
340 | }, |
||
341 | { |
||
342 | "name": "rovPilot.moveUp", |
||
343 | "bindings": [ |
||
344 | { |
||
345 | "name": "keyboard", |
||
346 | "binding": "shift" |
||
347 | } |
||
348 | ], |
||
349 | "description": "Bring the ROV shallower (up).", |
||
350 | "defaults": { |
||
351 | "keyboard": "shift" |
||
352 | } |
||
353 | }, |
||
354 | { |
||
355 | "name": "rovPilot.moveDown", |
||
356 | "bindings": [ |
||
357 | { |
||
358 | "name": "keyboard", |
||
359 | "binding": "ctrl" |
||
360 | } |
||
361 | ], |
||
362 | "description": "Bring the ROV deeper (down).", |
||
363 | "defaults": { |
||
364 | "keyboard": "ctrl" |
||
365 | } |
||
366 | }, |
||
367 | { |
||
368 | "name": "rovPilot.powerLevel1", |
||
369 | "bindings": [ |
||
370 | { |
||
371 | "name": "keyboard", |
||
372 | "binding": "1" |
||
373 | } |
||
374 | ], |
||
375 | "description": "Set the power level of the ROV to level 1.", |
||
376 | "defaults": { |
||
377 | "keyboard": "1" |
||
378 | } |
||
379 | }, |
||
380 | { |
||
381 | "name": "rovPilot.powerLevel2", |
||
382 | "bindings": [ |
||
383 | { |
||
384 | "name": "keyboard", |
||
385 | "binding": "2" |
||
386 | } |
||
387 | ], |
||
388 | "description": "Set the power level of the ROV to level 2.", |
||
389 | "defaults": { |
||
390 | "keyboard": "2" |
||
391 | } |
||
392 | }, |
||
393 | { |
||
394 | "name": "rovPilot.powerLevel3", |
||
395 | "bindings": [ |
||
396 | { |
||
397 | "name": "keyboard", |
||
398 | "binding": "3" |
||
399 | } |
||
400 | ], |
||
401 | "description": "Set the power level of the ROV to level 3.", |
||
402 | "defaults": { |
||
403 | "keyboard": "3" |
||
404 | } |
||
405 | }, |
||
406 | { |
||
407 | "name": "rovPilot.powerLevel4", |
||
408 | "bindings": [ |
||
409 | { |
||
410 | "name": "keyboard", |
||
411 | "binding": "4" |
||
412 | } |
||
413 | ], |
||
414 | "description": "Set the power level of the ROV to level 4.", |
||
415 | "defaults": { |
||
416 | "keyboard": "4" |
||
417 | } |
||
418 | }, |
||
419 | { |
||
420 | "name": "rovPilot.powerLevel5", |
||
421 | "bindings": [ |
||
422 | { |
||
423 | "name": "keyboard", |
||
424 | "binding": "5" |
||
425 | } |
||
426 | ], |
||
427 | "description": "Set the power level of the ROV to level 5.", |
||
428 | "defaults": { |
||
429 | "keyboard": "5" |
||
430 | } |
||
431 | }, |
||
432 | { |
||
433 | "name": "rovPilot.toggleHeadingHold", |
||
434 | "bindings": [ |
||
435 | { |
||
436 | "name": "keyboard", |
||
437 | "binding": "m" |
||
438 | } |
||
439 | ], |
||
440 | "description": "Toggles the heading hold on/off", |
||
441 | "defaults": { |
||
442 | "keyboard": "m" |
||
443 | } |
||
444 | }, |
||
445 | { |
||
446 | "name": "rovPilot.toggleDepthHold", |
||
447 | "bindings": [ |
||
448 | { |
||
449 | "name": "keyboard", |
||
450 | "binding": "n" |
||
451 | } |
||
452 | ], |
||
453 | "description": "Toggles the depth hold on/off", |
||
454 | "defaults": { |
||
455 | "keyboard": "n" |
||
456 | } |
||
457 | }, |
||
458 | { |
||
459 | "name": "serialMonitor.toggleSerialMonitor", |
||
460 | "bindings": [ |
||
461 | { |
||
462 | "name": "keyboard", |
||
463 | "binding": "u" |
||
464 | } |
||
465 | ], |
||
466 | "description": "Shows/hides raw serial monitor.", |
||
467 | "defaults": { |
||
468 | "keyboard": "u" |
||
469 | } |
||
470 | }, |
||
471 | { |
||
472 | "name": "tankcontrol.toggleTankControl", |
||
473 | "bindings": [ |
||
474 | { |
||
475 | "name": "keyboard", |
||
476 | "binding": "t" |
||
477 | } |
||
478 | ], |
||
479 | "description": "Toggles the tank control mode on/off", |
||
480 | "defaults": { |
||
481 | "keyboard": "t" |
||
482 | } |
||
483 | }, |
||
484 | { |
||
485 | "name": "rov.controlNames.leftLift", |
||
486 | "bindings": [ |
||
487 | { |
||
488 | "name": "gamepad", |
||
489 | "binding": "LEFT_STICK_X" |
||
490 | } |
||
491 | ], |
||
492 | "description": "Tankcontrol: Lift control control for the left hand gamepad.", |
||
493 | "defaults": { |
||
494 | "gamepad": "LEFT_STICK_X" |
||
495 | } |
||
496 | }, |
||
497 | { |
||
498 | "name": "rov.controlNames.portThrottle", |
||
499 | "bindings": [ |
||
500 | { |
||
501 | "name": "gamepad", |
||
502 | "binding": "LEFT_STICK_Y" |
||
503 | } |
||
504 | ], |
||
505 | "description": "Tankcontrol: Throttle control for the port prop.", |
||
506 | "defaults": { |
||
507 | "gamepad": "LEFT_STICK_Y" |
||
508 | } |
||
509 | }, |
||
510 | { |
||
511 | "name": "rov.controlNames.rightLift", |
||
512 | "bindings": [ |
||
513 | { |
||
514 | "name": "gamepad", |
||
515 | "binding": "RIGHT_STICK_X" |
||
516 | } |
||
517 | ], |
||
518 | "description": "Tankcontrol: Lift control control for the right hand gamepad.", |
||
519 | "defaults": { |
||
520 | "gamepad": "RIGHT_STICK_X" |
||
521 | } |
||
522 | }, |
||
523 | { |
||
524 | "name": "rov.controlNames.starboardThrottle", |
||
525 | "bindings": [ |
||
526 | { |
||
527 | "name": "gamepad", |
||
528 | "binding": "RIGHT_STICK_Y" |
||
529 | } |
||
530 | ], |
||
531 | "description": "Tankcontrol: Throttle control for the starboard prop.", |
||
532 | "defaults": { |
||
533 | "gamepad": "RIGHT_STICK_Y" |
||
534 | } |
||
535 | }, |
||
536 | { |
||
537 | "name": "rov.controlNames.starboardThrottle", |
||
538 | "bindings": [ |
||
539 | { |
||
540 | "name": "gamepad", |
||
541 | "binding": "RIGHT_STICK_Y" |
||
542 | } |
||
543 | ], |
||
544 | "description": "Tankcontrol: Throttle control for the starboard prop.", |
||
545 | "defaults": { |
||
546 | "gamepad": "RIGHT_STICK_Y" |
||
547 | } |
||
548 | } |
||
549 | ] |
||
550 | } |
||
551 | ] |
||
0 ignored issues
–
show
|
|||
552 | |||
553 | } |
||
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: ![]() |
|||
554 | |||
555 | module.exports = function (name, deps) { |
||
556 | return new ClassicControlMapping(name,deps); |
||
557 | }; |
||
558 |
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.
Further Readings: