Develop #5
@@ -40,7 +40,7 @@ def navigate_wait(x=0, y=0, z=1, speed=0.5, frame_id='aruco_map', auto_arm=False
|
|||||||
def emergency_stop():
|
def emergency_stop():
|
||||||
|
|
||||||
"""Функция экстренной остановки, срабатывает при нажатии Ctrl + C"""
|
"""Функция экстренной остановки, срабатывает при нажатии Ctrl + C"""
|
||||||
|
|
||||||
print("\n" + "="*50)
|
print("\n" + "="*50)
|
||||||
print("EMERGENCY STOP ACTIVATED!")
|
print("EMERGENCY STOP ACTIVATED!")
|
||||||
print("="*50)
|
print("="*50)
|
||||||
@@ -97,7 +97,7 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
<<main>>
|
<<main>>
|
||||||
|
|
||||||
|
|
||||||
land() #посадка
|
land() #посадка
|
||||||
|
|
||||||
|
|||||||
+54
-37
@@ -36,7 +36,7 @@ function setNumber(item) {
|
|||||||
clickCount.value++;
|
clickCount.value++;
|
||||||
} else {
|
} else {
|
||||||
//если нажимаем на ранее отмеченную клетку, то выводится ошибка
|
//если нажимаем на ранее отмеченную клетку, то выводится ошибка
|
||||||
if (numbers.value[item.index].variable.at(-1) === clickCount.value - 1) {
|
if (item.variable.at(-1) === clickCount.value - 1) {
|
||||||
izitoast.error({
|
izitoast.error({
|
||||||
title: "Ошибка",
|
title: "Ошибка",
|
||||||
message: "Нельзя выбирать один и тот же aruco маркер 2 раза подряд",
|
message: "Нельзя выбирать один и тот же aruco маркер 2 раза подряд",
|
||||||
@@ -44,7 +44,7 @@ function setNumber(item) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
listOfTrips.value.push(item);
|
listOfTrips.value.push(item);
|
||||||
numbers.value[item.index].variable.push(clickCount.value);
|
item.variable.push(clickCount.value);
|
||||||
clickCount.value++;
|
clickCount.value++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ async function saveResult() {
|
|||||||
textOfCode = textOfCode.split('<<separator>>')
|
textOfCode = textOfCode.split('<<separator>>')
|
||||||
QRDetectClass.value = textOfCode[0]
|
QRDetectClass.value = textOfCode[0]
|
||||||
QRDetectCode.value += `\t${textOfCode[1].trim()}\n`;
|
QRDetectCode.value += `\t${textOfCode[1].trim()}\n`;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const item of listOfTrips.value) {
|
for (const item of listOfTrips.value) {
|
||||||
mainCode.value += `\tnavigate_wait(${item.x}, ${item.y})\n`;
|
mainCode.value += `\tnavigate_wait(${item.x}, ${item.y})\n`;
|
||||||
@@ -89,31 +89,35 @@ async function saveResult() {
|
|||||||
finallyText.value = textOfCode.replace("<<main>>", mainCode.value);
|
finallyText.value = textOfCode.replace("<<main>>", mainCode.value);
|
||||||
if (isUsedPlatform) {
|
if (isUsedPlatform) {
|
||||||
finallyText.value = finallyText.value.replace("<<ColorDetect>>", colorDetectClass.value);
|
finallyText.value = finallyText.value.replace("<<ColorDetect>>", colorDetectClass.value);
|
||||||
|
} else {
|
||||||
|
finallyText.value = finallyText.value.replace("<<ColorDetect>>", '');
|
||||||
}
|
}
|
||||||
if (isUsedQR) {
|
if (isUsedQR) {
|
||||||
finallyText.value = finallyText.value.replace("<<qr_function>>", QRDetectClass.value);
|
finallyText.value = finallyText.value.replace("<<qr_function>>", QRDetectClass.value);
|
||||||
|
} else {
|
||||||
|
finallyText.value = finallyText.value.replace("<<qr_function>>", '');
|
||||||
}
|
}
|
||||||
isModalVisible.value = true;}
|
isModalVisible.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
|
|
||||||
if (clickCount.value === 1) {
|
if (clickCount.value === 1) {
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
numbers.value[listOfTrips.value.at(-1).index].variable.pop();
|
|
||||||
listOfTrips.value.pop();
|
|
||||||
clickCount.value--;
|
|
||||||
}
|
}
|
||||||
|
listOfTrips.value.at(-1).variable.pop();
|
||||||
|
listOfTrips.value.pop();
|
||||||
|
clickCount.value--;
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanResult() {
|
function cleanResult() {
|
||||||
clickCount.value = 1;
|
clickCount.value = 1;
|
||||||
|
listOfTrips.value.forEach(item => {
|
||||||
|
item.isPlatform = false;
|
||||||
|
item.isQR = false;
|
||||||
|
item.variable = [];
|
||||||
|
item.BgImg = 'images/ArUco-marker.jpg'
|
||||||
|
})
|
||||||
listOfTrips.value = [];
|
listOfTrips.value = [];
|
||||||
for (let i = 0; i < 100; i++) {
|
|
||||||
numbers.value[i].variable = [];
|
|
||||||
numbers.value[i].BgImg = 'images/ArUco-marker.jpg'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Обрабатываем нажатие Ctrl + Z
|
// Обрабатываем нажатие Ctrl + Z
|
||||||
@@ -158,43 +162,57 @@ function handleDownloadBtn() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createPlatform(item, color) {
|
function createPlatform(item, color) {
|
||||||
if (!item.isPlatform && item.variable.at(-1) !== clickCount.value - 1) {
|
if (!item.variable.length) {
|
||||||
|
item.variable.push(clickCount.value);
|
||||||
listOfTrips.value.push(item)
|
listOfTrips.value.push(item)
|
||||||
numbers.value[item.index].variable.push(clickCount.value);
|
|
||||||
clickCount.value++
|
clickCount.value++
|
||||||
item['isPlatform'] = true
|
|
||||||
}
|
}
|
||||||
numbers.value[item.index].BgImg = `images/${color}-platform.jpg`
|
item.isPlatform = true;
|
||||||
|
item.isQR = false;
|
||||||
|
item.BgImg = `images/${color}-platform.jpg`
|
||||||
}
|
}
|
||||||
|
|
||||||
function deletePlatform(item) {
|
function deletePlatform(item) {
|
||||||
item['isPlatform'] = false
|
item.BgImg = 'images/ArUco-marker.jpg'
|
||||||
const index = listOfTrips.value.indexOf(item);
|
item.isPlatform = false
|
||||||
if (index !== -1) {
|
|
||||||
listOfTrips.value.splice(index, 1);
|
|
||||||
}
|
|
||||||
numbers.value[item.index].BgImg = 'images/ArUco-marker.jpg'
|
|
||||||
clickCount.value--
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createQR(item) {
|
function createQR(item) {
|
||||||
if (!item.isQR) {
|
if (!item.variable.length) {
|
||||||
|
item.variable.push(clickCount.value);
|
||||||
listOfTrips.value.push(item)
|
listOfTrips.value.push(item)
|
||||||
numbers.value[item.index].variable.push(clickCount.value);
|
clickCount.value++
|
||||||
}
|
}
|
||||||
item['isQR'] = true
|
item.isPlatform = false;
|
||||||
numbers.value[item.index].BgImg = `images/qr.jpg`
|
item.isQR = true;
|
||||||
clickCount.value++
|
item.BgImg = `images/qr.jpg`
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteQR(item) {
|
function deleteQR(item) {
|
||||||
item['isQR'] = false
|
item.BgImg = 'images/ArUco-marker.jpg'
|
||||||
|
item.isQR = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function deletePointMap(item) {
|
||||||
const index = listOfTrips.value.indexOf(item);
|
const index = listOfTrips.value.indexOf(item);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
|
const deletedIndex = item.variable.at(-1)
|
||||||
|
listOfTrips.value.forEach(square => {
|
||||||
|
square.variable.map(itemVariable => {
|
||||||
|
if (itemVariable === deletedIndex) {
|
||||||
|
square.variable = []
|
||||||
|
}
|
||||||
|
if (itemVariable > deletedIndex) {
|
||||||
|
square.variable[square.variable.indexOf(itemVariable)]--
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
listOfTrips.value.splice(index, 1);
|
listOfTrips.value.splice(index, 1);
|
||||||
|
clickCount.value--
|
||||||
|
item.isQR = false
|
||||||
|
item.isPlatform = false
|
||||||
|
item.BgImg = 'images/ArUco-marker.jpg'
|
||||||
}
|
}
|
||||||
numbers.value[item.index].BgImg = 'images/ArUco-marker.jpg'
|
|
||||||
clickCount.value--
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onContextMenu(e, item) {
|
function onContextMenu(e, item) {
|
||||||
@@ -238,10 +256,8 @@ function onContextMenu(e, item) {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Отмена",
|
label: "Удалить",
|
||||||
onClick: () => {
|
onClick: () => deletePointMap(item),
|
||||||
alert('Здесь ещё предстоит написать код')
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -322,6 +338,7 @@ html {
|
|||||||
transition: background-color 0.3s ease;
|
transition: background-color 0.3s ease;
|
||||||
|
|
||||||
color: white;
|
color: white;
|
||||||
|
font-size: 18px;
|
||||||
text-shadow: -1px -1px 0 black,
|
text-shadow: -1px -1px 0 black,
|
||||||
1px -1px 0 black,
|
1px -1px 0 black,
|
||||||
-1px 1px 0 black,
|
-1px 1px 0 black,
|
||||||
|
|||||||
Reference in New Issue
Block a user