解决了一下 机器转向的问题
This commit is contained in:
2
env.js
2
env.js
@@ -18,7 +18,7 @@ const envConfig = {
|
||||
baseURL: 'http://1.95.137.212:8081',//http://192.168.2.56:8081
|
||||
//baseURL: 'https://serviceri.satabot.com',
|
||||
WS_URL: 'ws://1.95.137.212:9002/ws/',
|
||||
mqtt_url: "ws://1.95.137.212:59021/mqtt",
|
||||
mqtt_url: "ws://1.95.137.212:8083/mqtt",
|
||||
geoserver_url: "http://1.95.137.212:59018/geoserver"
|
||||
|
||||
//baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
|
||||
|
||||
BIN
src/assets/images/mowericon.png
Normal file
BIN
src/assets/images/mowericon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/assets/images/planeicon.png
Normal file
BIN
src/assets/images/planeicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 919 B |
@@ -1,7 +1,7 @@
|
||||
import React, { useEffect, useRef, useState, useMemo, useImperativeHandle, forwardRef, useCallback } from 'react';
|
||||
import carImg from '../assets/images/car.png';
|
||||
import carImg from '../assets/images/carplane.png';
|
||||
import inspectImg from "../assets/images/inspectCar.png"
|
||||
import planeImg from '../assets/images/plane.png';
|
||||
import planeImg from '../assets/images/planeicon.png';
|
||||
import cameraImg from '../assets/images/camera.png';
|
||||
import droneInspectImg from '../assets/images/xunjiancar.png';
|
||||
import gecocar from '../assets/images/gecaocar.png';
|
||||
@@ -65,6 +65,8 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
const realtimeCarEntityRef = useRef(null);
|
||||
const realtimeLastPointRef = useRef(null);
|
||||
const realtimeHiddenRef = useRef(false);
|
||||
const focusEntityRef = useRef(null);
|
||||
|
||||
|
||||
const yellowCircleCanvas = useMemo(
|
||||
() => createYellowCircleCanvas(30),
|
||||
@@ -290,6 +292,7 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
|
||||
};
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (viewerRef.current) {
|
||||
drawTrackLine(points);
|
||||
@@ -722,8 +725,8 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
position,
|
||||
billboard: {
|
||||
image: carImg,
|
||||
width: 60,
|
||||
height: 60,
|
||||
width: 30,
|
||||
height: 30,
|
||||
verticalOrigin: window.Cesium.VerticalOrigin.BOTTOM,
|
||||
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
||||
},
|
||||
@@ -784,7 +787,6 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
};
|
||||
}, []);
|
||||
|
||||
const focusEntityRef = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
// 如果有 realtimePosition,不显示 focusEntity
|
||||
@@ -824,8 +826,8 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
position: Cesium.Cartesian3.fromDegrees(Number(focusLocation.lon), Number(focusLocation.lat), 0),
|
||||
billboard: {
|
||||
image: image,
|
||||
width: 60,
|
||||
height: 60,
|
||||
width: 30,
|
||||
height: 30,
|
||||
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
||||
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
||||
},
|
||||
@@ -963,8 +965,8 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
orientation: orientation,
|
||||
billboard: {
|
||||
image: carImg,
|
||||
width: 50,
|
||||
height: 50,
|
||||
width: 30,
|
||||
height: 30,
|
||||
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
||||
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
||||
color: Cesium.Color.YELLOW.withAlpha(0.8),
|
||||
@@ -1153,9 +1155,9 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
// ==============================
|
||||
|
||||
let image = carImg;
|
||||
let width = 60;
|
||||
let height = 60;
|
||||
const carsize = device?.productId == 138 ? 40 : 60;
|
||||
let width = 30;
|
||||
let height = 30;
|
||||
const carsize = device?.productId == 138 ? 30 : 30;
|
||||
|
||||
|
||||
|
||||
@@ -1180,14 +1182,14 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
device?.type === "plane" ||
|
||||
device?.type === "drone" ||
|
||||
device?.type === "drone-inspect"
|
||||
? 70
|
||||
? 30
|
||||
: carsize;
|
||||
|
||||
height =
|
||||
device?.type === "plane" ||
|
||||
device?.type === "drone" ||
|
||||
device?.type === "drone-inspect"
|
||||
? 70
|
||||
? 30
|
||||
: carsize;
|
||||
|
||||
}
|
||||
@@ -1554,9 +1556,9 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
const dx = last.lon - lon;
|
||||
const dy = last.lat - lat;
|
||||
const dist = Math.sqrt(dx * dx + dy * dy);
|
||||
if (dist < 0.0000001) {
|
||||
shouldAdd = false;
|
||||
}
|
||||
//if (dist < 0.0000001) {
|
||||
// shouldAdd = false;
|
||||
//}
|
||||
}
|
||||
|
||||
if (shouldAdd && drawRealTime) {
|
||||
@@ -1585,14 +1587,18 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
|
||||
// 无人机图标
|
||||
const img = realtimeType === 'plane' || realtimeType === 'drone' ? planeImg : carImg;
|
||||
const imgWidth = 70;
|
||||
const imgHeight = 70;
|
||||
const imgWidth = 30;
|
||||
const imgHeight = 30;
|
||||
|
||||
// 如果有航向角,设置旋转
|
||||
let rotation = 0;
|
||||
|
||||
if (realtimePosition?.heading !== undefined && !isNaN(Number(realtimePosition.heading))) {
|
||||
let headingDeg = Number(realtimePosition.heading);
|
||||
rotation = Cesium.Math.toRadians(headingDeg);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//rotation = Cesium.Math.toRadians(-3.17);
|
||||
@@ -1707,16 +1713,17 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
|
||||
// 机器人图标
|
||||
const img = carImg;
|
||||
const imgWidth = 60;
|
||||
const imgHeight = 60;
|
||||
const imgWidth = 30;
|
||||
const imgHeight = 30;
|
||||
|
||||
// 如果有航向角,设置旋转
|
||||
let rotation = 0;
|
||||
|
||||
if (realtimePosition?.heading !== undefined && !isNaN(Number(realtimePosition.heading))) {
|
||||
let headingDeg = Number(realtimePosition.heading);
|
||||
|
||||
rotation = Cesium.Math.toRadians(headingDeg);
|
||||
}
|
||||
|
||||
if (!realtimeCarEntityRef.current) {
|
||||
realtimeCarEntityRef.current = viewer.entities.add({
|
||||
position: position,
|
||||
|
||||
@@ -438,6 +438,7 @@ export default function ErrorManagement() {
|
||||
];
|
||||
|
||||
return (
|
||||
|
||||
<div style={{ padding: '8px 0px', paddingTop: 8, background: '#f5f7fa', minHeight: 'calc(100vh - 120px)' }}>
|
||||
|
||||
<AntdCard title="错误管理" style={{ borderRadius: 8 }}>
|
||||
@@ -506,7 +507,7 @@ export default function ErrorManagement() {
|
||||
columns={columns}
|
||||
dataSource={errorList}
|
||||
loading={loading}
|
||||
scroll={{ x: 1400, y: 'calc(100vh - 380px)' }}
|
||||
scroll={{ x: 1400, y: 1200 }}
|
||||
pagination={{
|
||||
current: params.pageNum,
|
||||
pageSize: params.pageSize,
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
} from '@ant-design/icons';
|
||||
|
||||
|
||||
|
||||
import DroneLivePlayer from '../VolcRtcPlayer.jsx';
|
||||
import DroneVideoPlayer from './DroneVideoPlayer';
|
||||
import AgoraTextTest from '../AgoraRtc.tsx';
|
||||
@@ -642,7 +643,7 @@ export default function DeviceOverviewPage({ onViewStatus, selectedSn, onDeviceS
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 80,
|
||||
fixed: 'right',
|
||||
//fixed: 'right',
|
||||
render: (_, record) => (
|
||||
<Space size={4}>
|
||||
{/* 编辑按钮绑定弹窗 */}
|
||||
@@ -655,7 +656,7 @@ export default function DeviceOverviewPage({ onViewStatus, selectedSn, onDeviceS
|
||||
<Button size="small" type="text" icon={<SettingOutlined />} />
|
||||
</Space>
|
||||
)
|
||||
},]}
|
||||
}]}
|
||||
dataSource={dynamicScheduleList}
|
||||
scroll={{ x: 'max-content', y: 280 }}
|
||||
/>
|
||||
@@ -676,6 +677,7 @@ export default function DeviceOverviewPage({ onViewStatus, selectedSn, onDeviceS
|
||||
</Col>
|
||||
|
||||
<Col xs={24} lg={10}>
|
||||
|
||||
<Card title={<><SettingOutlined style={{ marginRight: 6, }} /> 设备控制面板</>} bordered={false} style={{ borderRadius: 8, marginBottom: 8 }} bodyStyle={{ padding: 12, paddingBottom: 0 }}>
|
||||
<Select
|
||||
style={{ width: "80%", marginBottom: 8 }}
|
||||
|
||||
@@ -76,6 +76,43 @@ export default function DeviceStatusPage({
|
||||
const [devicesAll, setDevicesAll] = useState([]);
|
||||
const [arrivedPoint, setArrivedPoint] = useState(null);//完成点
|
||||
const [isLoopMode, setIsLoopMode] = useState(true);
|
||||
const controllerRef = useRef<DeviceController | null>(null);
|
||||
const [messageApi, contextHolder] = message.useMessage();
|
||||
|
||||
|
||||
const [isControlled, setIsControlled] = useState(false);
|
||||
const [hasControlRight, setHasControlRight] = useState(false);
|
||||
const [connecting, setConnecting] = useState(false);
|
||||
const [wsStatus, setWsStatus] = useState('disconnected');
|
||||
const [wsDeviceInfo, setWsDeviceInfo] = useState({});
|
||||
|
||||
|
||||
// 👇 加上这两个
|
||||
const [queryTimeRange, setQueryTimeRange] = useState([]); // 时间范围
|
||||
const [startTimestamp, setStartTimestamp] = useState(''); // 开始时间戳
|
||||
const [endTimestamp, setEndTimestamp] = useState(''); // 结束时间戳
|
||||
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
const [modalContent, setModalContent] = useState({
|
||||
title: '',
|
||||
content: '',
|
||||
});
|
||||
|
||||
const [mowerView, setMowerView] = useState('front');
|
||||
const [uavState, setUavState] = useState<any>(null);
|
||||
const [points, setPoints] = useState([]);
|
||||
const [clearNavLine, setClearNavLine] = useState(0);
|
||||
const [clearPlanLine, setClearPlanLine] = useState(0);
|
||||
const timerRef = useRef<any>(null);
|
||||
// 打点相关状态
|
||||
const [markedPoints, setMarkedPoints] = useState([]); // 标记的点
|
||||
const [completeFlag, setCompleteFlag] = useState(false); // 是否完成路径规划
|
||||
const [savePath, setSavePath] = useState(null); // 保存的路径数据
|
||||
const [isSaveModalVisible, setIsSaveModalVisible] = useState(false); // 保存模态框可见性
|
||||
const [plotName, setPlotName] = useState(''); // 地块名称
|
||||
const [isSaving, setIsSaving] = useState(false); // 是否正在保存
|
||||
const mapRef = useRef(null); // 地图 ref
|
||||
|
||||
|
||||
// 开关切换回调
|
||||
const handleChange = (checked: boolean) => {
|
||||
@@ -297,43 +334,7 @@ export default function DeviceStatusPage({
|
||||
// 实时位置数据(用于地图)
|
||||
|
||||
|
||||
const [messageApi, contextHolder] = message.useMessage();
|
||||
|
||||
const controllerRef = useRef<DeviceController | null>(null);
|
||||
|
||||
const [isControlled, setIsControlled] = useState(false);
|
||||
const [hasControlRight, setHasControlRight] = useState(false);
|
||||
const [connecting, setConnecting] = useState(false);
|
||||
const [wsStatus, setWsStatus] = useState('disconnected');
|
||||
const [wsDeviceInfo, setWsDeviceInfo] = useState({});
|
||||
const [selectedDrone, setSelectedDrone] = useState(null);
|
||||
const [taskList, setTaskList] = useState([]);
|
||||
|
||||
// 👇 加上这两个
|
||||
const [queryTimeRange, setQueryTimeRange] = useState([]); // 时间范围
|
||||
const [startTimestamp, setStartTimestamp] = useState(''); // 开始时间戳
|
||||
const [endTimestamp, setEndTimestamp] = useState(''); // 结束时间戳
|
||||
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
const [modalContent, setModalContent] = useState({
|
||||
title: '',
|
||||
content: '',
|
||||
});
|
||||
|
||||
const [mowerView, setMowerView] = useState('front');
|
||||
const [uavState, setUavState] = useState<any>(null);
|
||||
const [points, setPoints] = useState([]);
|
||||
const [clearNavLine, setClearNavLine] = useState(0);
|
||||
const [clearPlanLine, setClearPlanLine] = useState(0);
|
||||
const timerRef = useRef<any>(null);
|
||||
// 打点相关状态
|
||||
const [markedPoints, setMarkedPoints] = useState([]); // 标记的点
|
||||
const [completeFlag, setCompleteFlag] = useState(false); // 是否完成路径规划
|
||||
const [savePath, setSavePath] = useState(null); // 保存的路径数据
|
||||
const [isSaveModalVisible, setIsSaveModalVisible] = useState(false); // 保存模态框可见性
|
||||
const [plotName, setPlotName] = useState(''); // 地块名称
|
||||
const [isSaving, setIsSaving] = useState(false); // 是否正在保存
|
||||
const mapRef = useRef(null); // 地图 ref
|
||||
|
||||
const runningStatus = useMemo(() => {
|
||||
// 判断对象是否为空
|
||||
@@ -382,7 +383,8 @@ export default function DeviceStatusPage({
|
||||
return {
|
||||
lon: robotLon,
|
||||
lat: robotLat,
|
||||
heading: runningStatus.pitch || wsDeviceInfo.pitch || 0,
|
||||
//heading: 0
|
||||
heading: runningStatus.yaw || wsDeviceInfo.yaw || 0,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -420,7 +422,11 @@ export default function DeviceStatusPage({
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!device || !controllerRef.current || !device?.serialNumber || isUAV) return;
|
||||
if (!device || !controllerRef.current || !device?.serialNumber || isUAV) {
|
||||
//controllerRef.current?.destroy();
|
||||
//setWsDeviceInfo({});
|
||||
return;
|
||||
}
|
||||
setWsDeviceInfo({});
|
||||
|
||||
controllerRef.current.connectDevice(device);
|
||||
|
||||
@@ -142,6 +142,12 @@ h4, .ant-typography h4 { font-size: clamp(1rem, 1.5vw, 1.25rem) !important; }
|
||||
}
|
||||
|
||||
|
||||
.ant-table-body {
|
||||
overflow: auto !important; /* 超出高度时显示滚动条 */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@keyframes sunRotate {
|
||||
from { transform: rotate(0deg); }
|
||||
@@ -155,3 +161,4 @@ h4, .ant-typography h4 { font-size: clamp(1rem, 1.5vw, 1.25rem) !important; }
|
||||
0% { transform: translateY(0); opacity: 1; }
|
||||
100% { transform: translateY(12px); opacity: 0.4; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user