机器航向角和 机器人设备状态视频 完善拖动
This commit is contained in:
20
env.js
20
env.js
@@ -9,11 +9,11 @@ const currentEnv = import.meta.env?.MODE || process.env.NODE_ENV;
|
||||
// 环境配置映射
|
||||
const envConfig = {
|
||||
[ENV.DEV]: {
|
||||
baseURL: 'http://192.168.2.59:8081',//http://192.168.2.56:8081
|
||||
//baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
|
||||
WS_URL: 'ws://192.168.2.59:9002/ws/',
|
||||
mqtt_url: "ws://1.95.137.212:8083/mqtt",
|
||||
geoserver_url: "http://192.168.2.59:7000/geoserver"
|
||||
//baseURL: 'http://192.168.2.59:8081',//http://192.168.2.56:8081
|
||||
////baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
|
||||
//WS_URL: 'ws://192.168.2.59:9002/ws/',
|
||||
//mqtt_url: "ws://1.95.137.212:8083/mqtt",
|
||||
//geoserver_url: "http://192.168.2.59:7000/geoserver"
|
||||
|
||||
//baseURL: 'http://1.95.137.212:8081',//http://192.168.2.56:8081
|
||||
////baseURL: 'https://serviceri.satabot.com',
|
||||
@@ -21,11 +21,11 @@ const envConfig = {
|
||||
//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
|
||||
////baseURL: 'https://serviceri.satabot.com',
|
||||
//WS_URL: 'ws://1.95.137.212:59017/ws/',
|
||||
//mqtt_url: "ws://1.95.137.212:59021/mqtt",
|
||||
//geoserver_url: "http://1.95.137.212:59018/geoserver"
|
||||
baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
|
||||
//baseURL: 'https://serviceri.satabot.com',
|
||||
WS_URL: 'ws://1.95.137.212:59017/ws/',
|
||||
mqtt_url: "ws://1.95.137.212:59021/mqtt",
|
||||
geoserver_url: "http://1.95.137.212:59018/geoserver"
|
||||
},
|
||||
[ENV.PROD]: {
|
||||
//baseURL: 'https://pvcloudservice.satabot.com',
|
||||
|
||||
@@ -1592,6 +1592,8 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
|
||||
// 如果有航向角,设置旋转
|
||||
let rotation = 0;
|
||||
console.log('realtimePosition.heading:', realtimePosition.heading);
|
||||
|
||||
|
||||
if (realtimePosition?.heading !== undefined && !isNaN(Number(realtimePosition.heading))) {
|
||||
let headingDeg = Number(realtimePosition.heading);
|
||||
|
||||
@@ -383,7 +383,7 @@ export default function DeviceStatusPage({
|
||||
return {
|
||||
lon: robotLon,
|
||||
lat: robotLat,
|
||||
//heading: 0
|
||||
//heading: -98
|
||||
heading: runningStatus.yaw || wsDeviceInfo.yaw || 0,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -67,30 +67,35 @@ export function MowerAllView({ serialNumber, robotVideo, error, ready, statusDat
|
||||
const [panelSize, setPanelSize] = useState(null);
|
||||
const [initialPositions, setInitialPositions] = useState(null);
|
||||
const [containerBounds, setContainerBounds] = useState(null);
|
||||
const [initialized, setInitialized] = useState(false);
|
||||
|
||||
// 初始化尺寸和位置
|
||||
// 初始化尺寸、窗口缩放重新计算面板尺寸
|
||||
useEffect(() => {
|
||||
if (!containerRef.current || initialized) return;
|
||||
const calcSize = () => {
|
||||
if (!containerRef.current) return;
|
||||
const rect = containerRef.current.getBoundingClientRect();
|
||||
if (rect.width === 0 || rect.height === 0) return;
|
||||
|
||||
const rect = containerRef.current.getBoundingClientRect();
|
||||
const w = rect.width * 0.30;
|
||||
const h = Math.floor(rect.height * 0.35);
|
||||
|
||||
// 统一三个面板的尺寸
|
||||
const w = Math.max(200, Math.floor(rect.width * 0.25));
|
||||
const h = Math.max(150, Math.floor(rect.height * 0.3));
|
||||
setPanelSize({ width: w, height: h });
|
||||
setContainerBounds({ width: rect.width, height: rect.height });
|
||||
setInitialPositions({
|
||||
left: { x: 8, y: 8 },
|
||||
right: { x: rect.width - w - 8, y: 8 },
|
||||
back: { x: (rect.width - w) / 2, y: rect.height - h - 8 }
|
||||
});
|
||||
};
|
||||
|
||||
setPanelSize({ width: w, height: h });
|
||||
setContainerBounds({ width: rect.width, height: rect.height });
|
||||
calcSize();
|
||||
const timer = setTimeout(calcSize, 100);
|
||||
window.addEventListener('resize', calcSize);
|
||||
|
||||
// 设置初始位置
|
||||
setInitialPositions({
|
||||
left: { x: 8, y: 8 },
|
||||
right: { x: rect.width - w - 8, y: 8 },
|
||||
back: { x: (rect.width - w) / 2, y: rect.height - h - 8 }
|
||||
});
|
||||
|
||||
setInitialized(true);
|
||||
}, [initialized]);
|
||||
return () => {
|
||||
clearTimeout(timer);
|
||||
window.removeEventListener('resize', calcSize);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -112,13 +117,11 @@ export function MowerAllView({ serialNumber, robotVideo, error, ready, statusDat
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
{/* 三个可拖拽子面板 */}
|
||||
{initialized && panelSize && initialPositions && containerBounds && (
|
||||
{panelSize && initialPositions && containerBounds && (
|
||||
<>
|
||||
{/* 左视 */}
|
||||
<VideoSubPanel
|
||||
idx={3}
|
||||
label="左视"
|
||||
@@ -132,8 +135,6 @@ export function MowerAllView({ serialNumber, robotVideo, error, ready, statusDat
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
|
||||
{/* 右视 */}
|
||||
<VideoSubPanel
|
||||
idx={4}
|
||||
label="右视"
|
||||
@@ -147,8 +148,6 @@ export function MowerAllView({ serialNumber, robotVideo, error, ready, statusDat
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
|
||||
{/* 后视 */}
|
||||
<VideoSubPanel
|
||||
idx={2}
|
||||
label="后视"
|
||||
|
||||
Reference in New Issue
Block a user