предв. коммит
- сделала функцию с кьюар кодом
This commit is contained in:
+26
@@ -11,6 +11,14 @@ const clickCount = ref(1); // Счетчик нажатий
|
||||
const listOfTrips = ref([]);
|
||||
const isModalVisible = ref(false);
|
||||
let finallyText = "";
|
||||
const qr_sub_text = [
|
||||
"\tqd = QrDetect()\n",
|
||||
"\tqr_sub = rospy.Subscriber('main_camera/image_raw',Image, qd.qr_detection,queue_size=1)\n",
|
||||
"\trospy.sleep(2)\n",
|
||||
"\tqr_sub.unregister()\n"
|
||||
];
|
||||
let is_qr_used = 0;
|
||||
let head = "";
|
||||
|
||||
onMounted(() => {
|
||||
for (let i = 0; i < 100; i++) {
|
||||
@@ -49,13 +57,31 @@ function saveResult() {
|
||||
let navigate_waites = "";
|
||||
for (const item of listOfTrips.value) {
|
||||
navigate_waites += `\tnavigate_wait(${item.x}, ${item.y})\n`;
|
||||
if (item.x===1 && item.y === 1) {
|
||||
navigate_waites += qr_sub_text.join('')
|
||||
is_qr_used=1
|
||||
}
|
||||
}
|
||||
|
||||
fetch("/shablons/emergency_and_navigate.txt")
|
||||
.then((response) => response.text())
|
||||
.then((textOfCode) => {
|
||||
finallyText = textOfCode.replace("<<navigate_wait>>", navigate_waites);
|
||||
});
|
||||
isModalVisible.value = true;
|
||||
if (is_qr_used === 1) {
|
||||
Qr_head()
|
||||
is_qr_used +=1
|
||||
}
|
||||
}
|
||||
|
||||
function Qr_head() {
|
||||
fetch("/shablons/qr.txt")
|
||||
.then((response) => response.text())
|
||||
.then((textOfCode) => {
|
||||
head = textOfCode;
|
||||
finallyText = finallyText.replace("<<qr_function>>", head);
|
||||
})
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
|
||||
Reference in New Issue
Block a user