feat: agv移动
This commit is contained in:
parent
341c688991
commit
84420e510c
@ -7,8 +7,8 @@ VITE_APP_ENV = 'development'
|
||||
# 招商车研物联网平台/开发环境
|
||||
VITE_APP_BASE_API = '/dev-api'
|
||||
|
||||
VITE_API_URL = http://192.168.1.222:13080
|
||||
VITE_WS_URL = ws://192.168.1.222:13080/ws
|
||||
VITE_API_URL = http://192.168.0.222:13080
|
||||
VITE_WS_URL = ws://192.168.0.222:13080/ws
|
||||
|
||||
# explanation
|
||||
VITE_INSPECTION_TYPE = "inspection"
|
||||
|
||||
@ -55,3 +55,53 @@ export function getMapJson(params) {
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机器人位置
|
||||
* @param {*} robotId
|
||||
* @returns
|
||||
*/
|
||||
export function getRobotLocation(robotId) {
|
||||
return request({
|
||||
url: `/inspection/robot/${robotId}/location`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机器人状态
|
||||
* @param {*} robotId
|
||||
* @returns
|
||||
*/
|
||||
export function getRobotStatus(robotId) {
|
||||
return request({
|
||||
url: `/inspection/robot/{robotId}/sync-status`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 机器人运动控制
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
export function moveRobot(data) {
|
||||
return request({
|
||||
url: '/api/agv/setVelocity',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 机器人停止运动
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
export function stopRobot(data) {
|
||||
return request({
|
||||
url: '/api/agv/stopVelocityControl',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@ -62,6 +62,14 @@
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
import { moveRobot, stopRobot } from '@/api/inspection/robot.js'
|
||||
|
||||
const props = defineProps({
|
||||
robot: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
const maxSpeed = ref(0.6)
|
||||
const rotationAngle = ref(0)
|
||||
@ -79,8 +87,7 @@ function formatVal(p) {
|
||||
const moveRobotData = ref({
|
||||
vx: 0,
|
||||
vy: 0,
|
||||
w: 0,
|
||||
duration: -1
|
||||
vz: 0
|
||||
})
|
||||
|
||||
/* long-press stubs */
|
||||
@ -94,21 +101,21 @@ const onPress = async (_dir) => {
|
||||
} else {
|
||||
moveRobotData.value.vy = -maxSpeed.value
|
||||
}
|
||||
moveRobotData.value.w = rotationAngle.value
|
||||
// const res = await moveRobot({
|
||||
// ip: robotStore.ip,
|
||||
// deviceId: VITE_DEVICE_ID,
|
||||
// ...moveRobotData.value
|
||||
// })
|
||||
moveRobotData.value.vz = rotationAngle.value
|
||||
const res = await moveRobot({
|
||||
terminalId: props.robot.terminalId,
|
||||
deviceId: props.robot.robotCode,
|
||||
...moveRobotData.value
|
||||
})
|
||||
}
|
||||
|
||||
function onRelease() {
|
||||
moveRobotData.value.vx = 0;
|
||||
moveRobotData.value.vy = 0;
|
||||
// stopRobot({
|
||||
// ip: robotStore.ip,
|
||||
// deviceId: VITE_DEVICE_ID
|
||||
// })
|
||||
stopRobot({
|
||||
terminalId: props.robot.terminalId,
|
||||
deviceId: props.robot.robotCode,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
<el-radio :value="3">相机</el-radio>
|
||||
</el-radio-group>
|
||||
<div class="controller-panel">人工控制面板</div>
|
||||
<DirectionControl v-if="activeController === 1" />
|
||||
<DirectionControl v-if="activeController === 1" :robot="activeBotData" />
|
||||
<div v-if="activeController === 2" class="robotic-arm-controller-container">
|
||||
<el-radio-group v-model="activeRoboticArm" size="small">
|
||||
<el-radio :value="1">末端控制</el-radio>
|
||||
@ -91,7 +91,9 @@
|
||||
|
||||
</div>
|
||||
<div class="video-container">
|
||||
<div v-if="activeMode === 'auto' || activeController === 1" class="map-container">地图</div>
|
||||
<div v-if="activeMode === 'auto' || activeController === 1" class="map-container">
|
||||
<MapCanvas :robotList="robotList" ref="mapCanvasRef" />
|
||||
</div>
|
||||
<div v-if="activeMode === 'artificial' && activeController === 2" class="model-container">
|
||||
<UrdfViewer ref="urdfViewerRef" base-path="/inspection/elfin10/" />
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user