updated GPS bin with INS

This commit is contained in:
Djeeberjr 2023-04-13 22:26:37 +02:00
parent b9452cd598
commit 655439461a

View File

@ -1,5 +1,6 @@
package bin; package bin;
import kernel.gps.INS;
import lib.Pos3; import lib.Pos3;
import lib.Vec.Vec3; import lib.Vec.Vec3;
import lib.cli.TermHandle; import lib.cli.TermHandle;
@ -26,8 +27,11 @@ class GPS extends CLIApp {
case "locate": case "locate":
kernel.gps.GPS.instance.locate(); kernel.gps.GPS.instance.locate();
return Future.sync(true); return Future.sync(true);
case "ins":
return INS.instance.align().isSuccess();
default: default:
handle.writeLn("Unknown subcommand: " + subcommand); handle.writeLn("Unknown subcommand: " + subcommand);
printHelp();
return Future.sync(false); return Future.sync(false);
} }
@ -35,6 +39,14 @@ class GPS extends CLIApp {
return Future.sync(true); return Future.sync(true);
} }
private function printHelp(){
handle.writeLn("GPS commands:");
handle.writeLn("set <x> <y> <z> - set manual position");
handle.writeLn("status - get current position and accuracy");
handle.writeLn("locate - get current position");
handle.writeLn("ins - align INS");
}
private function setManuelPos(args: Array<String>): Bool { private function setManuelPos(args: Array<String>): Bool {
var x: Float = Std.parseFloat(args[0]); var x: Float = Std.parseFloat(args[0]);
var y: Float = Std.parseFloat(args[1]); var y: Float = Std.parseFloat(args[1]);
@ -66,6 +78,13 @@ class GPS extends CLIApp {
handle.writeLn("Accuracy: High"); handle.writeLn("Accuracy: High");
} }
var ins = INS.instance.getHeading();
if (ins != null) {
handle.writeLn('INS heading: ${ins.x} y:${ins.y} z:${ins.z}');
} else {
handle.writeLn("INS heading not available");
}
return true; return true;
} }
} }