Skip to content

Commit

Permalink
SITL integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Scavanger committed Mar 8, 2023
1 parent 5a6c2d7 commit 069d0f2
Show file tree
Hide file tree
Showing 26 changed files with 7,753 additions and 6,866 deletions.
120 changes: 118 additions & 2 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,124 @@
"tabAuxiliary": {
"message": "Modes"
},

"serialPortOpened": {
"tabSitl": {
"message" : "SITL"
},
"sitlDemoMode": {
"message": "Demo Mode"
},
"sitlResetDemoModeData": {
"message": "Reset Demo Mode"
},
"sitlOSNotSupported": {
"message": "SITL is not supported on this operating system."
},
"sitlOptions": {
"message": "SITL Options"
},
"sitlEnableSim": {
"message": "Enable simulator"
},
"sitlSimulator": {
"message": "Simulator"
},
"sitlUseImu": {
"message": "Use IMU"
},
"sitlSimIP": {
"message" : "Simulator IP"
},
"sitlPort": {
"message" : "Simulator Port"
},
"sitlChannelMap": {
"message": "Channel Mapping"
},
"sitlSimInput": {
"message": "Simulator Input"
},
"sitlInavOutput": {
"message": "INAV Output"
},
"sitlLog": {
"message": "Log"
},
"sitlStart": {
"message": "Start"
},
"sitlStop": {
"message": "Stop"
},
"sitlStopped": {
"message": "SITL stopped\n"
},
"sitlProfiles": {
"message": "SITL Profiles"
},
"sitlNew": {
"message": "New"
},
"sitlSave": {
"message": "Save"
},
"sitlDelete": {
"message": "Delete"
},
"sitlNewProfile": {
"message": "New SITL Profile"
},
"sitlEnterName": {
"message": "(Profile name)"
},
"sitlProfileExists": {
"message": "A profile with this name already exists."
},
"sitlStdProfileCantDeleted": {
"message": "SITL standard profile can't be deleted."
},
"sitlSerialToTCP": {
"message": "Serial to TCP (UART)"
},
"sitlSerialProtocoll": {
"message": "Preset for RX Protocoll"
},
"sitlSerialStopbits": {
"message": "Stopbits"
},
"sitlSerialPort": {
"message": "Serial port"
},
"sitlSerialTCPPort": {
"message": "TCP port"
},
"sitlSerialParity": {
"message": "Parity"
},
"sitlSerialTcpEnable": {
"message": "Enable"
},
"sitlHelp": {
"message": "SITL (Software in the loop) allows to run INAV completely in software on the PC without using a flight controller and simulate complete FPV flights. For this, INAV is compiled with a normal PC compiler. The sensors are replaced by data provided by a simulator.<br/>Currently supported are:<br/><ul><li><a href=\"https://www.realflight.com\" target=\"_blank\">RealFlight</a><br/></li><li><a href=\"https://www.x-plane.com\" target=\"_blank\">X-Plane</a></li></ul>"
},
"sitlProfilesHelp": {
"message": "Profiles are saved locally. The profiles contain not only all data of this tab, but also the configuration file (\"EEPROM\") of INAV itself."
},
"sitlEnableSimulatorHelp": {
"message": "If this option is deactivated, only the Configurator can be used. Useful to configure INAV without having to start the simulator."
},
"sitlUseImuHelp": {
"message": "Use IMU sensor data from the simulator instead of using attitude data from the simulator directly (Experimental, not recommended)."
},
"sitlIpHelp": {
"message": "IP address of the computer on which the simulator is running. If the simulator is running on the same computer, leave it at \"127.0.0.1"
},
"sitlPortHelp": {
"message": "Port number of the interface of the simulator. Note: The RealFlight port is fixed and cannot be changed."
},
"sitlSer2TcpHelp": {
"message": "Devices with a UART interface can be used with SITL via a serial to USB interface. Especially intended for serial receivers to use the full number of channels. "
},
"serialPortOpened": {
"message": "MSP connection <span style=\"color: #37a8db\">successfully</span> opened with ID: $1"
},
"serialPortOpenFail": {
Expand Down
6 changes: 5 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ sources.js = [
'./js/waypoint.js',
'./node_modules/openlayers/dist/ol.js',
'./js/libraries/plotly-latest.min.js',
'./js/sitl.js',
];

sources.receiverCss = [
Expand Down Expand Up @@ -252,6 +253,8 @@ gulp.task('dist-build', gulp.series('build', function() {
'./resources/models/*',
'./resources/osd/analogue/*.mcm',
'./resources/motor_order/*.svg',
'./resources/sitl/windows/*',
'./resources/sitl/linux/*'
];
return gulp.src(distSources, { base: '.' })
.pipe(gulp.dest(distDir));
Expand All @@ -268,7 +271,8 @@ gulp.task('apps', gulp.series('dist', function(done) {
flavor: 'normal',
macIcns: './images/inav.icns',
winIco: './images/inav.ico',
version: get_nw_version()
version: get_nw_version(),
zip: false
});
builder.on('log', console.log);
builder.build(function (err) {
Expand Down
18 changes: 11 additions & 7 deletions images/icons/cf_icon_setup_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions images/icons/cf_icon_sitl_grey.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions images/icons/cf_icon_sitl_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/inav.ico
Binary file not shown.
3 changes: 2 additions & 1 deletion js/fc.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,8 @@ var FC = {
'NMEA',
'UBLOX',
'UBLOX7',
'MSP'
'MSP',
'FAKE'
];
},
getGpsBaudRates: function () {
Expand Down
1 change: 1 addition & 0 deletions js/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var GUI_control = function () {
'landing',
'firmware_flasher',
'mission_control',
'sitl',
'help'
];
this.defaultAllowedTabsWhenConnected = [
Expand Down
4 changes: 3 additions & 1 deletion js/port_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ PortHandler.check = function () {
chrome.storage.local.get('last_used_port', function (result) {
// if last_used_port was set, we try to select it
if (result.last_used_port) {
if (result.last_used_port == "ble" || result.last_used_port == "tcp" || result.last_used_port == "udp") {
if (result.last_used_port == "ble" || result.last_used_port == "tcp" || result.last_used_port == "udp" || result.last_used_port == "sitl" || result.last_used_port == "sitl-demo") {
$('#port').val(result.last_used_port);
} else {
current_ports.forEach(function(port) {
Expand Down Expand Up @@ -181,6 +181,8 @@ PortHandler.update_port_select = function (ports) {
$('div#port-picker #port').append($("<option/>", {value: 'ble', text: 'BLE', data: {isBle: true}}));
$('div#port-picker #port').append($("<option/>", {value: 'tcp', text: 'TCP', data: {isTcp: true}}));
$('div#port-picker #port').append($("<option/>", {value: 'udp', text: 'UDP', data: {isUdp: true}}));
$('div#port-picker #port').append($("<option/>", {value: 'sitl', text: 'SITL', data: {isSitl: true}}));
$('div#port-picker #port').append($("<option/>", {value: 'sitl-demo', text: 'Demo mode', data: {isSitl: true}}));
};

PortHandler.port_detected = function(name, code, timeout, ignore_timeout) {
Expand Down
23 changes: 19 additions & 4 deletions js/serial_backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ $(document).ready(function () {

var $port = $('#port'),
$baud = $('#baud'),
$portOverride = $('#port-override');
$portOverride = $('#port-override'),
isDemoRunning = false;

/*
* Handle "Wireless" mode with strict queueing of messages
Expand Down Expand Up @@ -89,22 +90,22 @@ $(document).ready(function () {
$('#port-override-label').text("Port");
}

if (selected_port.data().isDFU || selected_port.data().isBle || selected_port.data().isTcp || selected_port.data().isUdp) {
if (selected_port.data().isDFU || selected_port.data().isBle || selected_port.data().isTcp || selected_port.data().isUdp || selected_port.data().isSitl) {
$baud.hide();
}
else {
$baud.show();
}

if (selected_port.data().isBle || selected_port.data().isTcp || selected_port.data().isUdp) {
if (selected_port.data().isBle || selected_port.data().isTcp || selected_port.data().isUdp || selected_port.data().isSitl) {
$('.tab_firmware_flasher').hide();
} else {
$('.tab_firmware_flasher').show();
}
var type = ConnectionType.Serial;
if (selected_port.data().isBle) {
type = ConnectionType.BLE;
} else if (selected_port.data().isTcp) {
} else if (selected_port.data().isTcp || selected_port.data().isSitl) {
type = ConnectionType.TCP;
} else if (selected_port.data().isUdp) {
type = ConnectionType.UDP;
Expand Down Expand Up @@ -150,10 +151,24 @@ $(document).ready(function () {

if (selected_port == 'tcp' || selected_port == 'udp') {
CONFIGURATOR.connection.connect($portOverride.val(), {}, onOpen);
} else if (selected_port == 'sitl') {
CONFIGURATOR.connection.connect("127.0.0.1:5760", {}, onOpen);
} else if (selected_port == 'sitl-demo') {
if (SITLProcess.isRunning) {
SITLProcess.stop();
}
SITLProcess.start("demo.bin");
this.isDemoRunning = true;
CONFIGURATOR.connection.connect("127.0.0.1:5760", {}, onOpen);
} else {
CONFIGURATOR.connection.connect(selected_port, {bitrate: selected_baud}, onOpen);
}
} else {
if (this.isDemoRunning) {
SITLProcess.stop();
this.isDemoRunning = false;
}

var wasConnected = CONFIGURATOR.connectionValid;

helper.timeout.killAll();
Expand Down
Loading

0 comments on commit 069d0f2

Please sign in to comment.