Browse Source

debug

master
maochaoying 2 years ago
parent
commit
983194b70f
  1. 14
      .env
  2. 4
      src/command/index.js
  3. 35
      src/components/Debug.vue
  4. 2
      src/components/Nuclear.vue
  5. 6
      src/components/Task.vue

14
.env

@ -5,8 +5,14 @@
# VITE_HOST_URL=http://192.168.1.194:8081/ # VITE_HOST_URL=http://192.168.1.194:8081/
VITE_BASE_URL=http://127.0.0.1:8899
VITE_WEBSOCKET_JAVA_URL=ws://127.0.0.1:8899/websocket/nuclear
# VITE_BASE_URL=http://127.0.0.1:8899
# VITE_WEBSOCKET_JAVA_URL=ws://127.0.0.1:8899/websocket/nuclear
# # VITE_WEBSOCKET_CAMERA_URL=ws://127.0.0.1:8899/websocket/nuclear
# VITE_WEBSOCKET_CAMERA_URL=ws://127.0.0.1:8081/ws/cmd
# VITE_HOST_URL=http://127.0.0.1:8081/
VITE_BASE_URL=http://192.168.1.111:8899
VITE_WEBSOCKET_JAVA_URL=ws://192.168.1.111:8899/websocket/nuclear
# VITE_WEBSOCKET_CAMERA_URL=ws://127.0.0.1:8899/websocket/nuclear # VITE_WEBSOCKET_CAMERA_URL=ws://127.0.0.1:8899/websocket/nuclear
VITE_WEBSOCKET_CAMERA_URL=ws://127.0.0.1:8081/ws/cmd
VITE_HOST_URL=http://127.0.0.1:8081/
VITE_WEBSOCKET_CAMERA_URL=ws://192.168.1.111:8081/ws/cmd
VITE_HOST_URL=http://192.168.1.111:8081/

4
src/command/index.js

@ -49,7 +49,7 @@ export const takePhoto = transformToString({
export const takeAndSavePhoto = transformToString({ export const takeAndSavePhoto = transformToString({
command: 'takeAndSavePhoto', command: 'takeAndSavePhoto',
filePrefix: 'nuclear/iflytop', filePrefix: 'nuclear/iflytop',
messageId: uuidv4(),
messageId: 'takeAndSavePhoto',
need_receipt: true, need_receipt: true,
}) })
@ -101,7 +101,7 @@ export const getCharacterRecognitionResultSimple = transformToString({
// 机械臂控制接口 获取机械臂 连接信息 x y 位置 // 机械臂控制接口 获取机械臂 连接信息 x y 位置
export const getMechanicalArmState = transformToString({ export const getMechanicalArmState = transformToString({
command: 'getMechanicalArmState', command: 'getMechanicalArmState',
messageId: uuidv4(),
messageId: 'getMechanicalArmState',
need_receipt: true, need_receipt: true,
}) })

35
src/components/Debug.vue

@ -48,6 +48,7 @@
v-model="simulation_brightness" v-model="simulation_brightness"
:min="0" :min="0"
:max="65535" :max="65535"
:disabled="!isCameraOpen"
@change="handleSimulationBrightness" @change="handleSimulationBrightness"
/> />
<p class="number">{{ simulation_brightness }}</p> <p class="number">{{ simulation_brightness }}</p>
@ -56,6 +57,7 @@
<p class="title">曝光时间</p> <p class="title">曝光时间</p>
<t-slider <t-slider
v-model="exposure" v-model="exposure"
:disabled="!isCameraOpen"
:min="0" :min="0"
:max="100000" :max="100000"
@change="handleExposureTime" @change="handleExposureTime"
@ -70,7 +72,7 @@
</div> </div>
</div> </div>
<div class="identify_results"> <div class="identify_results">
<p class="title">识别结果</p>
<p class="title">结果</p>
<div class="result">{{ recognitionResult }}</div> <div class="result">{{ recognitionResult }}</div>
</div> </div>
</div> </div>
@ -123,7 +125,7 @@ import {
import { MessagePlugin } from 'tdesign-vue-next' import { MessagePlugin } from 'tdesign-vue-next'
const photoUrl = ref('') const photoUrl = ref('')
const recognitionResult = ref({})
const recognitionResult = ref('')
setInterval( setInterval(
() => { () => {
@ -171,10 +173,20 @@ const handleStopCharacterRecognition = () => {
websocketsend(stopCharacterRecognition) websocketsend(stopCharacterRecognition)
} }
const handleGetCharacterRecognitionResult = () => { const handleGetCharacterRecognitionResult = () => {
websocketsend(getCharacterRecognitionResult)
if (isCameraOpen.value) {
//
websocketsend(getCharacterRecognitionResult)
} else {
MessagePlugin('error', { content: '请先开启相机' })
}
} }
const handleGetMechanicalArmState = () => { const handleGetMechanicalArmState = () => {
websocketsend(getMechanicalArmState)
if (isCameraOpen.value) {
//
websocketsend(getMechanicalArmState)
} else {
MessagePlugin('error', { content: '请先开启相机' })
}
} }
const handleOpenFlashLight = () => { const handleOpenFlashLight = () => {
@ -243,6 +255,16 @@ const websocketonmessage = e => {
const { isOpen } = cameraState const { isOpen } = cameraState
isCameraOpen.value = isOpen isCameraOpen.value = isOpen
break break
case 'getMechanicalArmState':
const { state } = data
const { x, y } = state || {}
recognitionResult.value = `机械臂坐标x:${x}, y: ${y}`
break
case 'takeAndSavePhoto':
const { photoInfo } = data
const { path } = photoInfo
recognitionResult.value = `图片保存路径为${path}`
break
case 'getCameraParametersInteger': case 'getCameraParametersInteger':
const { value } = data const { value } = data
exposure.value = value exposure.value = value
@ -259,7 +281,10 @@ const websocketonmessage = e => {
break break
case 'getCharacterRecognitionResult': case 'getCharacterRecognitionResult':
const { result } = data const { result } = data
recognitionResult.value = result
const { result: str, srcImagePath } = result || {}
recognitionResult.value = `识别结果为${
str ? str : '空结果'
}, 图片保存路径为${srcImagePath}`
break break
default: default:
break break

2
src/components/Nuclear.vue

@ -249,6 +249,8 @@ export default {
this.coreVisible = false this.coreVisible = false
this.getCoreList() this.getCoreList()
} }
} else {
this.$message.error(res?.msg)
} }
} else { } else {
this.$message.warning(firstError) this.$message.warning(firstError)

6
src/components/Task.vue

@ -491,6 +491,9 @@ export default {
}, },
updateOper(taskId) { updateOper(taskId) {
this.operTaskId = taskId this.operTaskId = taskId
if (this.role == 'ROLE_ADMIN') {
this.getAllOperator()
}
this.updateOperVisible = true this.updateOperVisible = true
}, },
operClose() { operClose() {
@ -607,9 +610,6 @@ export default {
}, },
mounted() { mounted() {
this.getTaskList() this.getTaskList()
if (this.role == 'USER_ADMIN') {
this.getAllOperator()
}
}, },
} }
</script> </script>

Loading…
Cancel
Save