From a7f9776aee323daddabcaa97c86fdc141e95ac69 Mon Sep 17 00:00:00 2001 From: Jason Kim Date: Thu, 19 Sep 2024 18:47:22 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=EC=8A=A4=EB=A7=88=ED=8A=B8=ED=8C=9C=20?= =?UTF-8?q?=EB=8F=99=EC=9E=91=EB=B8=94=EB=A1=9D=20=EB=8C=80=EA=B8=B0?= =?UTF-8?q?=EC=8B=9C=EA=B0=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../blocks/hardware/block_robotisRBPracticalAssembly.js | 4 ++-- .../blocks/hardwareLite/block_robotis_robotai_lite.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/playground/blocks/hardware/block_robotisRBPracticalAssembly.js b/src/playground/blocks/hardware/block_robotisRBPracticalAssembly.js index 561ff6a015..cab0b58a01 100644 --- a/src/playground/blocks/hardware/block_robotisRBPracticalAssembly.js +++ b/src/playground/blocks/hardware/block_robotisRBPracticalAssembly.js @@ -2415,12 +2415,12 @@ Entry.Robotis_rb_P_Assembly.getBlocks = function () { { case 1: address = 2132; - wait_time = 6000; + wait_time = 6500; break; case 2: address = 2133; - wait_time = 1600; + wait_time = 2100; break; } diff --git a/src/playground/blocks/hardwareLite/block_robotis_robotai_lite.js b/src/playground/blocks/hardwareLite/block_robotis_robotai_lite.js index 5dbfc6e418..42e535e7df 100644 --- a/src/playground/blocks/hardwareLite/block_robotis_robotai_lite.js +++ b/src/playground/blocks/hardwareLite/block_robotis_robotai_lite.js @@ -2925,12 +2925,12 @@ let beat_per_minute = 75; switch (action) { case 1: address = 2132; - wait_time = 6000; + wait_time = 6500; break; case 2: address = 2133; - wait_time = 1600; + wait_time = 2100; break; } From 51e6a3c2df55230316f6c846979f81d8bbf16426 Mon Sep 17 00:00:00 2001 From: Jason Kim Date: Thu, 19 Sep 2024 18:48:17 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=EC=B9=B4=EB=A9=94=EB=9D=BC=20=ED=83=80?= =?UTF-8?q?=EA=B2=9F=20ID=20=EC=84=A4=EC=A0=95=20=EC=A1=B0=EA=B1=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../block_robotisRBPracticalAssembly.js | 64 +++++++++++-------- .../block_robotis_robotai_lite.js | 40 +++++++----- 2 files changed, 60 insertions(+), 44 deletions(-) diff --git a/src/playground/blocks/hardware/block_robotisRBPracticalAssembly.js b/src/playground/blocks/hardware/block_robotisRBPracticalAssembly.js index cab0b58a01..4128d7b09c 100644 --- a/src/playground/blocks/hardware/block_robotisRBPracticalAssembly.js +++ b/src/playground/blocks/hardware/block_robotisRBPracticalAssembly.js @@ -45,6 +45,7 @@ Entry.Robotis_rb_P_Assembly = { Entry.Robotis_carCont.setRobotisData([ [Entry.Robotis_rb.INSTRUCTION.WRITE, 2100, 1, 1], // PracticeBot Finish ]); + camera_id_for_use = 0; Entry.Robotis_carCont.update(); }, id: ['7.A', '7.B'], @@ -1155,6 +1156,7 @@ let dxl_last_valid_value = []; let rb100_last_valid_value = []; let bg_color = 0; let beat_per_minute = 75; +let camera_id_for_use = 0; const _doevent = ms => new Promise(res => setTimeout(res, ms)); async function wait(nTime) { await _doevent(nTime); } @@ -7056,20 +7058,23 @@ Entry.Robotis_rb_P_Assembly.getBlocks = function () { var data_length = 2; var data_value = script.getNumberValue('ID'); - var data_sendqueue = [ - [ - data_instruction, - data_address, - data_length, - data_value, - ], - ]; - - Entry.Robotis_carCont.postCallReturn( - script, - data_sendqueue, - Entry.Robotis_openCM70.delay - ); + if (camera_id_for_use != data_value) { + var data_sendqueue = [ + [ + data_instruction, + data_address, + data_length, + data_value, + ], + ]; + + Entry.Robotis_carCont.postCallReturn( + script, + data_sendqueue, + Entry.Robotis_openCM70.delay + ); + camera_id_for_use = data_value; + } data_address = 4036; // BLOCK_RESULT_BY_ID_X_CENTER @@ -7149,20 +7154,23 @@ Entry.Robotis_rb_P_Assembly.getBlocks = function () { var data_length = 2; var data_value = script.getNumberValue('ID'); - var data_sendqueue = [ - [ - data_instruction, - data_address, - data_length, - data_value, - ], - ]; - - Entry.Robotis_carCont.postCallReturn( - script, - data_sendqueue, - Entry.Robotis_openCM70.delay - ); + if (camera_id_for_use != data_value) { + var data_sendqueue = [ + [ + data_instruction, + data_address, + data_length, + data_value, + ], + ]; + + Entry.Robotis_carCont.postCallReturn( + script, + data_sendqueue, + Entry.Robotis_openCM70.delay + ); + camera_id_for_use = data_value; + } data_address = 4044; // ARROW_RESULT_BY_ID_X_ORIGIN diff --git a/src/playground/blocks/hardwareLite/block_robotis_robotai_lite.js b/src/playground/blocks/hardwareLite/block_robotis_robotai_lite.js index 42e535e7df..22c6766381 100644 --- a/src/playground/blocks/hardwareLite/block_robotis_robotai_lite.js +++ b/src/playground/blocks/hardwareLite/block_robotis_robotai_lite.js @@ -156,6 +156,7 @@ const crcTable = [ const rb100_last_valid_value = []; let bg_color = 0; let beat_per_minute = 75; +let camera_id_for_use = 0; (function () { Entry.RobotisRobotaiLite = new (class RobotisRobotaiLite { @@ -296,6 +297,7 @@ let beat_per_minute = 75; this.__removeAllTimeouts(); this.robotisBuffer = []; this.robotisBuffer.push([INST_WRITE, 2100, 1, 1]); + camera_id_for_use = 0; if (Entry.hwLite && Entry.hwLite.serial) { Entry.hwLite.serial.update(); } @@ -6995,15 +6997,18 @@ let beat_per_minute = 75; let data_length = 2; let data_value = script.getNumberValue('ID'); - let data_sendqueue = [ - [data_instruction, data_address, data_length, data_value], - ]; + if (data_value != camera_id_for_use) { + let data_sendqueue = [ + [data_instruction, data_address, data_length, data_value], + ]; - Entry.RobotisRobotaiLite.postCallReturn( - script, - data_sendqueue, - DEFAULT_DELAY - ); + Entry.RobotisRobotaiLite.postCallReturn( + script, + data_sendqueue, + DEFAULT_DELAY + ); + camera_id_for_use = data_value; + } data_address = 4036; // BLOCK_RESULT_BY_ID_X_CENTER @@ -7080,15 +7085,18 @@ let beat_per_minute = 75; let data_length = 2; let data_value = script.getNumberValue('ID'); - let data_sendqueue = [ - [data_instruction, data_address, data_length, data_value], - ]; + if (data_value != camera_id_for_use) { + let data_sendqueue = [ + [data_instruction, data_address, data_length, data_value], + ]; - Entry.RobotisRobotaiLite.postCallReturn( - script, - data_sendqueue, - DEFAULT_DELAY - ); + Entry.RobotisRobotaiLite.postCallReturn( + script, + data_sendqueue, + DEFAULT_DELAY + ); + camera_id_for_use = data_value; + } data_address = 4044; // ARROW_RESULT_BY_ID_X_ORIGIN