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