|
@@ -159,7 +159,6 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
-
|
|
|
<el-dialog
|
|
|
v-model="worldDialogVisible"
|
|
|
title="生成world"
|
|
@@ -192,6 +191,22 @@
|
|
|
</el-upload>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ v-model="simulationDialogVisible"
|
|
|
+ title="启动仿真测试环境"
|
|
|
+ width="400"
|
|
|
+ :before-close="handleClose"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ >
|
|
|
+ <el-steps style="max-width: 600px" :active="simulation_active" finish-status="success">
|
|
|
+ <el-step title="数据拉取"/>
|
|
|
+ <el-step title="环境准备"/>
|
|
|
+ </el-steps>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="goToDetail" :disabled="simulation_active !== 2">开启仿真配置</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
<el-table stripe style="background-color: rgba(255,0,0,99%);width: 100%" border :data="tableData"
|
|
|
fixed ref="multipleTableRef" @selection-change="handleSelectionChange" :cell-style="{ textAlign: 'center'}" :header-cell-style="{ textAlign: 'center'}">
|
|
|
<el-table-column type="selection" width="55"/>
|
|
@@ -206,7 +221,7 @@
|
|
|
<el-table-column width="300" fixed="right" label="操作">
|
|
|
<template v-slot="scope">
|
|
|
<el-button size="small" type="danger" @click="generateWorld(scope.row)">生成world</el-button>
|
|
|
- <el-button size="small" type="danger" @click="goToDetail">仿真测试</el-button>
|
|
|
+ <el-button size="small" type="danger" @click="startSimulation(scope.row)">仿真测试</el-button>
|
|
|
<!-- <el-button size="small" type="danger" @click="goToDetail">算法评价</el-button>-->
|
|
|
</template>
|
|
|
|
|
@@ -245,6 +260,7 @@ const value
|
|
|
= ref(true)
|
|
|
const update_active = ref(0)
|
|
|
const world_active = ref(0)
|
|
|
+const simulation_active = ref(0)
|
|
|
const router = useRouter();
|
|
|
const algorithmContainerState = ref(false)
|
|
|
const gazeboState = ref(false)
|
|
@@ -255,6 +271,7 @@ const algorithmDialogVisible = ref(false)
|
|
|
const mapDialogVisible = ref(false)
|
|
|
const updateDialogVisible = ref(false)
|
|
|
const worldDialogVisible = ref(false)
|
|
|
+const simulationDialogVisible = ref(false)
|
|
|
|
|
|
const upload = ref<UploadInstance>()
|
|
|
const uploadUrl = ref<string>()
|
|
@@ -313,7 +330,7 @@ const uploadSuccess = (response, file, fileList) => {
|
|
|
}
|
|
|
|
|
|
const getDockerImages = (filter_prefix) => {
|
|
|
- axios.get('http://localhost:2375/v1.43/images/json').then(function (response) {
|
|
|
+ axios.get('/docker/v1.43/images/json').then(function (response) {
|
|
|
// console.log(response.data);
|
|
|
var images = response.data
|
|
|
.filter(d => d["RepoTags"].length > 0)
|
|
@@ -411,6 +428,8 @@ const isPropertySame= (array, propertyName) => {
|
|
|
return true; // 所有值都是相同的
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+// 地图更新
|
|
|
const updateMap = async () => {
|
|
|
// 检查选择的记录数量
|
|
|
if (multipleSelection.value.length == 0) {
|
|
@@ -437,13 +456,13 @@ const updateMap = async () => {
|
|
|
|
|
|
// 根据id下载地图更新需要的数据(压缩包)
|
|
|
const id = ids[0]
|
|
|
- const url = "http://127.0.0.1:8888/map/download/zipfile?id=" + id
|
|
|
+ const url = "http://localhost:8888/map/download/zipfile?id=" + id // 此处url不受配置的代理规则影响,应传递后端完整url地址
|
|
|
const fileName = "data-" + id + ".zip"
|
|
|
const savePath = "/home/cicv/work/pji_desktop/tmp_download/map_zip"
|
|
|
|
|
|
// 开启loading
|
|
|
const loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog'})
|
|
|
- const result = await window.electronAPI.downloadFile(url, fileName, savePath);
|
|
|
+ const result = await window.electronAPI.downloadFile(url, fileName, savePath, false);
|
|
|
if (!result.success) { // 下载失败
|
|
|
console.error('File download failed:', result.error);
|
|
|
ElMessage.error("地图更新数据拉取失败!");
|
|
@@ -458,7 +477,7 @@ const updateMap = async () => {
|
|
|
|
|
|
const checkMapbufConsistency = async (ids) => {
|
|
|
try {
|
|
|
- const response = await axios.post('http://127.0.0.1:8888/map/check/mapbufconsistency', ids)
|
|
|
+ const response = await axios.post('/local/map/check/mapbufconsistency', ids)
|
|
|
console.log(response.data)
|
|
|
return response.data.status
|
|
|
} catch (error) {
|
|
@@ -511,6 +530,7 @@ const rviz = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// world文件生成
|
|
|
const generateWorld = async (row) => {
|
|
|
const id = row.id
|
|
|
const equipmentNo = row.equipmentNo
|
|
@@ -529,7 +549,7 @@ const generateWorld = async (row) => {
|
|
|
worldDialogVisible.value = true
|
|
|
|
|
|
// 下载map.bag
|
|
|
- const result = await window.electronAPI.downloadFile(url, fileName, savePath);
|
|
|
+ const result = await window.electronAPI.downloadFile(url, fileName, savePath, false);
|
|
|
if (!result.success) { // 下载失败
|
|
|
console.error('File download failed:', result.error);
|
|
|
ElMessage.error("地图bag数据拉取失败!");
|
|
@@ -538,7 +558,7 @@ const generateWorld = async (row) => {
|
|
|
// 更新步骤条状态
|
|
|
world_active.value = 1
|
|
|
console.log("Starting world generation...")
|
|
|
- // 执行脚本
|
|
|
+ // 执行脚本 - 生成world,启动gazebo
|
|
|
window.electronAPI.generateWorld(result.filePath);
|
|
|
// 开启loading
|
|
|
const loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog'})
|
|
@@ -566,6 +586,85 @@ const generateWorld = async (row) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 仿真测试环境准备
|
|
|
+const startSimulation = async (row) => {
|
|
|
+ // 检查是否已选择算法镜像
|
|
|
+ let imageName = selectImageName.value
|
|
|
+ let containerName = imageName.replace(':', '_')
|
|
|
+ if (imageName === "") { // 未选择
|
|
|
+ ElMessage.error("请选择算法镜像!")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查data目录是否存在
|
|
|
+ let response = await axios.get('/local/simulation/check/file/data/status?id=' + row.id);
|
|
|
+ if (!response.data.status){ // 不存在
|
|
|
+ ElMessage.error("data目录不存在,无法执行仿真测试!")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查world文件是否存在
|
|
|
+ response = await axios.get('/local/world/check/file/world/status?id=' + row.id)
|
|
|
+ if (!response.data.status){ // 不存在
|
|
|
+ ElMessage.error("world文件不存在,请先生成并上传world文件!")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 开启对话框
|
|
|
+ simulationDialogVisible.value = true
|
|
|
+ await nextTick()
|
|
|
+
|
|
|
+ // 根据id下载仿真测试需要的数据(压缩包)
|
|
|
+ const id = row.id
|
|
|
+ const url = "http://localhost:8888/simulation/download/zipfile?id=" + id // 此处url不受配置的代理规则影响,应传递后端完整url地址
|
|
|
+ const fileName = "data-" + id + ".zip"
|
|
|
+ const savePath = "/home/cicv/work/pji_desktop/tmp_download/simulation_zip"
|
|
|
+
|
|
|
+ console.log("Starting download files...")
|
|
|
+ // 开启loading
|
|
|
+ let loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog'})
|
|
|
+ const result = await window.electronAPI.downloadFile(url, fileName, savePath, false);
|
|
|
+ if (!result.success) { // 下载失败
|
|
|
+ console.error('File download failed:', result.error);
|
|
|
+ ElMessage.error("仿真测试数据拉取失败!");
|
|
|
+ } else { // 下载成功
|
|
|
+ console.log('File downloaded successfully:', result.filePath);
|
|
|
+ loadingInstance.close()
|
|
|
+ // 更新步骤条状态
|
|
|
+ simulation_active.value = 1
|
|
|
+ // 延时
|
|
|
+ setTimeout(() => {}, 1500)
|
|
|
+ // 开启loading
|
|
|
+ loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog'})
|
|
|
+ // 执行脚本 - 数据准备,启动容器
|
|
|
+ window.electronAPI.startContainer(result.filePath, imageName, containerName);
|
|
|
+ // 监听脚本执行状态
|
|
|
+ window.electronAPI.onStartContainerResponse( (event, result) => {
|
|
|
+ if (result.success) { // 脚本执行成功
|
|
|
+ console.log('Script execution completed successfully.')
|
|
|
+ // 关闭loading
|
|
|
+ loadingInstance.close()
|
|
|
+ // 更新步骤条状态
|
|
|
+ simulation_active.value = 2
|
|
|
+ // // 使用 Electron 进行文件删除操作
|
|
|
+ // window.electronAPI.deleteFile(fileName, savePath)
|
|
|
+ // // 监听删除文件的响应
|
|
|
+ // window.electronAPI.onDeleteFileResponse((event, response) => {
|
|
|
+ // if (response.success) { // 删除成功
|
|
|
+ // console.log("File deleted successfully.")
|
|
|
+ // } else { // 删除失败
|
|
|
+ // console.log(`Error: ${response.message}`)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ } else { // 脚本执行过程中发生错误
|
|
|
+ console.error('Script execution failed.');
|
|
|
+ ElMessage.error("仿真测试环境发生错误!");
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
const queryLine = reactive({
|
|
|
dataName: '',
|
|
|
equipmentName: '',
|
|
@@ -585,7 +684,7 @@ onBeforeMount(() => {
|
|
|
})
|
|
|
|
|
|
function page() {
|
|
|
- axios.get('http://36.110.106.156:11121/open/scene/list?equipmentType=YI_DAO_JI_QI_REN&page=' + currentPage.value + '&size=' + pageSize.value,
|
|
|
+ axios.get('/pji/open/scene/list?equipmentType=YI_DAO_JI_QI_REN&page=' + currentPage.value + '&size=' + pageSize.value,
|
|
|
{
|
|
|
headers: {
|
|
|
"Authorization": "4773hd92ysj54paflw2jem3onyhywxt2"
|