Debug 页面新增 MJPEG 视频流展示,修复全页面画面纵向裁切问题
- Debug 页面底部增加 /vision/debug_image 的 MJPEG 视频流 - 三个页面的流画面统一使用 max-height: 70vh + object-fit: contain,避免纵向显示不全
This commit is contained in:
@@ -5,6 +5,7 @@ export const ROSBRIDGE_URL = 'ws://192.168.0.11:9090'
|
||||
|
||||
export const MJPEG_AUTO_URL = 'http://192.168.0.11/stream?topic=/vision/result_image&mode=auto'
|
||||
export const MJPEG_MANUAL_URL = 'http://192.168.0.11/stream?topic=/vision/result_image&mode=manual'
|
||||
export const MJPEG_DEBUG_URL = 'http://192.168.0.11/stream?topic=/vision/debug_image&mode=debug'
|
||||
|
||||
// ROS 话题
|
||||
export const CMD_WHEEL_TOPIC = '/cmd_wheel'
|
||||
|
||||
@@ -56,5 +56,5 @@ async function switchToAuto() {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.stream { max-width: 100%; height: auto; }
|
||||
.stream { max-width: 100%; max-height: 70vh; object-fit: contain; }
|
||||
</style>
|
||||
|
||||
+23
-1
@@ -51,14 +51,27 @@
|
||||
{{ saving ? '保存中...' : '保存配置' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="stream-container">
|
||||
<img ref="streamImg" :src="streamUrl" alt="MJPEG Stream" class="stream" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, onMounted } from 'vue'
|
||||
import { HTTP_API_BASE, ROSBRIDGE_URL } from '../config.js'
|
||||
import { onBeforeRouteLeave } from 'vue-router'
|
||||
import { HTTP_API_BASE, ROSBRIDGE_URL, MJPEG_DEBUG_URL } from '../config.js'
|
||||
import { useRosbridge } from '../composables/useRosbridge.js'
|
||||
|
||||
const streamUrl = MJPEG_DEBUG_URL
|
||||
const streamImg = ref(null)
|
||||
|
||||
onBeforeRouteLeave((_to, _from, next) => {
|
||||
if (streamImg.value) streamImg.value.src = ''
|
||||
next()
|
||||
})
|
||||
|
||||
const { connected, connect } = useRosbridge()
|
||||
connect(ROSBRIDGE_URL)
|
||||
|
||||
@@ -165,6 +178,15 @@ async function toggleLaser() {
|
||||
.debug-mode { display: flex; flex-direction: column; gap: 20px; }
|
||||
.header h2 { font-size: 18px; font-weight: 500; }
|
||||
|
||||
.stream-container {
|
||||
background: #000;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.stream { max-width: 100%; max-height: 70vh; object-fit: contain; }
|
||||
|
||||
.mode-buttons { display: flex; gap: 10px; }
|
||||
.btn-mode {
|
||||
padding: 8px 20px;
|
||||
|
||||
@@ -164,7 +164,7 @@ onUnmounted(() => {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.stream { max-width: 100%; height: auto; }
|
||||
.stream { max-width: 100%; max-height: 70vh; object-fit: contain; }
|
||||
|
||||
.hint {
|
||||
text-align: center; font-size: 13px; color: #666;
|
||||
|
||||
Reference in New Issue
Block a user