Skip to content

Commit

Permalink
Merge pull request #2106 from iNavFlight/mmosca-gimbal-test
Browse files Browse the repository at this point in the history
Serial gimbal support
  • Loading branch information
mmosca authored Jun 20, 2024
2 parents dd3ca98 + 7aeef9f commit e3a6096
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ inav-configurator.iml
/out
.eslintrc.json
/.project
/cache/
/dist/
/apps/
/build/
*~
*.swp
*.bak
eeprom.bin
5 changes: 4 additions & 1 deletion js/fc.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,9 @@ var FC = {
'GVAR 6', // 36
'GVAR 7', // 37
'Mixer Transition', // 38
'Head Tracker Pan', // 39
'Head Tracker Tilt', // 40
'Head Tracker Roll', // 41
];
},
getServoMixInputName: function (input) {
Expand Down Expand Up @@ -1116,4 +1119,4 @@ var FC = {
}
};

module.exports = FC;
module.exports = FC;
20 changes: 20 additions & 0 deletions js/flightModes.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,26 @@ var FLIGHT_MODES = [
boxId: 55,
boxName: "ANGLE HOLD",
permanentId: 64
},
{
boxId: 56,
boxName: "GIMBAL LEVEL TILT",
permanentId: 65,
},
{
boxId: 57,
boxName: "GIMBAL LEVEL ROLL",
permanentId: 66
},
{
boxId: 58,
boxName: "GIMBAL CENTER",
permanentId: 67
},
{
boxId: 59,
boxName: "GIMBAL HEADTRACKER",
permanentId: 68
}
];

Expand Down
15 changes: 14 additions & 1 deletion js/serialPortHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ const serialPortHelper = (function () {
name: 'SBUS_OUTPUT',
groups: ['peripherals'],
defaultBaud: 115200
},
{
name: 'GIMBAL',
groups: ['peripherals'],
defaultBaud: 115200
},
{
name: 'HEADTRACKER',
groups: ['peripherals'],
defaultBaud: 115200
}
];

Expand Down Expand Up @@ -150,6 +160,8 @@ const serialPortHelper = (function () {
'SBUS_OUTPUT': 22,
'SMARTPORT_MASTER': 23,
'MSP_DISPLAYPORT': 25,
'GIMBAL': 26,
'HEADTRACKER': 27
};

privateScope.identifierToName = {
Expand Down Expand Up @@ -182,7 +194,8 @@ const serialPortHelper = (function () {
'19200',
'38400',
'57600',
'115200'
'115200',
'230400'
],
'TELEMETRY': [
'AUTO',
Expand Down
36 changes: 36 additions & 0 deletions locale/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,36 @@
"configurationVTXLowPowerDisarmValue_2": {
"message": "Until first arm"
},
"configurationGimbal": {
"message": "Serial Gimbal"
},
"configurationGimbalSensitivity": {
"message":"Gimbal sensitivity"
},
"configurationGimbalPanChannel": {
"message":"Pan channel (yaw)"
},
"configurationGimbalTiltChannel": {
"message":"Tilt channel (pitch)"
},
"configurationGimbalRollChannel": {
"message":"Roll channel"
},
"configurationHeadtracker": {
"message": "Headtracker"
},
"configurationHeadtrackerType": {
"message": "Head tracker type"
},
"configurationHeadtrackerPanRatio": {
"message": "Head tracker pan movement ratio"
},
"configurationHeadtrackerTiltRatio": {
"message": "Head tracker tilt movement ratio"
},
"configurationHeadtrackerRollRatio": {
"message": "Head tracker roll movement ratio"
},
"portsHelp": {
"message": "<strong>Note:</strong> not all combinations are valid. When the flight controller firmware detects this the serial port configuration will be reset."
},
Expand Down Expand Up @@ -1322,6 +1352,12 @@
"portsFunction_SBUS_OUTPUT": {
"message": "SBus Output"
},
"portsFunction_GIMBAL": {
"message": "Serial Gimbal"
},
"portsFunction_HEADTRACKER": {
"message": "Serial Headtracker"
},
"pidTuning_Other": {
"message": "Other"
},
Expand Down
5 changes: 4 additions & 1 deletion tabs/auxiliary.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ TABS.auxiliary.initialize = function (callback) {
modeSections["Multi-rotor"] = ["FPV ANGLE MIX", "TURTLE", "MC BRAKING", "HEADFREE", "HEADADJ"];
modeSections["OSD Modes"] = ["OSD OFF", "OSD ALT 1", "OSD ALT 2", "OSD ALT 3"];
modeSections["FPV Camera Modes"] = ["CAMSTAB", "CAMERA CONTROL 1", "CAMERA CONTROL 2", "CAMERA CONTROL 3"];
modeSections["Misc Modes"] = ["BEEPER", "LEDS OFF", "LIGHTS", "HOME RESET", "WP PLANNER", "MISSION CHANGE", "BLACKBOX", "FAILSAFE", "KILLSWITCH", "TELEMETRY", "MSP RC OVERRIDE", "USER1", "USER2", "USER3", "USER4"];
modeSections["VTOL"] = ["MIXER PROFILE 2", "MIXER TRANSITION"];
modeSections["Beeper"] = ["BEEPER", "BEEPER MUTE"];
modeSections["Gimbal"] = ["GIMBAL LEVEL TILT", "GIMBAL LEVEL ROLL", "GIMBAL LEVEL PAN", "GIMBAL HEADTRACKER", "GIMBAL CENTER"];
modeSections["Misc Modes"] = ["LEDS OFF", "LIGHTS", "HOME RESET", "WP PLANNER", "MISSION CHANGE", "BLACKBOX", "FAILSAFE", "KILLSWITCH", "TELEMETRY", "MSP RC OVERRIDE", "USER1", "USER2", "USER3", "USER4"];

function sort_modes_for_display() {
// Sort the modes
Expand Down
62 changes: 62 additions & 0 deletions tabs/configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,68 @@
</div>
</div>

<div class="config-section gui_box grey config-gimbal">
<div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="configurationGimbal"></div>
</div>
<div class="number gimbal_sensitivity_wrapper">
<input type="number" id="gimbal_sensitivity" name="gimbal_sensitivity" data-setting="gimbal_sensitivity" />
<label for="gimbal_sensitivity">
<span data-i18n="configurationGimbalSensitivity"></span>
</label>
</div>
<div class="number gimbal_pan_channel_wrapper">
<input type="number" id="gimbal_pan_channel" name="gimbal_pan_channel" data-setting="gimbal_pan_channel" />
<label for="gimbal_pan_channel">
<span data-i18n="configurationGimbalPanChannel"></span>
</label>
</div>
<div class="number gimbal_tilt_channel_wrapper">
<input type="number" id="gimbal_tilt_channel" name="gimbal_tilt_channel" data-setting="gimbal_tilt_channel" />
<label for="gimbal_tilt_channel">
<span data-i18n="configurationGimbalTiltChannel"></span>
</label>
</div>
<div class="number gimbal_roll_channel_wrapper">
<input type="number" id="gimbal_roll_channel" name="gimbal_roll_channel" data-setting="gimbal_roll_channel" />
<label for="gimbal_roll_channel">
<span data-i18n="configurationGimbalRollChannel"></span>
</label>
</div>
</div>

<div class="config-section gui_box grey config-headtracker">
<div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="configurationHeadtracker"></div>
</div>
<div class="select headtracker_type_wrapper">
<select id="headtracker-type" data-setting="headtracker_type"></select>
<label for="headtrack-type">
<span data-i18n="configurationHeadtrackerType"></span>
</label>
</div>

<div class="number headtracker_pan_ratio_wrapper">
<input type="number" data-step="0.01" min="0" max="5" id="headtracker_pan_ratio" data-setting="headtracker_pan_ratio">
<label for="headtracker_pan_ratio">
<span data-i18n="configurationHeadtrackerPanRatio"></span>
</label>
</div>
<div class="number headtracker_tilt_ratio_wrapper">
<input type="number" data-step="0.01" min="0" max="5" id="headtracker_tilt_ratio" data-setting="headtracker_tilt_ratio">
<label for="headtracker_tilt_ratio">
<span data-i18n="configurationHeadtrackerPanRatio"></span>
</label>
</div>
<div class="number headtracker_roll_ratio_wrapper">
<input type="number" data-step="0.01" id="headtracker_roll_ratio" data-setting="headtracker_roll_ratio">
<label for="headtracker_roll_ratio">
<span data-i18n="configurationHeadtrackerRollRatio"></span>
</label>
</div>
</div>
</div>

</div>

<div class="clear-both"></div>
Expand Down

0 comments on commit e3a6096

Please sign in to comment.