Initial display of MagHeading, Slip/Skid, TurnRate, GLoad on web UI.

pull/578/head
Eric Westphal 2017-03-08 18:11:05 -05:00
rodzic d2526efc7c
commit 234dcb3726
3 zmienionych plików z 28 dodań i 4 usunięć

Wyświetl plik

@ -56,6 +56,18 @@
<span class="col-xs-3 text-center">{{ahrs_roll}}&deg;</span> <span class="col-xs-3 text-center">{{ahrs_roll}}&deg;</span>
<span class="col-xs-3 text-center">{{ahrs_alt}} ft</span> <span class="col-xs-3 text-center">{{ahrs_alt}} ft</span>
</div> </div>
<div class="row">
<strong class="col-xs-3 text-center">Mag Hdg:</strong>
<strong class="col-xs-3 text-center">Slip/Skid:</strong>
<strong class="col-xs-3 text-center">Turn Rate:</strong>
<strong class="col-xs-3 text-center">G Load:</strong>
</div>
<div class="row">
<span class="col-xs-3 text-center">{{ahrs_heading_mag}}&deg;</span>
<span class="col-xs-3 text-center">{{ahrs_slip_skid}}&deg;</span>
<span class="col-xs-3 text-center">{{ahrs_turn_rate}} s</span>
<span class="col-xs-3 text-center">{{ahrs_gload}}G</span>
</div>
</div> </div>
</div> </div>
</div> </div>

Wyświetl plik

@ -48,14 +48,15 @@ ahrsRenderer.prototype = {
} }
}, },
orientation: function (pitch, roll, heading) { orientation: function (pitch, roll, heading, slipSkid) {
// Assume we receive valid pitch, roll, heading // Assume we receive valid pitch, roll, heading
this.pitch = pitch; this.pitch = pitch;
this.roll = roll; this.roll = roll;
this.heading = heading; this.heading = heading;
this.slipSkid = slipSkid;
}, },
animate: function (t, pitch, roll, heading) { animate: function (t, pitch, roll, heading, slipSkid) {
var FPS = 40; // we assume we can maintain a certain frame rate var FPS = 40; // we assume we can maintain a certain frame rate
var x_inc = ((pitch - this.pitch) / (FPS * t)); var x_inc = ((pitch - this.pitch) / (FPS * t));
var y_inc = ((roll - this.roll) / (FPS * t)); var y_inc = ((roll - this.roll) / (FPS * t));
@ -67,6 +68,7 @@ ahrsRenderer.prototype = {
this.heading += 360; this.heading += 360;
} }
var z_inc = ((heading - this.heading) / (FPS * t)); var z_inc = ((heading - this.heading) / (FPS * t));
var w_inc = ((slipSkid - this.slipSkid) / (FPS * t));
var _this = this; var _this = this;
//console.log(z_inc); //console.log(z_inc);
var frames = 0; var frames = 0;
@ -74,12 +76,13 @@ ahrsRenderer.prototype = {
_this.pitch += x_inc; _this.pitch += x_inc;
_this.roll += y_inc; _this.roll += y_inc;
_this.heading += z_inc; _this.heading += z_inc;
_this.slipSkid += w_inc;
if (frames < (FPS * t)) { if (frames < (FPS * t)) {
_this.draw(); _this.draw();
frames++; frames++;
window.requestAnimationFrame(f); // recurse window.requestAnimationFrame(f); // recurse
} else { } else {
_this.orientation(pitch, roll, heading); _this.orientation(pitch, roll, heading, slipSkid);
} }
}; };
f(); f();

Wyświetl plik

@ -106,6 +106,15 @@ function GPSCtrl($rootScope, $scope, $state, $http, $interval) {
// pitch and roll are in degrees // pitch and roll are in degrees
$scope.ahrs_pitch = Math.round(status.Pitch*10)/10; $scope.ahrs_pitch = Math.round(status.Pitch*10)/10;
$scope.ahrs_roll = Math.round(status.Roll*10)/10; $scope.ahrs_roll = Math.round(status.Roll*10)/10;
$scope.ahrs_heading_mag = Math.round(status.Mag_heading);
$scope.ahrs_slip_skid = Math.round(status.SlipSkid*10)/10;
if (status.RateOfTurn > 0.001) {
$scope.ahrs_turn_rate = Math.round(360/status.RateOfTurn);
} else {
$scope.ahrs_turn_rate = '--'
}
$scope.ahrs_gload = Math.round(status.GLoad*100)/100;
// "LastAttitudeTime":"2015-10-11T16:47:03.534615187Z" // "LastAttitudeTime":"2015-10-11T16:47:03.534615187Z"
setGeoReferenceMap(status.Lat, status.Lng); setGeoReferenceMap(status.Lat, status.Lng);
@ -118,7 +127,7 @@ function GPSCtrl($rootScope, $scope, $state, $http, $interval) {
$http.get(URL_GPS_GET). $http.get(URL_GPS_GET).
then(function (response) { then(function (response) {
loadStatus(response.data); loadStatus(response.data);
ahrs.animate(0.1, $scope.ahrs_pitch, $scope.ahrs_roll, $scope.ahrs_heading); ahrs.animate(0.1, $scope.ahrs_pitch, $scope.ahrs_roll, $scope.ahrs_heading, $scope.ahrs_slip_skid);
// $scope.$apply(); // $scope.$apply();
}, function (response) { }, function (response) {
$scope.raw_data = "error getting gps / ahrs status"; $scope.raw_data = "error getting gps / ahrs status";