Debug 页面新增 MJPEG 视频流展示,修复全页面画面纵向裁切问题

- Debug 页面底部增加 /vision/debug_image 的 MJPEG 视频流
- 三个页面的流画面统一使用 max-height: 70vh + object-fit: contain,避免纵向显示不全
This commit is contained in:
2026-06-04 20:16:06 +08:00
parent 2f2e444978
commit a2934822a3
4 changed files with 26 additions and 3 deletions
+1
View File
@@ -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_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_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 话题 // ROS 话题
export const CMD_WHEEL_TOPIC = '/cmd_wheel' export const CMD_WHEEL_TOPIC = '/cmd_wheel'
+1 -1
View File
@@ -56,5 +56,5 @@ async function switchToAuto() {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.stream { max-width: 100%; height: auto; } .stream { max-width: 100%; max-height: 70vh; object-fit: contain; }
</style> </style>
+23 -1
View File
@@ -51,14 +51,27 @@
{{ saving ? '保存中...' : '保存配置' }} {{ saving ? '保存中...' : '保存配置' }}
</button> </button>
</div> </div>
<div class="stream-container">
<img ref="streamImg" :src="streamUrl" alt="MJPEG Stream" class="stream" />
</div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { reactive, ref, onMounted } from 'vue' 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' 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() const { connected, connect } = useRosbridge()
connect(ROSBRIDGE_URL) connect(ROSBRIDGE_URL)
@@ -165,6 +178,15 @@ async function toggleLaser() {
.debug-mode { display: flex; flex-direction: column; gap: 20px; } .debug-mode { display: flex; flex-direction: column; gap: 20px; }
.header h2 { font-size: 18px; font-weight: 500; } .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; } .mode-buttons { display: flex; gap: 10px; }
.btn-mode { .btn-mode {
padding: 8px 20px; padding: 8px 20px;
+1 -1
View File
@@ -164,7 +164,7 @@ onUnmounted(() => {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.stream { max-width: 100%; height: auto; } .stream { max-width: 100%; max-height: 70vh; object-fit: contain; }
.hint { .hint {
text-align: center; font-size: 13px; color: #666; text-align: center; font-size: 13px; color: #666;