|
| 1 | +import { v4 as uuid4 } from 'uuid' |
| 2 | + |
| 3 | +import { |
| 4 | + JoystickAxisActionCorrespondency, |
| 5 | + JoystickButtonActionCorrespondency, |
| 6 | + JoystickProtocol, |
| 7 | + JoystickProtocolActionsMapping, |
| 8 | +} from '@/types/joystick' |
| 9 | + |
| 10 | +/** |
| 11 | + * Standard axis profile using Blue Robotics recommended default mappings for ROV controllers. |
| 12 | + */ |
| 13 | +export const axisConfigMapROV: JoystickAxisActionCorrespondency = { |
| 14 | + 3: { |
| 15 | + action: { id: 'axis_z', name: 'Axis Z', protocol: JoystickProtocol.MAVLinkManualControl }, |
| 16 | + min: 1000, |
| 17 | + max: 0, |
| 18 | + }, |
| 19 | + 4: { |
| 20 | + action: { id: 'axis_y', name: 'Axis Y', protocol: JoystickProtocol.MAVLinkManualControl }, |
| 21 | + min: -1000, |
| 22 | + max: 1000, |
| 23 | + }, |
| 24 | + 5: { |
| 25 | + action: { id: 'axis_x', name: 'Axis X', protocol: JoystickProtocol.MAVLinkManualControl }, |
| 26 | + min: 1000, |
| 27 | + max: -1000, |
| 28 | + }, |
| 29 | + 6: { |
| 30 | + action: { id: 'axis_r', name: 'Axis R', protocol: JoystickProtocol.MAVLinkManualControl }, |
| 31 | + min: -1000, |
| 32 | + max: 1000, |
| 33 | + }, |
| 34 | +} |
| 35 | + |
| 36 | +/** |
| 37 | + * Standard button profile using Blue Robotics recommended default mappings for ROV controllers. |
| 38 | + */ |
| 39 | +export const buttonConfigMapROV: JoystickButtonActionCorrespondency = { |
| 40 | + 7: { action: { id: 'no_function', name: 'Shift (modifier)', protocol: JoystickProtocol.Other } }, |
| 41 | + 9: { action: { id: 'servo_1_max_momentary', name: 'Gripper Open', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 42 | + 10: { |
| 43 | + action: { id: 'servo_1_min_momentary', name: 'Gripper Close', protocol: JoystickProtocol.MAVLinkManualControl }, |
| 44 | + }, |
| 45 | + 12: { action: { id: 'camera-zoom-increase', name: 'Camera Zoom In', protocol: JoystickProtocol.CockpitAction } }, |
| 46 | + 13: { action: { id: 'camera-zoom-decrease', name: 'Camera Zoom Out', protocol: JoystickProtocol.CockpitAction } }, |
| 47 | + 14: { action: { id: 'camera-focus-increase', name: 'Camera Focus Near', protocol: JoystickProtocol.CockpitAction } }, |
| 48 | + 15: { action: { id: 'camera-focus-decrease', name: 'Camera Focus Far', protocol: JoystickProtocol.CockpitAction } }, |
| 49 | + 16: { action: { id: 'btn_auto_focus', name: 'Auto Focus', protocol: JoystickProtocol.CockpitAction } }, |
| 50 | + 17: { action: { id: 'btn_auto_wb', name: 'Auto White Balance', protocol: JoystickProtocol.CockpitAction } }, |
| 51 | + 18: { action: { id: 'gain_inc', name: 'Pilot Gain +', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 52 | + 19: { action: { id: 'gain_dec', name: 'Pilot Gain –', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 53 | + 20: { action: { id: 'Arm', name: 'Arm', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 54 | + 21: { action: { id: 'Disarm', name: 'Disarm', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 55 | + 22: { action: { id: 'mount_tilt_up', name: 'Camera Tilt Up', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 56 | + 23: { action: { id: 'mount_tilt_down', name: 'Camera Tilt Down', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 57 | + 24: { action: { id: 'mount_center', name: 'Camera Tilt Center', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 58 | + 25: { action: { id: 'lights1_brighter', name: 'Lights Brighter', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 59 | + 26: { action: { id: 'lights1_dimmer', name: 'Lights Dimmer', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 60 | + 27: { action: { id: 'trim_pitch_inc', name: 'Trim Pitch Forward', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 61 | + 28: { |
| 62 | + action: { id: 'trim_pitch_dec', name: 'Trim Pitch Backward', protocol: JoystickProtocol.MAVLinkManualControl }, |
| 63 | + }, |
| 64 | + 29: { action: { id: 'trim_roll_inc', name: 'Trim Roll Right', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 65 | + 30: { action: { id: 'trim_roll_dec', name: 'Trim Roll Left', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 66 | + 31: { action: { id: 'mode_manual', name: 'Manual Mode', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 67 | + 32: { action: { id: 'mode_depth_hold', name: 'Depth-hold Mode', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 68 | + 33: { action: { id: 'mode_stabilize', name: 'Stabilize Mode', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 69 | + 34: { action: { id: 'input_hold_set', name: 'Toggle Input Hold', protocol: JoystickProtocol.MAVLinkManualControl } }, |
| 70 | + 35: { |
| 71 | + action: { id: 'roll_pitch_toggle', name: 'Roll & Pitch Toggle', protocol: JoystickProtocol.MAVLinkManualControl }, |
| 72 | + }, |
| 73 | +} |
| 74 | + |
| 75 | +/** |
| 76 | + * Basic blank mapping to be used as a starting point in the joystick configuration wizard. |
| 77 | + */ |
| 78 | +export const blankWizardMapping: JoystickProtocolActionsMapping = { |
| 79 | + name: 'Wizard Functions mapping', |
| 80 | + hash: uuid4(), |
| 81 | + axesCorrespondencies: {} as JoystickProtocolActionsMapping['axesCorrespondencies'], |
| 82 | + buttonsCorrespondencies: { |
| 83 | + regular: {}, |
| 84 | + shift: {}, |
| 85 | + }, |
| 86 | +} |
0 commit comments