Remove 'up' section from orientation procedure.

pull/641/head
Eric Westphal 2017-07-06 19:45:01 -04:00
rodzic ccf04867fb
commit e0faa71b3f
5 zmienionych plików z 15 dodań i 81 usunięć

Wyświetl plik

@ -1132,7 +1132,7 @@ func defaultSettings() {
globalSettings.DisplayTrafficSource = false
globalSettings.ReplayLog = false //TODO: 'true' for debug builds.
globalSettings.AHRSLog = false
globalSettings.IMUMapping = [2]int{-1, -3} // OpenFlightBox AHRS normal mapping
globalSettings.IMUMapping = [2]int{-1, 0}
globalSettings.OwnshipModeS = "F00000"
globalSettings.DeveloperMode = false
globalSettings.StaticIps = make([]string, 0)

Wyświetl plik

@ -429,8 +429,6 @@ func handleRebootRequest(w http.ResponseWriter, r *http.Request) {
go delayReboot()
}
var f int // We need this to be global to handle successive calls to handleOrientAHRS.
func handleOrientAHRS(w http.ResponseWriter, r *http.Request) {
// define header in support of cross-domain AJAX
setNoCache(w)
@ -444,7 +442,6 @@ func handleOrientAHRS(w http.ResponseWriter, r *http.Request) {
if r.Method == "POST" {
var (
action []byte = make([]byte, 1)
u int
err error
)
@ -455,37 +452,21 @@ func handleOrientAHRS(w http.ResponseWriter, r *http.Request) {
switch action[0] {
case 'f': // Set sensor "forward" direction (toward nose of airplane).
if f, err = getMinAccelDirection(); err != nil {
f, err := getMinAccelDirection()
if err != nil {
log.Printf("AHRS Error: sensor orientation: couldn't read accelerometer: %s\n", err)
http.Error(w, fmt.Sprintf("couldn't read accelerometer: %s\n", err), http.StatusBadRequest)
return
}
log.Printf("AHRS Info: sensor orientation: received forward direction %d\n", f)
case 'u': // Set sensor "up" direction (toward top of airplane).
if u, err = getMinAccelDirection(); err != nil {
log.Printf("AHRS Error: sensor orientation: couldn't read accelerometer: %s\n", err)
http.Error(w, fmt.Sprintf("couldn't read accelerometer: %s\n", err), http.StatusBadRequest)
return
}
log.Printf("AHRS Info: sensor orientation: received up direction %d\n", u)
if f == u || f == -u {
log.Printf("AHRS Error: sensor orientation: up (%d) and forward (%d) axes cannot be the same\n", u, f)
http.Error(w, fmt.Sprintf("up (%d) and forward (%d) axes cannot be the same", u, f),
http.StatusBadRequest)
return
}
globalSettings.IMUMapping = [2]int{f, u}
log.Printf("AHRS Info: sensor orientation success! forward axis is %d\n", f)
globalSettings.IMUMapping = [2]int{f, 0}
case 'd': // Set sensor "up" direction (toward top of airplane).
globalSettings.SensorQuaternion = [4]float64{0, 0, 0, 0}
saveSettings()
myIMUReader.Close()
globalStatus.IMUConnected = false // restart the processes depending on the orientation
ResetAHRSGLoad()
log.Printf("AHRS Info: sensor orientation success! forward: %d; up: %d\n", f, u)
default: // Cancel the sensor calibration.
f = 0
log.Println("AHRS Info: sensor orientation: canceled")
time.Sleep(2000 * time.Millisecond)
}
}
}

Wyświetl plik

@ -330,7 +330,6 @@ func updateExtraLogging() {
func makeOrientationQuaternion(g [3]float64) (f *[4]float64) {
if globalSettings.IMUMapping[0] == 0 { // if unset, default to some standard orientation
globalSettings.IMUMapping[0] = -1 // +2 for RY836AI
globalSettings.IMUMapping[1] = -3 // +3 for RY836AI
}
// This is the "forward direction" chosen during the orientation process.

Wyświetl plik

@ -232,18 +232,11 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
$http.post(URL_AHRS_ORIENT, action).
then(function (response) {
// console.log("sent " + action + " message.");
setTimeout(getSettings, 5000); // Sleep to allow leveling to finish.
}, function(response) {
// failure: cancel the calibration
// console.log(response.data);
$scope.Orientation_Failure_Message = response.data;
switch (action) {
case "forward":
$scope.Ui.turnOff("modalCalibrateUp");
break;
case "up":
$scope.Ui.turnOff('modalCalibrateDone');
}
$scope.Ui.turnOff('modalCalibrateDone');
$scope.Ui.turnOn("modalCalibrateFailed");
});
};

Wyświetl plik

@ -261,31 +261,11 @@
<h4 class="modal-title">Set AHRS Sensor Orientation: Forward Direction</h4>
</div>
<div class="modal-body">
<p>Point the Stratux/sensor box so that the end that will be pointing toward the <strong>nose</strong> of the airplane is pointing toward the sky and press the <strong>Set Forward Direction</strong> button.</p>
<p>Point the Stratux so that the end that will be pointing toward the <strong>nose</strong> of the airplane is pointing toward the sky and press the <strong>Set Forward Direction</strong> button.</p>
</div>
<div class="modal-footer">
<a ui-turn-off="modalCalibrateForward" ui-turn-on="modalCalibrateCanceled" 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">Set AHRS Sensor Orientation: Up Direction</h4>
</div>
<div class="modal-body">
<p>Place the Stratux/sensor box in the orientation it will be in during flight and press the <strong>Set Up Direction</strong> button.</p>
</div>
<div class="modal-footer">
<a ui-turn-off="modalCalibrateUp" ui-turn-on="modalCalibrateCanceled" 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>
<a ui-turn-off="modalCalibrateForward" class="btn btn-default">Cancel</a>
<a ng-click="setOrientation('forward')" ui-turn-off="modalCalibrateForward" ui-turn-on="modalCalibrateDone" class="btn btn-default btn-primary">Set Forward Direction</a>
</div>
</div>
</div>
@ -301,10 +281,11 @@
<h4 class="modal-title">Set AHRS Sensor Orientation: Finished</h4>
</div>
<div class="modal-body">
<p>The sensors are calibrated. These settings will be saved for future flights.</p>
<p>The sensor orientation is set. These settings will be saved for future flights.</p>
<p>Place the Stratux in its in-flight orientation and press the <strong>Done</strong> button.</p>
</div>
<div class="modal-footer">
<a ui-turn-off="modalCalibrateDone" class="btn btn-default btn-primary">OK</a>
<a ng-click="setOrientation('done')" ui-turn-off="modalCalibrateDone" class="btn btn-default btn-primary">Done</a>
</div>
</div>
</div>
@ -322,7 +303,7 @@
<div class="modal-body">
<p>There was an error: {{Orientation_Failure_Message}}</p>
<p><div id="orientationFailureMessage"></div></p>
<p>The calibration failed.</p>
<p>The calibration failed. Please try again.</p>
</div>
<div class="modal-footer">
<a ui-turn-off="modalCalibrateFailed" class="btn btn-default btn-primary">OK</a>
@ -331,25 +312,5 @@
</div>
</div>
</div>
<div class="modal" ui-if="modalCalibrateCanceled" ui-state="modalCalibrateCanceled">
<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="modalCalibrateCanceled"></button>
<h4 class="modal-title">Set AHRS Sensor Orientation: Canceled</h4>
</div>
<div class="modal-body">
<p>Calibration canceled.</p>
</div>
<div class="modal-footer">
<a ui-turn-off="modalCalibrateCanceled" class="btn btn-default btn-primary">OK</a>
</div>
</div>
</div>
</div>
</div>
</div>