pile_nav_new/lib/controllers/plumController.dart
2024-08-23 17:54:57 +08:00

61 lines
1.7 KiB
Dart

import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:roslibdart/roslibdart.dart';
class PlumDataController extends GetxController {
var isGenerate = false.obs; //是否生成
var angle = 0.0.obs; //方向弧度
var isDirect = false.obs; //是否为方向设置
var checkValue = "".obs; //checkPile -桩点坐标,checkDirection-方向设置
var checkName = "".obs;
var centerXY = Offset.zero.obs; //中心点
var space = 5.0.obs; //间距 m
var pileWidth = 400.0.obs; //打桩宽度 m
var genLenth = 0.obs; //半径
var isPileId = false.obs;
var direction = 0.0.obs; //角度
var isSave = false.obs; //是否保存
var centerOffset = Offset.zero.obs;
var linePointOffset = Offset.zero.obs;
var linePointXY = Offset.zero.obs;
var isUp = false.obs;
var plumList = [Offset.zero];
// var shouldPaint = true.obs;
var isMap = false.obs;
late Service service;
late Ros ros;
var canvasSize = Size.zero;
@override
void onInit() async {
super.onInit();
// plumList.value = [];
// centerXY.value = const Offset(3790620.0588630675, 577014.4059290753);
// for (int i = -2; i <= 2; i++) {
// for (int j = -2; j <= 2; j++) {
// plumList.add(Offset(centerXY.value.dx + i, centerXY.value.dy + j));
// }
// }
// ros = BaseService().getRos();
// ros.connect();
// service = Service(
// name: '/smash_point_list_service',
// ros: ros,
// type: "nav2_smash_behavior/srv/SmashPointList");
// var json = {'data': []};
// service.call(json).then((value) {
// print('ros$value');
// });
}
updateLinePoint(Offset offset) {
linePointOffset.value = offset;
update();
}
}