添加设备

This commit is contained in:
tanlinxing 2024-08-26 18:58:33 +08:00
parent 7eec50c877
commit 8ef7427b0d
4 changed files with 24 additions and 7 deletions

View File

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"libserialport","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\git\\\\libserialport-d6d27ef7aaf89e4dfa026db0c50dd3053c546710\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.10\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"libserialport","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\git\\\\libserialport-d6d27ef7aaf89e4dfa026db0c50dd3053c546710\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_linux","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"libserialport","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\git\\\\libserialport-d6d27ef7aaf89e4dfa026db0c50dd3053c546710\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"libserialport","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2024-08-26 18:23:25.517122","version":"3.24.0","swift_package_manager_enabled":false} {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"libserialport","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\git\\\\libserialport-d6d27ef7aaf89e4dfa026db0c50dd3053c546710\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.10\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"libserialport","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\git\\\\libserialport-d6d27ef7aaf89e4dfa026db0c50dd3053c546710\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_linux","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"libserialport","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\git\\\\libserialport-d6d27ef7aaf89e4dfa026db0c50dd3053c546710\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"libserialport","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2024-08-26 18:57:11.469847","version":"3.24.0","swift_package_manager_enabled":false}

View File

@ -2,15 +2,16 @@ import 'dart:async';
import 'dart:math'; import 'dart:math';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:gnss/gnss.dart'; import 'package:gnss/gnss.dart';
import 'package:scence_map/controllers/controller.dart';
import '../models/pilePoint/coord_trans.dart'; import '../models/pilePoint/coord_trans.dart';
class GnssController extends GetxController { class GnssController extends GetxController {
late final Gnss gnss; late final Gnss gnss;
late ScenceMapController mapController;
LocationData? locationData; LocationData? locationData;
late Pos3D pilerCenter; late Pos3D pilerCenter;
late DeviceItem device;
var locationUpdate = 0.obs; var locationUpdate = 0.obs;
// late final PilerPointCalculate pilerCenterPoint; // late final PilerPointCalculate pilerCenterPoint;
// //
@ -23,7 +24,17 @@ class GnssController extends GetxController {
@override @override
void onInit() async { void onInit() async {
super.onInit(); super.onInit();
mapController = Get.find<ScenceMapController>();
device = DeviceItem(
name: 'GNSS',
TID: 1001,
type: 2,
height: 3.0,
width: 3.0,
lat: 4196584.0,
lon: 517728,
image: ['assets/images/pilerCar.png']);
mapController.addDevice(device);
// pilerCenterPoint = PilerPointCalculate( // pilerCenterPoint = PilerPointCalculate(
// maindrilldistance.value, // maindrilldistance.value,
// auxdrilldistance.value, // auxdrilldistance.value,
@ -34,9 +45,10 @@ class GnssController extends GetxController {
pilerCenter = Pos3D(4196584.0, 517728, 0.0); pilerCenter = Pos3D(4196584.0, 517728, 0.0);
// //
timer = Timer.periodic(Duration(seconds: 1), (Timer timer) { timer = Timer.periodic(Duration(seconds: 1), (Timer timer) {
pilerCenter.X += 0.2; device.x += 0.2;
pilerCenter.Y += 0.2; device.y += 0.2;
pilerCenter.rotation = pilerCenter.rotation + pi / 180; // 0-360 device.rotation = device.rotation + pi / 180; // 0-360
device.update.value++;
}); });
gnss = Gnss(port: "/dev/ttysWK2", baudrate: 115200); gnss = Gnss(port: "/dev/ttysWK2", baudrate: 115200);

View File

@ -1,6 +1,8 @@
import 'package:cpnav/controllers/gnss_Controller.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:scence_map/controllers/controller.dart';
import 'package:scence_map/controllers/plumController.dart'; import 'package:scence_map/controllers/plumController.dart';
import 'appbar.dart'; import 'appbar.dart';
@ -11,7 +13,9 @@ import 'pages/pile/rightDra/pileGenerate.dart';
void main() { void main() {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); // SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); //
Get.put(ScenceMapController());
Get.put(PlumDataController()); Get.put(PlumDataController());
Get.put(GnssController());
runApp(const MyApp()); runApp(const MyApp());
} }

View File

@ -75,6 +75,7 @@ flutter:
assets: assets:
- images/navi_pointer.png - images/navi_pointer.png
- images/satellite.png - images/satellite.png
- images/pilerCar.png
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware # https://flutter.dev/assets-and-images/#resolution-aware