AHRS calibration UI mostly done.

pull/578/head
Eric Westphal 2017-01-08 23:04:16 -05:00
rodzic 352c9eb79c
commit e0f794b907
4 zmienionych plików z 164 dodań i 43 usunięć

Wyświetl plik

@ -3,10 +3,10 @@ var URL_HOST_BASE = window.location.hostname;
var URL_SETTINGS_GET = "http://" + URL_HOST_BASE + "/getSettings";
var URL_SETTINGS_SET = "http://" + URL_HOST_BASE + "/setSettings";
var URL_GPS_GET = "http://" + URL_HOST_BASE + "/getSituation";
var URL_TOWERS_GET = "http://" + URL_HOST_BASE + "/getTowers"
var URL_STATUS_GET = "http://" + URL_HOST_BASE + "/getStatus"
var URL_SATELLITES_GET = "http://" + URL_HOST_BASE + "/getSatellites"
var URL_STATUS_WS = "ws://" + URL_HOST_BASE + "/status"
var URL_TOWERS_GET = "http://" + URL_HOST_BASE + "/getTowers";
var URL_STATUS_GET = "http://" + URL_HOST_BASE + "/getStatus";
var URL_SATELLITES_GET = "http://" + URL_HOST_BASE + "/getSatellites";
var URL_STATUS_WS = "ws://" + URL_HOST_BASE + "/status";
var URL_TRAFFIC_WS = "ws://" + URL_HOST_BASE + "/traffic";
var URL_WEATHER_WS = "ws://" + URL_HOST_BASE + "/weather";
var URL_DEVELOPER_GET = "ws://" + URL_HOST_BASE + "/developer";
@ -15,6 +15,7 @@ var URL_REBOOT = "http://" + URL_HOST_BASE + "/reboot";
var URL_SHUTDOWN = "http://" + URL_HOST_BASE + "/shutdown";
var URL_RESTARTAPP = "http://" + URL_HOST_BASE + "/restart";
var URL_DEV_TOGGLE_GET = "http://" + URL_HOST_BASE + "/develmodetoggle";
var URL_AHRS_ORIENT = "http://" + URL_HOST_BASE + "/orientAHRS";
// define the module with dependency on mobile-angular-ui
//var app = angular.module('stratux', ['ngRoute', 'mobile-angular-ui', 'mobile-angular-ui.gestures', 'appControllers']);

Wyświetl plik

@ -12,7 +12,7 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
settings[toggles[i]] = undefined;
}
$scope.update_files = '';
function loadSettings(data) {
settings = angular.fromJson(data);
// consider using angular.extend()
@ -37,7 +37,7 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
}
function getSettings() {
// Simple GET request example (note: responce is asynchronous)
// Simple GET request example (note: response is asynchronous)
$http.get(URL_SETTINGS_GET).
then(function (response) {
loadSettings(response.data);
@ -48,10 +48,10 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
settings[toggles[i]] = false;
}
});
};
}
function setSettings(msg) {
// Simple POST request example (note: responce is asynchronous)
// Simple POST request example (note: response is asynchronous)
$http.post(URL_SETTINGS_SET, msg).
then(function (response) {
loadSettings(response.data);
@ -68,7 +68,7 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
getSettings();
$scope.$watchGroup(toggles, function (newValues, oldValues, scope) {
var newsettings = {}
var newsettings = {};
var dirty = false;
for (i = 0; i < newValues.length; i++) {
if ((newValues[i] !== undefined) && (settings[toggles[i]] !== undefined)) {
@ -76,7 +76,7 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
settings[toggles[i]] = newValues[i];
newsettings[toggles[i]] = newValues[i];
dirty = true;
};
}
}
}
if (dirty) {
@ -86,7 +86,7 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
});
$scope.updateppm = function () {
settings["PPM"] = 0
settings["PPM"] = 0;
if (($scope.PPM !== undefined) && ($scope.PPM !== null) && ($scope.PPM !== settings["PPM"])) {
settings["PPM"] = parseInt($scope.PPM);
newsettings = {
@ -98,7 +98,7 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
};
$scope.updateBaud = function () {
settings["Baud"] = 0
settings["Baud"] = 0;
if (($scope.Baud !== undefined) && ($scope.Baud !== null) && ($scope.Baud !== settings["Baud"])) {
settings["Baud"] = parseInt($scope.Baud);
newsettings = {
@ -122,6 +122,7 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
setSettings(angular.toJson(newsettings));
}
};
$scope.updatemodes = function () {
if ($scope.OwnshipModeS !== settings["OwnshipModeS"]) {
settings["OwnshipModeS"] = $scope.OwnshipModeS.toUpperCase();
@ -160,25 +161,25 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
$scope.setUploadFile = function (files) {
$scope.update_files = files;
$scope.$apply();
}
};
$scope.resetUploadFile = function () {
$scope.update_files = '';
$scope.$apply();
}
};
$scope.uploadFile = function () {
var fd = new FormData();
//Take the first selected file
var file = $scope.update_files[0];
// check for empty string
if (file === undefined || file === null) {
alert ("update file not selected")
alert ("update file not selected");
return;
}
var filename = file.name;
// check for expected file naming convention
var re = /^update.*\.sh$/;
if (!re.exec(filename)) {
alert ("file does not appear to be an update")
alert ("file does not appear to be an update");
return;
}
@ -198,4 +199,23 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
});
};
};
$scope.setOrientation = function(action) {
console.log("sending " + action + " message.");
$http.post(URL_AHRS_ORIENT, action).
then(function (response) {
// success: do nothing
console.log("sent " + action + " message.");
}, function(response) {
// failure: cancel the calibration
switch (action) {
case "forward":
$scope.Ui.turnOff("modalCalibrateUp");
break;
case "up":
$scope.Ui.turnOff('modalCalibrateDone');
}
$scope.Ui.turnOn("modalCalibrateFailed");
});
};
}

Wyświetl plik

@ -3,31 +3,34 @@
<p>Use the toggles in the <strong>Hardware</strong> section to control which devices are active.</p>
<p class="text-warning">NOTE: Only hardware toggled on here, will appear on the
<stron>Status</stron> page.</p>
<strong>Status</strong> page.</p>
<p>The <strong>Diagnostics</strong> section helps with debugging and communicating with the Stratux project contributors via GitHub and the reddit subgroup.
<ul class="list-simple">
<li>Toggling <strong>Traffic Source</strong> adds text for traffic targets within your navigation application. Traffic received via UAT will display <code>u</code> while traffic received via 1090 will display <code>e</code>.</li>
<li>Toggling <strong>Record Logs</strong> enables logging to a series of files for your Stratux device including data recorded for UAT traffic and weather, 1090 traffic, GPS messages, and AHRS messages. The log files are accessible from the <strong>Logs</strong> menu available on the left.</li>
</ul>
<p>The <strong>Diagnostics</strong> section helps with debugging and communicating with the Stratux project contributors via GitHub and the reddit subgroup.</p>
<ul class="list-simple">
<li>Toggling <strong>Traffic Source</strong> adds text for traffic targets within your navigation application. Traffic received via UAT will display <code>u</code> while traffic received via 1090 will display <code>e</code>.</li>
<li>Toggling <strong>Record Logs</strong> enables logging to a series of files for your Stratux device including data recorded for UAT traffic and weather, 1090 traffic, GPS messages, and AHRS messages. The log files are accessible from the <strong>Logs</strong> menu available on the left.</li>
</ul>
<p>The <strong>Configuration</strong> section lets you adjust the default operation of your Stratux device.</p>
<ul class="list-simple">
<li>To avoid having your own aircraft appear as traffic, and scare the bejeezus our of you, you may provide your <strong>Mode S code</strong>. You can find this value in the FAA N-Number Registry for your aircraft. You should use the hexadecimal value (not the octal value) for this setting. No validation is done so please ensure you enter your valide Mode S value.
</li>
<li>The <strong>Weather</strong> page uses a user-defined <strong>Watch List</strong> to filter the large volume of ADS-B weather messages for display. Define a list of identifiers (airport, VOR, etc) separated by a spaces. For example <code>KBOS EEN LAH LKP</code>. You may change this list at any time and the <strong>Weather</strong> page will start watching for the updated list immediately.
<br/>
<span class="text-warning">NOTE: To save your changes, you must either tap somehwere else on the page or hit <code>ENTER</code> or <code>RETURN</code> or <code>GO</code> (or whatever your keyboard indicates).</span>
</li>
<li>The SDR (software defined radio) receiver support an adjustment in the form of a <strong>PPM Correction</strong>. From the Raspberry Pi, you may use the command <code>kal -g 48 -s GSM850</code> to scan for available channels in your area. Then use the command <code>kal -g 48 -c <em>channel#</em></code> to calculate the PPM.
<br/>
<span class="text-warning">NOTE: You will need to perform all commands as <code>root</code> by issuing the command: <code>sudo su -</code>. You will need to stop the Stratux software before running the calibration process. You can stop all of the Stratux processes with the command: <code>pkill screen</code>.</span>
</li>
<li>Addiitonal settings will be added in future releases.</li>
</ul>
<p>The <strong>System</strong> section lets you safely shutdown or reboot your Stratux device.</p>
<ul>
<li><strong>Shutdown</strong> will immediately shutdown the Stratux. You may then safely remove power.</li>
<li><strong>Reboot</strong> will immediately reboot the Stratux. After the reboot you may have to rejoin the WiFi connection to reconnect.</li>
</ul>
<p>The <strong>AHRS</strong> section allows for calibration and future configuration of the AHRS function.
<strong>Calibrate AHRS Sensors</strong> guides initial setup of the AHRS function, specifying the orientation of the sensors relative to the airplane. Additional calibration may be added later.</p>
<p>The <strong>Configuration</strong> section lets you adjust the default operation of your Stratux device.</p>
<ul class="list-simple">
<li>To avoid having your own aircraft appear as traffic, and scare the bejeezus our of you, you may provide your <strong>Mode S code</strong>. You can find this value in the FAA N-Number Registry for your aircraft. You should use the hexadecimal value (not the octal value) for this setting. No validation is done so please ensure you enter your valide Mode S value.
</li>
<li>The <strong>Weather</strong> page uses a user-defined <strong>Watch List</strong> to filter the large volume of ADS-B weather messages for display. Define a list of identifiers (airport, VOR, etc) separated by a spaces. For example <code>KBOS EEN LAH LKP</code>. You may change this list at any time and the <strong>Weather</strong> page will start watching for the updated list immediately.
<br/>
<span class="text-warning">NOTE: To save your changes, you must either tap somehwere else on the page or hit <code>ENTER</code> or <code>RETURN</code> or <code>GO</code> (or whatever your keyboard indicates).</span>
</li>
<li>The SDR (software defined radio) receiver support an adjustment in the form of a <strong>PPM Correction</strong>. From the Raspberry Pi, you may use the command <code>kal -g 48 -s GSM850</code> to scan for available channels in your area. Then use the command <code>kal -g 48 -c <em>channel#</em></code> to calculate the PPM.
<br/>
<span class="text-warning">NOTE: You will need to perform all commands as <code>root</code> by issuing the command: <code>sudo su -</code>. You will need to stop the Stratux software before running the calibration process. You can stop all of the Stratux processes with the command: <code>pkill screen</code>.</span>
</li>
<li>Addiitonal settings will be added in future releases.</li>
</ul>
<p>The <strong>System</strong> section lets you safely shutdown or reboot your Stratux device.</p>
<ul>
<li><strong>Shutdown</strong> will immediately shutdown the Stratux. You may then safely remove power.</li>
<li><strong>Reboot</strong> will immediately reboot the Stratux. After the reboot you may have to rejoin the WiFi connection to reconnect.</li>
</ul>
</div>

Wyświetl plik

@ -63,6 +63,19 @@
</div>
</div>
</div>
<div class="panel-group col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">AHRS</div>
<div class="panel-body">
<div class="col-xs-12">
<span style="position:relative; overflow: hidden;">
<button class="btn btn-primary btn-block" ui-turn-on="modalCalibrateForward">Calibrate AHRS Sensors</button>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-12">
@ -167,7 +180,91 @@
</div>
<div ui-content-for="modals">
<div class="modal" ui-if="modalReboot" ui-state="modalReboot">
<div class="modal" ui-if="modalCalibrateForward" ui-state="modalCalibrateForward">
<div class="modal-overlay "></div>
<div class="vertical-alignment-helper center-block">
<div class="modal-dialog vertical-align-center">
<div class="modal-content">
<div class="modal-header">
<button class="close" ui-turn-off="modalCalibrateForward"></button>
<h4 class="modal-title">Calibrate AHRS Sensors: Forward Direction</h4>
</div>
<div class="modal-body">
<p>Beginning sensor calibration. We will be telling the Stratux sensors which direction will be forward, which toward the left wing, and which toward the ground. You only have to do this once. The settings for this sensor will be saved for future flights.</p>
<p>First, point the Stratux/sensor box so that the end that will be pointing <strong>forward</strong> (toward the nose of the airplane) is pointing toward the sky, and while holding it that way, press the <strong>Set Forward Direction</strong> button.</p>
<p>The Stratux sensors will use the direction of gravity to determine the <strong>forward</strong> orientation.</p>
</div>
<div class="modal-footer">
<a ng-click="setOrientation('cancel')" ui-turn-off="modalCalibrateForward" class="btn btn-default">Cancel</a>
<a ng-click="setOrientation('forward')" ui-turn-off="modalCalibrateForward" ui-turn-on="modalCalibrateUp" class="btn btn-default btn-primary">Set Forward Direction</a>
</div>
</div>
</div>
</div>
</div>
<div class="modal" ui-if="modalCalibrateUp" ui-state="modalCalibrateUp">
<div class="modal-overlay "></div>
<div class="vertical-alignment-helper center-block">
<div class="modal-dialog vertical-align-center">
<div class="modal-content">
<div class="modal-header">
<button class="close" ui-turn-off="modalCalibrateUp"></button>
<h4 class="modal-title">Calibrate AHRS Sensors: Up Direction</h4>
</div>
<div class="modal-body">
<p>Next, place the Stratux/sensor box in the orientation it will be in during flight, and while holding it that way, press the <strong>Set Up Direction</strong> button.</p>
<p>The Stratux sensors will use the direction of gravity to determine the <strong>up</strong> orientation.</p>
<p>Once you've done that, the sensors will be calibrated. The direction toward the left wing will be determined automatically.</p>
</div>
<div class="modal-footer">
<a ng-click="setOrientation('cancel')" ui-turn-off="modalCalibrateUp" class="btn btn-default">Cancel</a>
<a ng-click="setOrientation('up')" ui-turn-off="modalCalibrateUp" ui-turn-on="modalCalibrateDone" class="btn btn-default btn-primary">Set Up Direction</a>
</div>
</div>
</div>
</div>
</div>
<div class="modal" ui-if="modalCalibrateDone" ui-state="modalCalibrateDone">
<div class="modal-overlay "></div>
<div class="vertical-alignment-helper center-block">
<div class="modal-dialog vertical-align-center">
<div class="modal-content">
<div class="modal-header">
<button class="close" ui-turn-off="modalCalibrateDone"></button>
<h4 class="modal-title">Calibrate AHRS Sensors: Finished</h4>
</div>
<div class="modal-body">
<p>The sensors are calibrated. These settings will be saved for future flights.</p>
</div>
<div class="modal-footer">
<a ui-turn-off="modalCalibrateDone" class="btn btn-default btn-primary">OK</a>
</div>
</div>
</div>
</div>
</div>
<div class="modal" ui-if="modalCalibrateFailed" ui-state="modalCalibrateFailed">
<div class="modal-overlay "></div>
<div class="vertical-alignment-helper center-block">
<div class="modal-dialog vertical-align-center">
<div class="modal-content">
<div class="modal-header">
<button class="close" ui-turn-off="modalCalibrateFailed"></button>
<h4 class="modal-title">Calibrate AHRS Sensors: Failed!</h4>
</div>
<div class="modal-body">
<p>There was an error! Maybe you held the same side of the sensor up both times?</p>
<p>The calibration failed.</p>
</div>
<div class="modal-footer">
<a ui-turn-off="modalCalibrateFailed" class="btn btn-default btn-primary">OK</a>
</div>
</div>
</div>
</div>
</div>
<div class="modal" ui-if="modalReboot" ui-state="modalReboot">
<div class="modal-overlay "></div>
<div class="vertical-alignment-helper center-block">
<div class="modal-dialog vertical-align-center">