diff --git a/extern/lang/code.js b/extern/lang/code.js
index 174d3f0477..890a6935c8 100644
--- a/extern/lang/code.js
+++ b/extern/lang/code.js
@@ -1299,6 +1299,9 @@ Lang.Blocks = {
"robotis_common_play_motion": "실행",
"robotis_common_motion": "모션",
"robotis_common_index_number": "번",
+ "robotis_common_left": "왼쪽",
+ "robotis_common_right": "오른쪽",
+ "robotis_common_minute": "분",
"robotis_cm_custom": "직접입력 주소",
"robotis_cm_spring_left": "왼쪽 접촉 센서",
"robotis_cm_spring_right": "오른쪽 접촉 센서",
@@ -5426,12 +5429,16 @@ Lang.Helper = {
"robotis_openCM70_cm_sound_detected_clear": "최종 소리 감지횟 수를 0 으로 초기화 합니다.",
"robotis_openCM70_cm_led": "제어기의 빨간색, 녹색, 파란색 LED 를 켜거나 끕니다.",
"robotis_openCM70_cm_motion": "제어기에 다운로드 되어있는 모션을 실행합니다.",
- "robotis_openCM70_aux_motor_speed": "감속모터 속도를 0 ~ 1023 의 값(으)로 정합니다.",
+ "robotis_openCM70_cm_autodrive_motor": "자율주행 자동차의 모터 포트를 지정합니다.",
+ "robotis_openCM70_cm_autodrive_ir": "자율주행 자동차의 적외선 센서 포트를 지정합니다.",
+ "robotis_openCM70_cm_autodrive_speed": "차로를 따라 지정한 속도로 자율주행을 수행합니다.",
+ "robotis_openCM70_aux_motor_speed": "감속모터 속도를 0 ~ 100% 의 값(으)로 정합니다.",
"robotis_openCM70_aux_servo_mode": "서보모터를 회전모드 또는 관절모드로 정합니다.
한번 설정된 모드는 계속 적용됩니다.
회전모드는 서보모터 속도를 지정하여 서보모터를 회전 시킵니다.
관절모드는 지정한 서보모터 속도로 서보모터 위치를 이동 시킵니다.",
- "robotis_openCM70_aux_servo_speed": "서보모터 속도를 0 ~ 1023 의 값(으)로 정합니다.",
- "robotis_openCM70_aux_servo_position": "서보모터 위치를 0 ~ 1023 의 값(으)로 정합니다.
서보모터 속도와 같이 사용해야 합니다.",
+ "robotis_openCM70_aux_servo_speed": "서보모터 속도를 0 ~ 100% 의 값(으)로 정합니다.",
+ "robotis_openCM70_aux_servo_position": "서보모터 위치를 -150도 ~ 150도 의 값(으)로 정합니다.
서보모터 속도와 같이 사용해야 합니다.",
"robotis_openCM70_aux_led_module": "LED 모듈의 LED 를 켜거나 끕니다.",
"robotis_openCM70_aux_custom": "사용자 센서 제작에 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.",
+ "robotis_openCM70_cm_poweroff_timer": "제어기의 자동꺼짐 타이머를 설정합니다.
설정된 만큼의 시간동안 통신이 진행되지 않으면 제어기는 자동으로 꺼집니다.",
"robotis_openCM70_cm_custom_value": "컨트롤 테이블 주소를 직접 입력하여 값을 확인 합니다.
컨트롤 테이블 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.",
"robotis_openCM70_cm_custom": "컨트롤 테이블 주소를 직접 입력하여 값을 정합니다.
컨트롤 테이블 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.",
"show_variable": "선택한 변수의 '변수 창'을 실행화면에 보이게 합니다.",
@@ -6337,12 +6344,16 @@ Lang.template = {
"robotis_openCM70_cm_sound_detected_clear": "최종소리감지횟수 초기화 %1",
"robotis_openCM70_cm_led": "제어기 %1 LED %2 %3",
"robotis_openCM70_cm_motion": "모션 %1 번 실행 %2",
- "robotis_openCM70_aux_motor_speed": "%1 감속모터 속도를 %2 , 출력값을 %3 (으)로 정하기 %4",
+ "robotis_openCM70_cm_autodrive_motor": "자율주행 자동차 %1모터를 %2 에 연결 %3",
+ "robotis_openCM70_cm_autodrive_ir": "자율주행 자동차 %1적외선센서를 %2 에 연결 %3",
+ "robotis_openCM70_cm_autodrive_speed": "차로를 따라 %1의 속도로 자율주행 %2",
+ "robotis_openCM70_aux_motor_speed": "%1 감속모터 속도를 %2, 출력값을 %3%로 정하기 %4",
"robotis_openCM70_aux_servo_mode": "%1 서보모터 모드를 %2 (으)로 정하기 %3",
- "robotis_openCM70_aux_servo_speed": "%1 서보모터 속도를 %2 , 출력값을 %3 (으)로 정하기 %4",
- "robotis_openCM70_aux_servo_position": "%1 서보모터 위치를 %2 (으)로 정하기 %3",
+ "robotis_openCM70_aux_servo_speed": "%1 서보모터 속도를 %2, 출력값을 %3%로 정하기 %4",
+ "robotis_openCM70_aux_servo_position": "%1 서보모터 위치를 %2도로 정하기 %3",
"robotis_openCM70_aux_led_module": "%1 LED 모듈을 %2 (으)로 정하기 %3",
"robotis_openCM70_aux_custom": "%1 사용자 장치를 %2 (으)로 정하기 %3",
+ "robotis_openCM70_cm_poweroff_timer": "제어기 자동꺼짐 타이머 %1 %2",
"robotis_openCM70_cm_custom": "직접입력 주소 ( %1 ) (을)를 %2 (으)로 정하기 %3",
"robotis_carCont_sensor_value": "%1 값",
"robotis_carCont_cm_led": "4번 LED %1 , 1번 LED %2 %3",
diff --git a/extern/lang/ebs.js b/extern/lang/ebs.js
index 67395881b0..a9c50172ed 100644
--- a/extern/lang/ebs.js
+++ b/extern/lang/ebs.js
@@ -1304,6 +1304,9 @@ Lang.Blocks = {
"robotis_common_play_motion": "실행",
"robotis_common_motion": "모션",
"robotis_common_index_number": "번",
+ "robotis_common_left": "왼쪽",
+ "robotis_common_right": "오른쪽",
+ "robotis_common_minute": "분",
"robotis_cm_custom": "직접입력 주소",
"robotis_cm_spring_left": "왼쪽 접촉 센서",
"robotis_cm_spring_right": "오른쪽 접촉 센서",
@@ -5438,12 +5441,17 @@ Lang.Helper = {
"robotis_openCM70_cm_sound_detected_clear": "최종 소리 감지횟 수를 0 으로 초기화 합니다.",
"robotis_openCM70_cm_led": "제어기의 빨간색, 녹색, 파란색 LED 를 켜거나 끕니다.",
"robotis_openCM70_cm_motion": "제어기에 다운로드 되어있는 모션을 실행합니다.",
- "robotis_openCM70_aux_motor_speed": "감속모터 속도를 0 ~ 1023 의 값(으)로 정합니다.",
+ "robotis_openCM70_cm_autodrive_motor": "자율주행 자동차의 모터 포트를 지정합니다.",
+ "robotis_openCM70_cm_autodrive_ir": "자율주행 자동차의 적외선 센서 포트를 지정합니다.",
+ "robotis_openCM70_cm_autodrive_speed": "지정한 속도로 자율주행을 수행합니다.",
+ "robotis_openCM70_aux_car_move": "로봇을 지정한 속도와 방향으로 움직이도록 합니다.",
+ "robotis_openCM70_aux_motor_speed": "감속모터 속도를 0 ~ 100% 의 값으로 정합니다.",
"robotis_openCM70_aux_servo_mode": "서보모터를 회전모드 또는 관절모드로 정합니다.
한번 설정된 모드는 계속 적용됩니다.
회전모드는 서보모터 속도를 지정하여 서보모터를 회전 시킵니다.
관절모드는 지정한 서보모터 속도로 서보모터 위치를 이동 시킵니다.",
- "robotis_openCM70_aux_servo_speed": "서보모터 속도를 0 ~ 1023 의 값(으)로 정합니다.",
- "robotis_openCM70_aux_servo_position": "서보모터 위치를 0 ~ 1023 의 값(으)로 정합니다.
서보모터 속도와 같이 사용해야 합니다.",
+ "robotis_openCM70_aux_servo_speed": "서보모터 속도를 0 ~ 100% 의 값으로 정합니다.",
+ "robotis_openCM70_aux_servo_position": "서보모터 위치를 -150도 ~ 150도 의 값(으)로 정합니다.
서보모터 속도와 같이 사용해야 합니다.",
"robotis_openCM70_aux_led_module": "LED 모듈의 LED 를 켜거나 끕니다.",
"robotis_openCM70_aux_custom": "사용자 센서 제작에 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.",
+ "robotis_openCM70_cm_poweroff_timer": "제어기의 자동꺼짐 타이머를 설정합니다.
설정된 만큼의 시간동안 통신이 진행되지 않으면 제어기는 자동으로 꺼집니다.",
"robotis_openCM70_cm_custom_value": "컨트롤 테이블 주소를 직접 입력하여 값을 확인 합니다.
컨트롤 테이블 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.",
"robotis_openCM70_cm_custom": "컨트롤 테이블 주소를 직접 입력하여 값을 정합니다.
컨트롤 테이블 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.",
"show_variable": "선택한 변수의 '변수 창'을 실행화면에 보이게 합니다.",
@@ -6353,12 +6361,17 @@ Lang.template = {
"robotis_openCM70_cm_sound_detected_clear": "최종소리감지횟수 초기화 %1",
"robotis_openCM70_cm_led": "제어기 %1 LED %2 %3",
"robotis_openCM70_cm_motion": "모션 %1 번 실행 %2",
- "robotis_openCM70_aux_motor_speed": "%1 감속모터 속도를 %2 , 출력값을 %3 (으)로 정하기 %4",
+ "robotis_openCM70_cm_autodrive_motor": "자율주행 자동차 %1 모터를 %2 에 연결 %3",
+ "robotis_openCM70_cm_autodrive_ir": "자율주행 자동차 %1 적외선센서를 %2 에 연결 %3",
+ "robotis_openCM70_cm_autodrive_speed": "차로를 따라 %1의 속도로 자율주행 %2",
+ "robotis_openCM70_aux_car_move": "로봇을 %1% 의 속도로 %2 %3",
+ "robotis_openCM70_aux_motor_speed": "%1 감속모터 속도를 %2 , 출력값을 %3%로 정하기 %4",
"robotis_openCM70_aux_servo_mode": "%1 서보모터 모드를 %2 (으)로 정하기 %3",
- "robotis_openCM70_aux_servo_speed": "%1 서보모터 속도를 %2 , 출력값을 %3 (으)로 정하기 %4",
- "robotis_openCM70_aux_servo_position": "%1 서보모터 위치를 %2 (으)로 정하기 %3",
+ "robotis_openCM70_aux_servo_speed": "%1 서보모터 속도를 %2 , 출력값을 %3%로 정하기 %4",
+ "robotis_openCM70_aux_servo_position": "%1 서보모터 위치를 %2도로 정하기 %3",
"robotis_openCM70_aux_led_module": "%1 LED 모듈을 %2 (으)로 정하기 %3",
"robotis_openCM70_aux_custom": "%1 사용자 장치를 %2 (으)로 정하기 %3",
+ "robotis_openCM70_cm_poweroff_timer": "제어기 자동꺼짐 타이머 %1 %2",
"robotis_openCM70_cm_custom": "직접입력 주소 ( %1 ) (을)를 %2 (으)로 정하기 %3",
"robotis_carCont_sensor_value": "%1 값",
"robotis_carCont_cm_led": "4번 LED %1 , 1번 LED %2 %3",
diff --git a/extern/lang/en.js b/extern/lang/en.js
index 2fbddd506f..bc0949710a 100644
--- a/extern/lang/en.js
+++ b/extern/lang/en.js
@@ -498,6 +498,9 @@ Lang.Blocks = {
"robotis_common_play_motion": "Play",
"robotis_common_motion": "Motion",
"robotis_common_index_number": "Number",
+ "robotis_common_left": "Left",
+ "robotis_common_right": "Right",
+ "robotis_common_minute": "minute(s)",
"robotis_cm_custom": "Custom address",
"robotis_cm_spring_left": "Left contact sensor",
"robotis_cm_spring_right": "Right contact sensor",
@@ -4645,12 +4648,17 @@ Lang.Helper = {
"robotis_openCM70_cm_sound_detected_clear": "Final number of sound detection ",
"robotis_openCM70_cm_led": "Turns the red, green, blue LED of the device on or off.",
"robotis_openCM70_cm_motion": "Executes the motion downloaded on the device.",
- "robotis_openCM70_aux_motor_speed": "Sets the speed of decelerating motor to the value of 0 - 1023.",
+ "robotis_openCM70_cm_autodrive_motor": "Specifies the motor port of the autonomous driving car.",
+ "robotis_openCM70_cm_autodrive_ir": "Specifies the IR sensor port of the autonomous driving car.",
+ "robotis_openCM70_cm_autodrive_speed": "Perform autonomous driving at the specified speed along the lane.",
+ "robotis_openCM70_aux_car_move": "Make the robot move at the specified speed and direction.",
+ "robotis_openCM70_aux_motor_speed": "Sets the speed of decelerating motor to the value of 0 - 100%.",
"robotis_openCM70_aux_servo_mode": "Sets the servo motor as wheel mode or joint mode.
The same mode continues to apply once it's set.
Wheel mode designates the servo motor's speed, and spins the servo motor.
Joint mode moves the servo motor's position with the set servo motor speed.",
"robotis_openCM70_aux_servo_speed": "Sets servo motor's speed to the value of 0 - 1023.",
- "robotis_openCM70_aux_servo_position": "Sets servo motor's position to the value of 0-1023.
Use as servo motor speed",
+ "robotis_openCM70_aux_servo_position": "Sets servo motor's position to the value of -150 - 150 degree.
Use as servo motor speed",
"robotis_openCM70_aux_led_module": "Turns the LED of LED module on or off.",
"robotis_openCM70_aux_custom": "Please refer to the ROBOTIS e-manual (http://support.robotis.com/ko/) for the explanation of user sensor production.",
+ "robotis_openCM70_cm_poweroff_timer": "Set the controller's auto-off timer.
If there is no communication for the set amount of time, the controller will automatically turn off.",
"robotis_openCM70_cm_custom_value": "Checks the value by directly inputting the control table address.
Please refer to the ROBOTIS e-manual (http://support.robotis.com/ko/) for the explanation about control table.",
"robotis_openCM70_cm_custom": "Checks the value by directly inputting the control table address.
Please refer to the ROBOTIS e-manual (http://support.robotis.com/ko/) for the explanation about control table.",
"show_variable": "Shows the value of the selected variable on the stage.",
@@ -5563,12 +5571,17 @@ Lang.template = {
"robotis_openCM70_cm_sound_detected_clear": "Initialize the final number of sound detection %1",
"robotis_openCM70_cm_led": "Controller %1 LED %2 %3",
"robotis_openCM70_cm_motion": "Play the motion %1 times",
- "robotis_openCM70_aux_motor_speed": "Set the speed of decelerating motor of %1 to %2 , and the output value to %3 %4",
+ "robotis_openCM70_cm_autodrive_motor": "Autonomous driving car %1 motor uses %2 %3",
+ "robotis_openCM70_cm_autodrive_ir": "Autonomous driving car %1 IR sensor uses %2 %3",
+ "robotis_openCM70_cm_autodrive_speed": "Perform autonomous driving at the speed of %1 %2",
+ "robotis_openCM70_aux_car_move": "Make the robot %2 at a speed of %1% %3",
+ "robotis_openCM70_aux_motor_speed": "Set the speed of decelerating motor of %1 to %2 , and the output value to %3% %4",
"robotis_openCM70_aux_servo_mode": "Set the mode of %1 servo motor to %2 %3",
- "robotis_openCM70_aux_servo_speed": "Set the speed of servo motor of %1 to %2 , and the output value to %3 %4",
- "robotis_openCM70_aux_servo_position": "Set the position of %1 servo motor to %2 %3",
+ "robotis_openCM70_aux_servo_speed": "Set the speed of servo motor of %1 to %2 , and the output value to %3% %4",
+ "robotis_openCM70_aux_servo_position": "Set the position of %1 servo motor to %2 degree %3",
"robotis_openCM70_aux_led_module": "Set the LED module of %1 as %2 %3",
"robotis_openCM70_aux_custom": "Set the user device of %1 as %2 %3",
+ "robotis_openCM70_cm_poweroff_timer": "Set auto-off timer as %1 %2",
"robotis_openCM70_cm_custom": "Set the custom address ( %1 ) as %2 %3",
"robotis_carCont_sensor_value": "Value %1",
"robotis_carCont_cm_led": "%1 LED 4, %2 LED %3",
diff --git a/extern/lang/jp.js b/extern/lang/jp.js
index 2592471d9f..416501869c 100644
--- a/extern/lang/jp.js
+++ b/extern/lang/jp.js
@@ -1295,6 +1295,9 @@ Lang.Blocks = {
"robotis_common_play_motion": "実行",
"robotis_common_motion": "モーション",
"robotis_common_index_number": "回",
+ "robotis_common_left": "左",
+ "robotis_common_right": "右",
+ "robotis_common_minute": "分",
"robotis_cm_custom": "直接入力アドレス",
"robotis_cm_spring_left": "左側接触センサー",
"robotis_cm_spring_right": "右側接触センサー",
@@ -5430,12 +5433,17 @@ Lang.Helper = {
"robotis_openCM70_cm_sound_detected_clear": "최종 소리 감지횟 수를 0 으로 초기화 합니다.",
"robotis_openCM70_cm_led": "제어기의 빨간색, 녹색, 파란색 LED 를 켜거나 끕니다.",
"robotis_openCM70_cm_motion": "제어기에 다운로드 되어있는 모션을 실행합니다.",
- "robotis_openCM70_aux_motor_speed": "감속모터 속도를 0 ~ 1023 의 값(으)로 정합니다.",
+ "robotis_openCM70_cm_autodrive_motor": "자율주행 자동차의 모터 포트를 지정합니다.",
+ "robotis_openCM70_cm_autodrive_ir": "자율주행 자동차의 적외선 센서 포트를 지정합니다.",
+ "robotis_openCM70_cm_autodrive_speed": "지정한 속도로 자율주행을 수행합니다.",
+ "robotis_openCM70_aux_car_move": "로봇을 지정한 속도와 방향으로 움직이도록 합니다.",
+ "robotis_openCM70_aux_motor_speed": "감속모터 속도를 0 ~ 100% 의 값으로 정합니다.",
"robotis_openCM70_aux_servo_mode": "서보모터를 회전모드 또는 관절모드로 정합니다.
한번 설정된 모드는 계속 적용됩니다.
회전모드는 서보모터 속도를 지정하여 서보모터를 회전 시킵니다.
관절모드는 지정한 서보모터 속도로 서보모터 위치를 이동 시킵니다.",
- "robotis_openCM70_aux_servo_speed": "서보모터 속도를 0 ~ 1023 의 값(으)로 정합니다.",
- "robotis_openCM70_aux_servo_position": "서보모터 위치를 0 ~ 1023 의 값(으)로 정합니다.
서보모터 속도와 같이 사용해야 합니다.",
+ "robotis_openCM70_aux_servo_speed": "서보모터 속도를 0 ~ 100% 의 값으로 정합니다.",
+ "robotis_openCM70_aux_servo_position": "서보모터 위치를 -150도 ~ 150도 의 값(으)로 정합니다.
서보모터 속도와 같이 사용해야 합니다.",
"robotis_openCM70_aux_led_module": "LED 모듈의 LED 를 켜거나 끕니다.",
"robotis_openCM70_aux_custom": "사용자 센서 제작에 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.",
+ "robotis_openCM70_cm_poweroff_timer": "제어기의 자동꺼짐 타이머를 설정합니다.
설정된 만큼의 시간동안 통신이 진행되지 않으면 제어기는 자동으로 꺼집니다.",
"robotis_openCM70_cm_custom_value": "컨트롤 테이블 주소를 직접 입력하여 값을 확인 합니다.
컨트롤 테이블 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.",
"robotis_openCM70_cm_custom": "컨트롤 테이블 주소를 직접 입력하여 값을 정합니다.
컨트롤 테이블 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.",
"show_variable": "選択した変数ウィンドウを実行画面に表示します。",
@@ -6343,12 +6351,17 @@ Lang.template = {
"robotis_openCM70_cm_sound_detected_clear": "Initialize the final number of sound detection %1",
"robotis_openCM70_cm_led": "Controller %1 LED %2 %3",
"robotis_openCM70_cm_motion": "Play the motion %1 times",
- "robotis_openCM70_aux_motor_speed": "Set the speed of decelerating motor of %1 to %2 , and the output value to %3 %4",
+ "robotis_openCM70_cm_autodrive_motor": "Autonomous driving car %1 motor uses %2 %3",
+ "robotis_openCM70_cm_autodrive_ir": "Autonomous driving car %1 IR sensor uses %2 %3",
+ "robotis_openCM70_cm_autodrive_speed": "Perform autonomous driving at the speed of %1 %2",
+ "robotis_openCM70_aux_car_move": "Make the robot %2 at a speed of %1% %3",
+ "robotis_openCM70_aux_motor_speed": "Set the speed of decelerating motor of %1 to %2 , and the output value to %3% %4",
"robotis_openCM70_aux_servo_mode": "Set the mode of %1 servo motor to %2 %3",
- "robotis_openCM70_aux_servo_speed": "Set the speed of servo motor of %1 to %2 , and the output value to %3 %4",
- "robotis_openCM70_aux_servo_position": "Set the position of %1 servo motor to %2 %3",
+ "robotis_openCM70_aux_servo_speed": "Set the speed of servo motor of %1 to %2 , and the output value to %3% %4",
+ "robotis_openCM70_aux_servo_position": "Set the position of %1 servo motor to %2 degree %3",
"robotis_openCM70_aux_led_module": "Set the LED module of %1 as %2 %3",
"robotis_openCM70_aux_custom": "Set the user device of %1 as %2 %3",
+ "robotis_openCM70_cm_poweroff_timer": "Set auto-off timer as %1 %2",
"robotis_openCM70_cm_custom": "Set the custom address ( %1 ) as %2 %3",
"robotis_carCont_sensor_value": "Value %1",
"robotis_carCont_cm_led": "%1 LED 4, %2 LED %3",
diff --git a/extern/lang/ko.js b/extern/lang/ko.js
index e73ecf4757..ba9d489eff 100644
--- a/extern/lang/ko.js
+++ b/extern/lang/ko.js
@@ -1320,6 +1320,9 @@ Lang.Blocks = {
robotis_common_play_motion: '실행',
robotis_common_motion: '모션',
robotis_common_index_number: '번',
+ robotis_common_left: '왼쪽',
+ robotis_common_right: '오른쪽',
+ robotis_common_minute: '분',
robotis_cm_custom: '직접입력 주소',
robotis_cm_spring_left: '왼쪽 접촉 센서',
robotis_cm_spring_right: '오른쪽 접촉 센서',
@@ -5989,15 +5992,21 @@ Lang.Helper = {
robotis_openCM70_cm_sound_detected_clear: '최종 소리 감지횟 수를 0 으로 초기화 합니다.',
robotis_openCM70_cm_led: '제어기의 빨간색, 녹색, 파란색 LED 를 켜거나 끕니다.',
robotis_openCM70_cm_motion: '제어기에 다운로드 되어있는 모션을 실행합니다.',
- robotis_openCM70_aux_motor_speed: '감속모터 속도를 0 ~ 1023 의 값(으)로 정합니다.',
+ robotis_openCM70_cm_autodrive_motor: '자율주행 자동차의 모터 포트를 지정합니다.',
+ robotis_openCM70_cm_autodrive_ir: '자율주행 자동차의 적외선 센서 포트를 지정합니다.',
+ robotis_openCM70_cm_autodrive_speed: '지정한 속도로 자율주행을 수행합니다.',
+ robotis_openCM70_aux_car_move: '로봇을 지정한 속도와 방향으로 움직이도록 합니다.',
+ robotis_openCM70_aux_motor_speed: '감속모터 속도를 0 ~ 100% 의 값으로 정합니다.',
robotis_openCM70_aux_servo_mode:
'서보모터를 회전모드 또는 관절모드로 정합니다.
한번 설정된 모드는 계속 적용됩니다.
회전모드는 서보모터 속도를 지정하여 서보모터를 회전 시킵니다.
관절모드는 지정한 서보모터 속도로 서보모터 위치를 이동 시킵니다.',
- robotis_openCM70_aux_servo_speed: '서보모터 속도를 0 ~ 1023 의 값(으)로 정합니다.',
+ robotis_openCM70_aux_servo_speed: '서보모터 속도를 0 ~ 100% 의 값으로 정합니다.',
robotis_openCM70_aux_servo_position:
- '서보모터 위치를 0 ~ 1023 의 값(으)로 정합니다.
서보모터 속도와 같이 사용해야 합니다.',
+ '서보모터 위치를 -150도 ~ 150도 의 값(으)로 정합니다.
서보모터 속도와 같이 사용해야 합니다.',
robotis_openCM70_aux_led_module: 'LED 모듈의 LED 를 켜거나 끕니다.',
robotis_openCM70_aux_custom:
'사용자 센서 제작에 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.',
+ robotis_openCM70_cm_poweroff_timer:
+ '제어기의 자동꺼짐 타이머를 설정합니다.
설정된 만큼의 시간동안 통신이 진행되지 않으면 제어기는 자동으로 꺼집니다.',
robotis_openCM70_cm_custom_value:
'컨트롤 테이블 주소를 직접 입력하여 값을 확인 합니다.
컨트롤 테이블 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.',
robotis_openCM70_cm_custom:
@@ -7360,11 +7369,16 @@ Lang.template = {
robotis_openCM70_cm_sound_detected_clear: '최종소리감지횟수 초기화 %1',
robotis_openCM70_cm_led: '제어기 %1 LED %2 %3',
robotis_openCM70_cm_motion: '모션 %1 번 실행 %2',
- robotis_openCM70_aux_motor_speed: '%1 감속모터 속도를 %2 , 출력값을 %3 (으)로 정하기 %4',
+ robotis_openCM70_cm_autodrive_motor: '자율주행 자동차 %1 모터를 %2 에 연결 %3',
+ robotis_openCM70_cm_autodrive_ir: '자율주행 자동차 %1 적외선센서를 %2 에 연결 %3',
+ robotis_openCM70_cm_autodrive_speed: '차로를 따라 %1의 속도로 자율주행 %2',
+ robotis_openCM70_aux_car_move: '로봇을 %1% 의 속도로 %2 %3',
+ robotis_openCM70_aux_motor_speed: '%1 감속모터 속도를 %2 , 출력값을 %3%로 정하기 %4',
robotis_openCM70_aux_servo_mode: '%1 서보모터 모드를 %2 (으)로 정하기 %3',
- robotis_openCM70_aux_servo_speed: '%1 서보모터 속도를 %2 , 출력값을 %3 (으)로 정하기 %4',
- robotis_openCM70_aux_servo_position: '%1 서보모터 위치를 %2 (으)로 정하기 %3',
+ robotis_openCM70_aux_servo_speed: '%1 서보모터 속도를 %2 , 출력값을 %3%로 정하기 %4',
+ robotis_openCM70_aux_servo_position: '%1 서보모터 위치를 %2도로 정하기 %3',
robotis_openCM70_aux_led_module: '%1 LED 모듈을 %2 (으)로 정하기 %3',
+ robotis_openCM70_cm_poweroff_timer: '제어기 자동꺼짐 타이머 %1 %2',
robotis_openCM70_aux_custom: '%1 사용자 장치를 %2 (으)로 정하기 %3',
robotis_openCM70_cm_custom: '직접입력 주소 ( %1 ) (을)를 %2 (으)로 정하기 %3',
robotis_carCont_sensor_value: '%1 값',
diff --git a/extern/lang/vn.js b/extern/lang/vn.js
index 3c19009f03..b44ad83f9c 100644
--- a/extern/lang/vn.js
+++ b/extern/lang/vn.js
@@ -1294,6 +1294,9 @@ Lang.Blocks = {
"robotis_common_play_motion": "thực hiện",
"robotis_common_motion": "chuyển động ",
"robotis_common_index_number": "số",
+ "robotis_common_left": "Bên trái",
+ "robotis_common_right": "Phải",
+ "robotis_common_minute": "phút",
"robotis_cm_custom": "nhập địa chỉ",
"robotis_cm_spring_left": "cảm biến tiếp xúc trái",
"robotis_cm_spring_right": "cảm biến tiếp xúc phải",
@@ -5429,12 +5432,17 @@ Lang.Helper = {
"robotis_openCM70_cm_sound_detected_clear": "Số cuối cùng phát hiện âm thanh ",
"robotis_openCM70_cm_led": "Bật hoặc tắt đèn LED màu đỏ, màu xanh lá cây, màu xanh dương của thiết bị.",
"robotis_openCM70_cm_motion": "Thực hiện chuyển động tải về thiết bị. ",
- "robotis_openCM70_aux_motor_speed": "Thiết lập tốc độ của động cơ giảm tốc với giá trị 0-1023.",
+ "robotis_openCM70_cm_autodrive_motor": "Chỉ định cổng động cơ của ô tô lái tự động.",
+ "robotis_openCM70_cm_autodrive_ir": "Chỉ định cổng cảm biến hồng ngoại của xe lái tự động.",
+ "robotis_openCM70_cm_autodrive_speed": "Lái xe tự động được thực hiện ở tốc độ quy định dọc theo làn đường.",
+ "robotis_openCM70_aux_car_move": "Làm cho robot di chuyển với tốc độ và hướng xác định.",
+ "robotis_openCM70_aux_motor_speed": "Thiết lập tốc độ của động cơ giảm tốc với giá trị 0-100%.",
"robotis_openCM70_aux_servo_mode": "Thiết lập động cơ servo như chế độ bánh xe hoặc chế độ chung.
Các chế độ tương tự vẫn tiếp tục áp dụng một khi đã cài đặt.
Chế độ bánh xe chỉ định tốc độ động cơ servo, và quay động cơ servo.
Chọn chế độ di chuyển vị trí của động cơ servo và tốc độ động cơ servo.",
- "robotis_openCM70_aux_servo_speed": "Cài đặt tốc độ của động cơ servo với giá trị từ 0 - 1023. ",
- "robotis_openCM70_aux_servo_position": "Cài đặt vị trí của động cơ servo với giá trị từ 0 - 1023.
Sử dụng như tốc độ động cơ servo",
+ "robotis_openCM70_aux_servo_speed": "Cài đặt tốc độ của động cơ servo với giá trị từ 0 - 100%. ",
+ "robotis_openCM70_aux_servo_position": "Cài đặt vị trí của động cơ servo với giá trị từ -150 - 150 độ.
Sử dụng như tốc độ động cơ servo",
"robotis_openCM70_aux_led_module": "Bật hoặc tắt các mô-đun LED của LED.",
"robotis_openCM70_aux_custom": "Vui lòng tham khảo ROBOTIS e-manual (http://support.robotis.com/ko/) để được giải thích về người sử dụng cảm biến sản xuất.",
+ "robotis_openCM70_cm_poweroff_timer": "Đặt bộ hẹn giờ tự động tắt của bộ điều khiển.
Nếu giao tiếp không diễn ra trong khoảng thời gian đã đặt, bộ điều khiển sẽ tự động tắt.",
"robotis_openCM70_cm_custom_value": "Kiểm tra các giá trị bằng cách nhập trực tiếp địa chỉ bảng điều khiển.
Vui lòng tham khảo ROBOTIS e-manual (http://support.robotis.com/ko/)để được giải thích về bảng điều khiển.",
"robotis_openCM70_cm_custom": "Kiểm tra các giá trị bằng cách nhập trực tiếp địa chỉ bảng điều khiển.
Vui lòng tham khảo ROBOTIS e-manual (http://support.robotis.com/ko/)để được giải thích về bảng điều khiển.",
"show_variable": "Hiển thị giá trị của biến đã chọn trên màn hình.",
@@ -6340,12 +6348,17 @@ Lang.template = {
"robotis_openCM70_cm_sound_detected_clear": "phát bộ điều khiển giai điệu %1 lần %2",
"robotis_openCM70_cm_led": "bộ điều khiển %1 LED %2 %3",
"robotis_openCM70_cm_motion": "mở chuyển động %1 lần",
- "robotis_openCM70_aux_motor_speed": "Thiết lập tốc độ giảm tốc động cơ của %1 tới %2 , và giá trị đầu ra đến %3 %4",
+ "robotis_openCM70_cm_autodrive_motor": "Ô tô lái tự động %1 sử dụng động cơ %2 %3",
+ "robotis_openCM70_cm_autodrive_ir": "Ô tô tự lái %1 sử dụng cảm biến hồng ngoại %2 %3",
+ "robotis_openCM70_cm_autodrive_speed": "Thực hiện lái xe tự trị ở tốc độ %1 %2",
+ "robotis_openCM70_aux_car_move": "Làm cho robot đi %2 với tốc độ %1% %3",
+ "robotis_openCM70_aux_motor_speed": "Thiết lập tốc độ giảm tốc động cơ của %1 tới %2 , và giá trị đầu ra đến %3% %4",
"robotis_openCM70_aux_servo_mode": "Thiết lập chế độ của %1 động cơ servo bằng %2 %3",
- "robotis_openCM70_aux_servo_speed": "Thiết lập tốc độ tốc động cơ servo của %1 tới %2, và giá trị đầu ra đến %3 %4",
- "robotis_openCM70_aux_servo_position": "Thiết lập vị trí của %1 động cơ servo bằng %2 %3",
+ "robotis_openCM70_aux_servo_speed": "Thiết lập tốc độ tốc động cơ servo của %1 tới %2, và giá trị đầu ra đến %3% %4",
+ "robotis_openCM70_aux_servo_position": "Thiết lập vị trí của %1 động cơ servo bằng %2 độ %3",
"robotis_openCM70_aux_led_module": "thiết lập %1 mô-đun LED như %2 %3",
"robotis_openCM70_aux_custom": "thiết lập %1 thiết bị người dùng như %2 %3",
+ "robotis_openCM70_cm_poweroff_timer": "Bộ hẹn giờ tự động tắt bộ điều khiển %1 %2",
"robotis_openCM70_cm_custom": "thiết lập địa chỉ tùy chỉnh ( %1 ) như %2 %3",
"robotis_carCont_sensor_value": "giá trị %1",
"robotis_carCont_cm_led": "%1 LED 4, %2 LED %3",
diff --git a/images/hardware/kaboino.png b/images/hardware/kaboino.png
new file mode 100644
index 0000000000..6ce10925bf
Binary files /dev/null and b/images/hardware/kaboino.png differ
diff --git a/src/playground/blocks/hardware/block_KKMOO.js b/src/playground/blocks/hardware/block_KKMOO.js
index 61f6182c42..452093cbdd 100644
--- a/src/playground/blocks/hardware/block_KKMOO.js
+++ b/src/playground/blocks/hardware/block_KKMOO.js
@@ -20,6 +20,7 @@ Entry.kkmoo = {
{num:12,enable:0,angle:0},{num:13,enable:0,angle:0},{num:14,enable:0,angle:0},
{num:15,enable:0,angle:0},{num:16,enable:0,angle:0},{num:17,enable:0,angle:0}
],
+ runningStart: false,
isMotionRunning: false,
setZero: function() {
for(var i of this.motData){
@@ -34,7 +35,7 @@ Entry.kkmoo.setLanguage = function() {
ko: {
template: {
kkmoo_rotate_motor: '%1번 모터의 각도를 %2도로 회전 %3',
- kkmoo_isPlaying: '동작이 실행중인가?',
+ //kkmoo_isPlaying: '동작이 실행중인가?',
kkmoo_motion_play_basic:'기본 %1번 동작 실행 %2',
kkmoo_motion_play_custom:'커스텀 %1번 동작 실행 %2',
kkmoo_rotate_motor_time: '%1번 모터의 각도를 %2도로 %3밀리초 동안 회전 %4'
@@ -46,7 +47,7 @@ Entry.kkmoo.setLanguage = function() {
en: {
template: {
kkmoo_rotate_motor: 'Rotate motor %1 to %2 degrees %3',
- kkmoo_isPlaying: 'Is motion running?',
+ //kkmoo_isPlaying: 'Is motion running?',
kkmoo_motion_play_basic:'Play basic motion number %1 %2',
kkmoo_motion_play_custom:'Play custom motion number %1 %2',
kkmoo_rotate_motor_time:'Rotate motor %1 to %2 degrees for%3 milliseconds %4'
@@ -60,7 +61,7 @@ Entry.kkmoo.setLanguage = function() {
Entry.kkmoo.blockMenuBlocks = [
'kkmoo_rotate_motor',
- 'kkmoo_isPlaying',
+ //'kkmoo_isPlaying',
'kkmoo_motion_play_basic',
'kkmoo_motion_play_custom',
'kkmoo_rotate_motor_time',
@@ -123,18 +124,29 @@ Entry.kkmoo.getBlocks = function() {
const motnum = script.getField('MOTNUM',script);
const angle = script.getValue('ANGLE',script);
var msg = null;
- if(script.isStart != true){
- script.isStart = true;
- if(angle>=-90 && angle<=90){
- msg={'MOT':motnum,'ANG':angle};
+ delete Entry.hw.sendQueue.msg;
+ Entry.hw.update();
+ if (script.isStart != true) {
+ if (Entry.hw.portData.data == 'true') {
+ return script;
+ }
+ else {
+ script.isStart = true;
+ if (angle >= -90 && angle <= 90) {
+ msg = { 'MOT': motnum, 'ANG': angle };
+ }
+ Entry.hw.sendQueue.msg = { 'prot': prot, 'data': msg };
+ return script;
}
- Entry.hw.sendQueue.msg = {'prot':prot,'data':msg};
- return script;
}
- else{
- delete script.isStart;
- delete Entry.hw.sendQueue.msg
- return script.callReturn();
+ else {
+ if(Entry.hw.portData.data == 'true'){
+ delete script.isStart;
+ return script.callReturn();
+ }
+ else{
+ return script;
+ }
}
@@ -143,7 +155,7 @@ Entry.kkmoo.getBlocks = function() {
},
//syntax: undefined,
},
- kkmoo_isPlaying:{
+ /*kkmoo_isPlaying:{
template: Lang.template.kkmoo_isPlaying,
color: EntryStatic.colorSet.block.default.HARDWARE,
outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
@@ -157,9 +169,10 @@ Entry.kkmoo.getBlocks = function() {
class: 'Basic',
isNotFor: ['kkmoo'],
func: async function(sprite,script){
- const wait = (timeToDelay) => new Promise((resolve) => setTimeout(resolve, timeToDelay))
- await wait(300);
- await Entry.hw.update();
+ //const wait = (timeToDelay) => new Promise((resolve) => setTimeout(resolve, timeToDelay))
+ //await wait(300);
+ //await Entry.hw.update();
+ Entry.hw.update();
if(Entry.hw.portData.data == 'true'){
Entry.kkmoo.isMotionRunning = true;
console.log("true");
@@ -175,54 +188,8 @@ Entry.kkmoo.getBlocks = function() {
console.log("else");
return Entry.kkmoo.isMotionRunning;
}
- /*console.log(Entry.hw.portData.data);
- console.log(Entry.kkmoo.isReceive);
- if(Entry.kkmoo.isReceive == 2)
- {
- if(Entry.hw.portData.data == "true")
- {
- Entry.kkmoo.isReceive = 1;
- }
- // else if(Entry.hw.portData.data == "false")
- // {
- // Entry.kkmoo.isReceive = 0;
- // }
- }
- else
- {
- if(Entry.hw.portData.data == "true")
- {
- Entry.kkmoo.isReceive = 1;
- }
- else if(Entry.hw.portData.data == "false")
- {
- Entry.kkmoo.isReceive = 0;
- }
- }
-
- if(Entry.kkmoo.isReceive == 0)
- {
- console.log(Entry.kkmoo.isReceive);
- return false;
- }
- else if(Entry.kkmoo.isReceive == 1)
- {
- console.log(Entry.kkmoo.isReceive);
- return true;
- }
- else
- {
- console.log(Entry.kkmoo.isReceive);
- return true;
- }*/
-
-
- // console.log(Entry.kkmoo.isReceive);
- // console.log("------------------");
-
- // return Entry.kkmoo.isReceive;
}
- },
+ },*/
kkmoo_motion_play_basic: {
template: Lang.template.kkmoo_motion_play_basic,
color: EntryStatic.colorSet.block.default.HARDWARE,
@@ -258,20 +225,30 @@ Entry.kkmoo.getBlocks = function() {
class: 'Basic',
isNotFor: ['kkmoo'],
func: function(sprite, script) {
- console.log("motionPlay");
const prot = "PM"
const motionnum = script.getValue('MOTIONNUM',script);
var msg = motionnum;
- if(script.isStart != true){
- script.isStart = true;
- Entry.hw.sendQueue.msg = {'prot':prot,'data':msg};
- return script;
+ delete Entry.hw.sendQueue.msg;
+ Entry.hw.update();
+ if (script.isStart != true) {
+ if (Entry.hw.portData.data == 'true') {
+ return script;
+ }
+ else {
+ script.isStart = true;
+ Entry.hw.sendQueue.msg = {'prot':prot,'data':msg};
+ return script;
+ }
+ }
+ else {
+ if(Entry.hw.portData.data == 'true'){
+ delete script.isStart;
+ return script.callReturn();
+ }
+ else{
+ return script;
+ }
}
- else{
- delete script.isStart;
- delete Entry.hw.sendQueue.msg;
- return script.callReturn();
- }
},
//syntax: undefined,
},
@@ -310,21 +287,30 @@ Entry.kkmoo.getBlocks = function() {
class: 'Basic',
isNotFor: ['kkmoo'],
func: function(sprite, script) {
- console.log("motionPlay");
const prot = "CM"
const motionnum = script.getValue('MOTIONNUM',script);
var msg = motionnum;
- if(script.isStart != true){
- setTimeout(()=>{script.isStart = true;},100)
-
- Entry.hw.sendQueue.msg = {'prot':prot,'data':msg};
- return script;
+ delete Entry.hw.sendQueue.msg;
+ Entry.hw.update();
+ if (script.isStart != true) {
+ if (Entry.hw.portData.data == 'true') {
+ return script;
+ }
+ else {
+ script.isStart = true;
+ Entry.hw.sendQueue.msg = {'prot':prot,'data':msg};
+ return script;
+ }
+ }
+ else {
+ if(Entry.hw.portData.data == 'true'){
+ delete script.isStart;
+ return script.callReturn();
+ }
+ else{
+ return script;
+ }
}
- else{
- delete script.isStart;
- delete Entry.hw.sendQueue.msg;
- return script.callReturn();
- }
},
//syntax: undefined,
},
@@ -394,22 +380,30 @@ Entry.kkmoo.getBlocks = function() {
const angle = script.getValue('ANGLE',script);
const time = script.getValue('TIME',script);
var msg = null;
- if(script.isStart != true){
- script.isStart = true;
- //Entry.kkmoo.isReceive = 2;
- if(angle>=-90 && angle<=90){
- msg={'MOT':motnum,'ANG':angle,"TME":time};
+ delete Entry.hw.sendQueue.msg;
+ Entry.hw.update();
+ if (script.isStart != true) {
+ if (Entry.hw.portData.data == 'true') {
+ return script;
+ }
+ else {
+ script.isStart = true;
+ if(angle>=-90 && angle<=90){
+ msg={'MOT':motnum,'ANG':angle,"TME":time};
+ }
+ Entry.hw.sendQueue.msg = {'prot':prot,'data':msg};
+ return script;
}
- Entry.hw.sendQueue.msg = {'prot':prot,'data':msg};
- return script;
- }
- else{
- delete script.isStart;
- delete Entry.hw.sendQueue.msg
- return script.callReturn();
}
-
-
+ else {
+ if(Entry.hw.portData.data == 'true'){
+ delete script.isStart;
+ return script.callReturn();
+ }
+ else{
+ return script;
+ }
+ }
//return null;
//return script.callReturn();
},
diff --git a/src/playground/blocks/hardware/block_bridge.js b/src/playground/blocks/hardware/block_bridge.js
new file mode 100644
index 0000000000..7f39ed451a
--- /dev/null
+++ b/src/playground/blocks/hardware/block_bridge.js
@@ -0,0 +1,720 @@
+'use strict';
+
+Entry.Bridge = {
+ id: '55.1',
+ name: 'Bridge',
+ imageName: 'bridge.png',
+ title: {
+ ko: '브릿지',
+ en: 'Bridge',
+ },
+ setZero() {
+ if (!Entry.hw.sendQueue.SET) {
+ Entry.hw.sendQueue = {
+ GET: {},
+ SET: {},
+ };
+ } else {
+ const keySet = Object.keys(Entry.hw.sendQueue.SET);
+ keySet.forEach((key) => {
+ Entry.hw.sendQueue.SET[key].data = 0;
+ Entry.hw.sendQueue.SET[key].time = new Date().getTime();
+ });
+ }
+ Entry.hw.update();
+ },
+ sensorTypes: {
+ DIGITAL: 1,
+ },
+ BlockState: {},
+};
+
+Entry.Bridge.setLanguage = function() {
+ return {
+ ko: {
+ template: {
+ bridge_get_digital1: ' 도 누름 ',
+ bridge_get_digital2: ' 레 누름 ',
+ bridge_get_digital3: ' 미 누름 ',
+ bridge_get_digital4: ' 파 누름 ',
+ bridge_get_digital5: ' 솔 누름 ',
+ bridge_get_digital6: ' 라 누름 ',
+ bridge_get_digital7: ' 시 누름 ',
+ bridge_get_digital8: ' 윗 도 누름 ',
+ bridge_get_digital9: ' 도# 누름 ',
+ bridge_get_digital10: ' 레# 누름 ',
+ bridge_get_digital11: ' 파# 누름 ',
+ bridge_get_digital12: ' 솔# 누름 ',
+ bridge_get_digital13: ' 라# 누름 ',
+ },
+ },
+ };
+};
+
+Entry.Bridge.blockMenuBlocks = [
+ 'bridge_get_digital1',
+ 'bridge_get_digital2',
+ 'bridge_get_digital3',
+ 'bridge_get_digital4',
+ 'bridge_get_digital5',
+ 'bridge_get_digital6',
+ 'bridge_get_digital7',
+ 'bridge_get_digital8',
+ 'bridge_get_digital9',
+ 'bridge_get_digital10',
+ 'bridge_get_digital11',
+ 'bridge_get_digital12',
+ 'bridge_get_digital13',
+];
+
+Entry.Bridge.getBlocks = function() {
+ return {
+ bridge_get_digital1: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_boolean_field',
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ ],
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'BridgeGet',
+ isNotFor: ['Bridge'],
+ func(sprite, script) {
+ const { hwModule = {} } = Entry.hw;
+ const { name } = hwModule;
+ if (name === 'Bridge' || name === 'ArduinoNano') {
+ const port = 0;
+ const DIGITAL = Entry.hw.portData.DIGITAL;
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Bridge.sensorTypes.DIGITAL] = {
+ port,
+ time: new Date().getTime(),
+ };
+ return DIGITAL ? DIGITAL[port] || 0 : 0;
+ }
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Arduino.digitalRead(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+
+ bridge_get_digital2: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_boolean_field',
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ ],
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'BridgeGet',
+ isNotFor: ['Bridge'],
+ func(sprite, script) {
+ const { hwModule = {} } = Entry.hw;
+ const { name } = hwModule;
+ if (name === 'Bridge' || name === 'ArduinoNano') {
+ const port = 1;
+ const DIGITAL = Entry.hw.portData.DIGITAL;
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Bridge.sensorTypes.DIGITAL] = {
+ port,
+ time: new Date().getTime(),
+ };
+ return DIGITAL ? DIGITAL[port] || 0 : 0;
+ }
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Arduino.digitalRead(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+
+ bridge_get_digital3: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_boolean_field',
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ ],
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'BridgeGet',
+ isNotFor: ['Bridge'],
+ func(sprite, script) {
+ const { hwModule = {} } = Entry.hw;
+ const { name } = hwModule;
+ if (name === 'Bridge' || name === 'ArduinoNano') {
+ const port = 2;
+ const DIGITAL = Entry.hw.portData.DIGITAL;
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Bridge.sensorTypes.DIGITAL] = {
+ port,
+ time: new Date().getTime(),
+ };
+ return DIGITAL ? DIGITAL[port] || 0 : 0;
+ }
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Arduino.digitalRead(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+
+ bridge_get_digital4: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_boolean_field',
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ ],
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'BridgeGet',
+ isNotFor: ['Bridge'],
+ func(sprite, script) {
+ const { hwModule = {} } = Entry.hw;
+ const { name } = hwModule;
+ if (name === 'Bridge' || name === 'ArduinoNano') {
+ const port = 3;
+ const DIGITAL = Entry.hw.portData.DIGITAL;
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Bridge.sensorTypes.DIGITAL] = {
+ port,
+ time: new Date().getTime(),
+ };
+ return DIGITAL ? DIGITAL[port] || 0 : 0;
+ }
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Arduino.digitalRead(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+
+ bridge_get_digital5: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_boolean_field',
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ ],
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'BridgeGet',
+ isNotFor: ['Bridge'],
+ func(sprite, script) {
+ const { hwModule = {} } = Entry.hw;
+ const { name } = hwModule;
+ if (name === 'Bridge' || name === 'ArduinoNano') {
+ const port = 4;
+ const DIGITAL = Entry.hw.portData.DIGITAL;
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Bridge.sensorTypes.DIGITAL] = {
+ port,
+ time: new Date().getTime(),
+ };
+ return DIGITAL ? DIGITAL[port] || 0 : 0;
+ }
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Arduino.digitalRead(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+
+ bridge_get_digital6: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_boolean_field',
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ ],
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'BridgeGet',
+ isNotFor: ['Bridge'],
+ func(sprite, script) {
+ const { hwModule = {} } = Entry.hw;
+ const { name } = hwModule;
+ if (name === 'Bridge' || name === 'ArduinoNano') {
+ const port = 5;
+ const DIGITAL = Entry.hw.portData.DIGITAL;
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Bridge.sensorTypes.DIGITAL] = {
+ port,
+ time: new Date().getTime(),
+ };
+ return DIGITAL ? DIGITAL[port] || 0 : 0;
+ }
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Arduino.digitalRead(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+
+ bridge_get_digital7: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_boolean_field',
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ ],
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'BridgeGet',
+ isNotFor: ['Bridge'],
+ func(sprite, script) {
+ const { hwModule = {} } = Entry.hw;
+ const { name } = hwModule;
+ if (name === 'Bridge' || name === 'ArduinoNano') {
+ const port = 6;
+ const DIGITAL = Entry.hw.portData.DIGITAL;
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Bridge.sensorTypes.DIGITAL] = {
+ port,
+ time: new Date().getTime(),
+ };
+ return DIGITAL ? DIGITAL[port] || 0 : 0;
+ }
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Arduino.digitalRead(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+
+ bridge_get_digital8: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_boolean_field',
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ ],
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'BridgeGet',
+ isNotFor: ['Bridge'],
+ func(sprite, script) {
+ const { hwModule = {} } = Entry.hw;
+ const { name } = hwModule;
+ if (name === 'Bridge' || name === 'ArduinoNano') {
+ const port = 7;
+ const DIGITAL = Entry.hw.portData.DIGITAL;
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Bridge.sensorTypes.DIGITAL] = {
+ port,
+ time: new Date().getTime(),
+ };
+ return DIGITAL ? DIGITAL[port] || 0 : 0;
+ }
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Arduino.digitalRead(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+
+ bridge_get_digital9: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_boolean_field',
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ ],
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'BridgeGet',
+ isNotFor: ['Bridge'],
+ func(sprite, script) {
+ const { hwModule = {} } = Entry.hw;
+ const { name } = hwModule;
+ if (name === 'Bridge' || name === 'ArduinoNano') {
+ const port = 8;
+ const DIGITAL = Entry.hw.portData.DIGITAL;
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Bridge.sensorTypes.DIGITAL] = {
+ port,
+ time: new Date().getTime(),
+ };
+ return DIGITAL ? DIGITAL[port] || 0 : 0;
+ }
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Arduino.digitalRead(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+ bridge_get_digital10: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_boolean_field',
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ ],
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'BridgeGet',
+ isNotFor: ['Bridge'],
+ func(sprite, script) {
+ const { hwModule = {} } = Entry.hw;
+ const { name } = hwModule;
+ if (name === 'Bridge' || name === 'ArduinoNano') {
+ const port = 9;
+ const DIGITAL = Entry.hw.portData.DIGITAL;
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Bridge.sensorTypes.DIGITAL] = {
+ port,
+ time: new Date().getTime(),
+ };
+ return DIGITAL ? DIGITAL[port] || 0 : 0;
+ }
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Arduino.digitalRead(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+ bridge_get_digital11: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_boolean_field',
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ ],
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'BridgeGet',
+ isNotFor: ['Bridge'],
+ func(sprite, script) {
+ const { hwModule = {} } = Entry.hw;
+ const { name } = hwModule;
+ if (name === 'Bridge' || name === 'ArduinoNano') {
+ const port = 10;
+ const DIGITAL = Entry.hw.portData.DIGITAL;
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Bridge.sensorTypes.DIGITAL] = {
+ port,
+ time: new Date().getTime(),
+ };
+ return DIGITAL ? DIGITAL[port] || 0 : 0;
+ }
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Arduino.digitalRead(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+ bridge_get_digital12: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_boolean_field',
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ ],
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'BridgeGet',
+ isNotFor: ['Bridge'],
+ func(sprite, script) {
+ const { hwModule = {} } = Entry.hw;
+ const { name } = hwModule;
+ if (name === 'Bridge' || name === 'ArduinoNano') {
+ const port = 11;
+ const DIGITAL = Entry.hw.portData.DIGITAL;
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Bridge.sensorTypes.DIGITAL] = {
+ port,
+ time: new Date().getTime(),
+ };
+ return DIGITAL ? DIGITAL[port] || 0 : 0;
+ }
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Arduino.digitalRead(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+ bridge_get_digital13: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_boolean_field',
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ ],
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'BridgeGet',
+ isNotFor: ['Bridge'],
+ func(sprite, script) {
+ const { hwModule = {} } = Entry.hw;
+ const { name } = hwModule;
+ if (name === 'Bridge' || name === 'ArduinoNano') {
+ const port = 12;
+ const DIGITAL = Entry.hw.portData.DIGITAL;
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Bridge.sensorTypes.DIGITAL] = {
+ port,
+ time: new Date().getTime(),
+ };
+ return DIGITAL ? DIGITAL[port] || 0 : 0;
+ }
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Arduino.digitalRead(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+ };
+};
+
+module.exports = Entry.Bridge;
diff --git a/src/playground/blocks/hardware/block_dalgona.js b/src/playground/blocks/hardware/block_dalgona.js
index 28e6430187..74d686c260 100644
--- a/src/playground/blocks/hardware/block_dalgona.js
+++ b/src/playground/blocks/hardware/block_dalgona.js
@@ -99,6 +99,9 @@ Entry.Dalgona = {
GYROY: 56,
GYROZ: 57,
PULLUP: 58,
+ // FNDINIT: 59,
+ // NEOINIT: 59,
+ // NEOCOLOR: 60,
},
toneTable: {
'0': 0,
@@ -155,6 +158,20 @@ Entry.Dalgona.setLanguage = function() {
return {
ko: {
template: {
+ // set_neopixelinit: '디지털 %1 번 핀에 연결된 %2 개의 네오픽셀 LED 사용하기 %3',
+ // set_neopixel: '디지털 %1 번 핀에 연결된 %2 번째 네오픽셀 LED를 R: %3 , G: %4 , B: %5 색으로 켜기 %6',
+
+ // FND_event: 'FND 4digit (TM1637)- CLK:D5, DIO:D4',
+ // FND_Control_init: 'FND %1 번 : 디지털 CLK %2, DIO %3 번 핀으로 설정',
+ // FND_Control_diplay_brightness: 'FND %1 번 : 밝기 %2 단계로 설정',
+ // FND_Control_display_onoff: 'FND %1 번 : 전원 %2',
+ // FND_Control_diplay_char:
+ // 'FND %1 번 : %2 출력하기:나머지0채우기 %3 %4 초 대기',
+
+
+
+
+
dalgona_digital_title:'달고나 디지털 블럭',
dalgona_analog_title:'달고나 아날로그 블럭',
dalgona_pwm_title:'달고나 PWM 블럭',
@@ -255,6 +272,18 @@ Entry.Dalgona.setLanguage = function() {
},
en: {
template: {
+ // FND_event: 'FND 4digit (TM1637)- CLK:D5, DIO:D4',
+ // FND_Control_init: 'FND %1 번 : 디지털 CLK %2, DIO %3 번 핀으로 설정',
+ // FND_Control_diplay_brightness: 'FND %1 번 : 밝기 %2 단계로 설정',
+ // FND_Control_display_onoff: 'FND %1 번 : 전원 %2',
+ // FND_Control_diplay_char:
+ // 'FND %1 번 : %2 출력하기:나머지0채우기 %3 %4 초 대기',
+
+
+
+ set_neopixelinit: '디지털 %1 번 핀에 연결된 %2 개의 네오픽셀 LED 사용하기 %3',
+ set_neopixel: '디지털 %1 번 핀에 연결된 %2 번째 네오픽셀 LED를 R: %3 , G: %4 , B: %5 색으로 켜기 %6',
+
dalgona_digital_title:'달고나 디지털 블럭',
dalgona_analog_title:'달고나 아날로그 블럭',
dalgona_pwm_title:'달고나 PWM 블럭',
@@ -342,6 +371,12 @@ Entry.Dalgona.setLanguage = function() {
};
};
Entry.Dalgona.blockMenuBlocks = [
+
+ // 'FND_event',
+ // 'FND_Control_diplay_brightness',
+ // 'FND_Control_display_onoff',
+ // 'FND_Control_diplay_char',
+
'dalgona_digital_title',
'dalgona_set_digital_toggle',
'dalgona_get_digital',
@@ -446,7 +481,7 @@ Entry.Dalgona.getBlocks = function() {
var tx;
var din;
// var clk;
- // var cs;
+ // var cs;
var dout;
var sck;
var joyx, joyy, joyz;
@@ -461,6 +496,328 @@ Entry.Dalgona.getBlocks = function() {
var num = 0;
return {
+
+ // FND_Control_init: {
+ // color: EntryStatic.colorSet.block.default.HARDWARE,
+ // outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ // fontColor: '#fff',
+ // skeleton: 'basic',
+ // statements: [],
+ // params: [
+ // {
+ // type: 'Dropdown',
+ // options: [['1', 1]],
+ // value: 1,
+ // fontSize: 11,
+ // bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ // arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ // },
+ // {
+ // type: 'Dropdown',
+ // options: [['5', 5]],
+ // value: 5,
+ // fontSize: 11,
+ // bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ // arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ // },
+ // {
+ // type: 'Dropdown',
+ // options: [['4', 4]],
+ // value: 4,
+ // fontSize: 11,
+ // bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ // arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ // },
+ // ],
+ // def: { params: [], type: 'FND_Control_init' },
+ // paramsKeyMap: { fnd_device: 0, CLK: 1, DIO: 2 },
+ // class: 'other',
+ // isNotFor: ['Dalgona'],
+ // func(sprite, script) {
+ // const device = script.getNumberValue('fnd_device', script);
+ // const clk_val = script.getNumberValue('CLK', script);
+ // const dio_val = script.getNumberValue('DIO', script);
+
+ // // index number patched by Remoted 2020-11-20
+ // if (!Entry.hw.sendQueue.SET) {
+ // Entry.hw.sendQueue.SET = {};
+ // }
+ // // FND_Init type data protocol defined
+ // Entry.hw.sendQueue.SET[device] = {
+ // type: Entry.Dalgona.sensorTypes.FNDINIT,
+ // data: {
+ // clk_pin: clk_val,
+ // dio_pin: dio_val,
+ // },
+ // time: new Date().getTime(),
+ // };
+
+ // return script.callReturn();
+ // },
+ // syntax: { js: [], py: ['RichShield_FND_init(%1, %2)'] },
+ // },
+ // FND_Control_diplay_brightness: {
+ // color: EntryStatic.colorSet.block.default.HARDWARE,
+ // outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ // fontColor: '#fff',
+ // skeleton: 'basic',
+ // statements: [],
+ // params: [
+ // {
+ // type: 'Dropdown',
+ // options: [['1', 1]],
+ // value: 1,
+ // fontSize: 11,
+ // bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ // arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ // },
+ // {
+ // type: 'Dropdown',
+ // options: [
+ // ['1', 1],
+ // ['2', 2],
+ // ['3', 3],
+ // ['4', 4],
+ // ['5', 5],
+ // ['6', 6],
+ // ['7', 7],
+ // ],
+ // value: 3,
+ // fontSize: 11,
+ // bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ // arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ // },
+ // ],
+ // def: { params: [], type: 'FND_Control_diplay_brightness' },
+ // paramsKeyMap: { fnd_device: 0, level: 1 },
+ // class: 'other',
+ // isNotFor: ['Dalgona'],
+ // func(sprite, script) {
+ // const device = script.getNumberValue('fnd_device', script);
+ // const level_val = script.getNumberValue('level', script);
+
+ // if (!script.isStart) {
+ // // index number patched by Remoted 2020-11-20
+ // if (!Entry.hw.sendQueue.SET) {
+ // Entry.hw.sendQueue.SET = {};
+ // }
+
+
+ // script.isStart = true;
+ // script.timeFlag = 1;
+ // const fps = Entry.FPS || 60;
+ // const timeValue = (60 / fps) * 50;
+
+ // // FND_Init type data protocol defined
+ // Entry.hw.sendQueue.SET[device] = {
+ // type: Entry.Dalgona.sensorTypes.FNDINIT,
+ // data: {
+ // level_val,
+ // block_index: 1,
+ // },
+ // time: new Date().getTime(),
+ // };
+ // setTimeout(() => {
+ // script.timeFlag = 0;
+ // }, timeValue);
+ // return script;
+ // } else if (script.timeFlag == 1) {
+ // return script;
+ // } else {
+ // delete script.timeFlag;
+ // delete script.isStart;
+ // Entry.engine.isContinue = false;
+ // return script.callReturn();
+ // }
+ // },
+ // syntax: { js: [], py: ['RichShield_FND_Control_diplay_brightness(%1, %2)'] },
+ // },
+ // FND_Control_display_onoff: {
+ // color: EntryStatic.colorSet.block.default.HARDWARE,
+ // outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ // fontColor: '#fff',
+ // skeleton: 'basic',
+ // statements: [],
+ // params: [
+ // {
+ // type: 'Dropdown',
+ // options: [['1', 1]],
+ // value: 1,
+ // fontSize: 11,
+ // bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ // arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ // },
+ // {
+ // type: 'Dropdown',
+ // options: [
+ // [Lang.Blocks.RichShield_toggle_off, 0],
+ // [Lang.Blocks.RichShield_toggle_on, 1],
+ // ],
+ // value: 1,
+ // fontSize: 11,
+ // bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ // arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ // },
+ // ],
+ // def: { params: [], type: 'FND_Control_display_onoff' },
+ // paramsKeyMap: { fnd_device: 0, onoff: 1 },
+ // class: 'other',
+ // isNotFor: ['Dalgona'],
+ // func(sprite, script) {
+ // const device = script.getNumberValue('fnd_device', script);
+ // const onoff = script.getNumberValue('onoff', script);
+
+ // if (!script.isStart) {
+ // // index number patched by Remoted 2020-11-20
+ // if (!Entry.hw.sendQueue.SET) {
+ // Entry.hw.sendQueue.SET = {};
+ // }
+
+ // script.isStart = true;
+ // script.timeFlag = 1;
+ // const fps = Entry.FPS || 60;
+ // const timeValue = (60 / fps) * 50;
+
+ // // FND_Init type data protocol defined
+ // Entry.hw.sendQueue.SET[device] = {
+ // type: Entry.Dalgona.sensorTypes.FNDINIT,
+ // data: {
+ // onoff,
+ // block_index: 2,
+ // },
+ // time: new Date().getTime(),
+ // };
+
+ // setTimeout(() => {
+ // script.timeFlag = 0;
+ // }, timeValue);
+ // return script;
+ // } else if (script.timeFlag == 1) {
+ // return script;
+ // } else {
+ // delete script.timeFlag;
+ // delete script.isStart;
+ // Entry.engine.isContinue = false;
+ // return script.callReturn();
+ // }
+
+ // },
+ // syntax: { js: [], py: ['RichShield_FND_Control_display_onoff(%1, %2)'] },
+ // },
+ // FND_Control_diplay_char: {
+ // color: EntryStatic.colorSet.block.default.HARDWARE,
+ // outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ // fontColor: '#fff',
+ // skeleton: 'basic',
+ // statements: [],
+ // params: [
+ // {
+ // type: 'Dropdown',
+ // options: [['1', 1]],
+ // value: 1,
+ // fontSize: 11,
+ // bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ // arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ // },
+ // {
+ // type: 'Block',
+ // accept: 'string',
+ // },
+ // {
+ // type: 'Dropdown',
+ // options: [
+ // [Lang.Blocks.RichShield_toggle_off, 0],
+ // [Lang.Blocks.RichShield_toggle_on, 1],
+ // ],
+ // value: 0,
+ // fontSize: 11,
+ // bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ // arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ // },
+ // {
+ // type: 'Block',
+ // accept: 'string',
+ // },
+ // ],
+ // events: {},
+ // def: {
+ // params: [
+ // '1',
+ // {
+ // type: 'number',
+ // params: ['1234'],
+ // },
+ // '0',
+ // {
+ // type: 'number',
+ // params: ['0.1'],
+ // },
+ // ],
+ // type: 'FND_Control_diplay_char',
+ // },
+ // events: {},
+ // paramsKeyMap: { fnd_device: 0, display_value: 1, onoff: 2, delay_ms: 3 },
+ // class: 'other',
+ // isNotFor: ['Dalgona'],
+ // func(sprite, script) {
+ // const device = script.getNumberValue('fnd_device', script);
+ // const display_str = script.getNumberValue('display_value', script);
+ // const onoff = script.getNumberValue('onoff', script);
+ // const delay_ms_sec = script.getNumberValue('delay_ms', script);
+ // const splited_array = [];
+ // let display_str_converted = 0;
+
+ // if (!script.isStart) {
+ // if (!Entry.hw.sendQueue.SET) {
+ // Entry.hw.sendQueue.SET = {};
+ // }
+
+ // display_str_converted = display_str.toString();
+
+ // script.isStart = true;
+ // script.timeFlag = 1;
+ // const fps = Entry.FPS || 60;
+ // const timeValue = (60 / fps) * 100;
+
+ // for (let i = 0; i < display_str_converted.length; i++) {
+ // splited_array.push(parseInt(display_str_converted.charAt(i)));
+ // }
+
+ // console.log(`splited_array :${splited_array}`);
+
+ // // FND_Init type data protocol defined
+ // Entry.hw.sendQueue.SET[device] = {
+ // type: Entry.Dalgona.sensorTypes.FNDINIT,
+ // data: {
+ // display_str,
+ // onoff,
+ // block_index: 3,
+ // str_length: display_str_converted.length,
+ // data_0: splited_array[0],
+ // data_1: splited_array[1],
+ // data_2: splited_array[2],
+ // data_3: splited_array[3],
+ // delay_ms: delay_ms_sec,
+ // },
+ // time: new Date().getTime(),
+ // };
+
+
+ // setTimeout(() => {
+ // script.timeFlag = 0;
+ // }, timeValue);
+ // return script;
+ // } else if (script.timeFlag == 1) {
+ // return script;
+ // } else {
+ // delete script.timeFlag;
+ // delete script.isStart;
+ // Entry.engine.isContinue = false;
+ // return script.callReturn();
+ // }
+ // },
+ // syntax: { js: [], py: ['RichShield_FND_Control_diplay_char(%1, %2, %3, %4)'] },
+ // },
dalgona_digital_title: {
skeleton: 'basic_text',
skeletonOptions: {
diff --git a/src/playground/blocks/hardware/block_kaboino.js b/src/playground/blocks/hardware/block_kaboino.js
new file mode 100644
index 0000000000..15e2909219
--- /dev/null
+++ b/src/playground/blocks/hardware/block_kaboino.js
@@ -0,0 +1,2841 @@
+'use strict';
+
+let last_wheel_left_speed = 0;
+let last_wheel_right_speed = 0;
+let last_line1_string = ' ';
+let last_line2_string = ' ';
+let last_line3_string = ' ';
+let last_line4_string = ' ';
+let last_line5_string = ' ';
+let last_line6_string = ' ';
+let lcd_clear = 'cleared';
+
+Entry.Kaboino = {
+ id: '56.1',
+ name: 'Kaboino',
+ url: 'http://www.kabotel.com/',
+ imageName: 'kaboino.png',
+ title: {
+ ko: '카보이노',
+ en: 'Kaboino',
+ },
+ setZero() {
+ last_line1_string = ' ';
+ last_line2_string = ' ';
+ last_line3_string = ' ';
+ last_line4_string = ' ';
+ last_line5_string = ' ';
+ last_line6_string = ' ';
+ last_wheel_left_speed = 0;
+ last_wheel_right_speed = 0;
+ if (!Entry.hw.sendQueue.SET) {
+ Entry.hw.sendQueue = {
+ GET: {},
+ SET: {},
+ };
+ }
+ else {
+ const keySet = Object.keys(Entry.hw.sendQueue.SET);
+ keySet.forEach((key) => {
+ if ((key == Entry.Kaboino.PORT_MAP.SET_BODY_SPEED_TURN_PORT) ||
+ (key == Entry.Kaboino.PORT_MAP.SET_BODY_WHEEL_SPIN_PORT) ||
+ (key == Entry.Kaboino.PORT_MAP.SET_WHEEL_SPEED_PORT)) {
+ Entry.hw.sendQueue.SET[key].data = [0, 0];
+ }
+ else if((key == Entry.Kaboino.PORT_MAP.SET_ULTRASONIC_ANGLE_PORT) ||
+ (key == Entry.Kaboino.PORT_MAP.SET_ROBOT_ARM_ROTATOR_PORT) ||
+ (key == Entry.Kaboino.PORT_MAP.SET_ROBOT_ARM_RAISER_PORT)) {
+ Entry.hw.sendQueue.SET[key].data = 90;
+ }
+ else if(key == Entry.Kaboino.PORT_MAP.SET_ROBOT_ARM_PUSHER_PORT) {
+ Entry.hw.sendQueue.SET[key].data = 110;
+ }
+ else {
+ Entry.hw.sendQueue.SET[key].data = 0;
+ }
+ Entry.hw.sendQueue.SET[key].time = new Date().getTime();
+ });
+ }
+ Entry.hw.update();
+ },
+ sensorTypes: {
+ ALIVE: 0,
+ DIGITAL: 1,
+ ANALOG: 2,
+ PWM: 3,
+ SERVO_PIN: 4,
+ TONE: 5,
+ PULSEIN: 6,
+ ULTRASONIC: 7,
+ TIMER: 8,
+ SET_LGT: 9,
+ SET_TONE: 10,
+ SET_BODY_SPEED_TURN: 11,
+ SET_BODY_WHEEL_SPIN: 12,
+ SET_WHEEL_BALANCE: 13,
+ SET_WHEEL_SPEED: 14,
+ SET_DISPLAY_STRING: 15,
+ SET_DISPLAY_CLEAR: 16,
+ SET_SEARCH_LIGHT:17,
+ GET_DUST_SENSOR: 22,
+ GET_ULTRASONIC_SENSOR: 23,
+ GET_COLOR_SENSOR: 24,
+ GET_SND_SENSOR: 25,
+ SET_BALL_HOLDER: 26,
+ SET_ROBOT_ARM: 28,
+ SET_ULTRASONIC_ANGLE: 29,
+ SET_COLOR_SEN_LED: 30,
+ },
+ PORT_MAP: {
+ GET_IR_BOT_CENTER_PORT: 0,
+ GET_IR_BOT_LEFT_PORT: 1,
+ GET_IR_BOT_RIGHT_PORT: 2,
+ GET_IR_FOR_CENTER_PORT: 3, //0
+ GET_IR_FOR_LEFT_PORT: 4, //1
+ GET_IR_FOR_RIGHT_PORT: 5, //2
+ GET_LIGHT_SENSOR_PORT: 6, //3
+ GET_MID_SENSOR_PORT: 7, //4
+ GET_COLOR_SENSOR_PORT: 8, //5
+ GET_TEMP_SND_SENSOR_PORT: 9, //6
+ GET_HUMIDITY_SENSOR_PORT: 10, //7
+ GET_DUST_ULTRA_SENSOR_PORT: 11, //8
+
+ SET_TONE_PORT: 12,
+ SET_ANY_PORT: 13,
+ SET_CENTER_LGT_PORT: 14,
+ SET_LEFT_LGT_PORT: 15,
+ SET_RIGHT_LGT_PORT: 16,
+ SET_BODY_SPEED_TURN_PORT: 17,
+ SET_BODY_WHEEL_SPIN_PORT: 18,
+ SET_WHEEL_SPEED_PORT: 19,
+ SET_DISPLAY_LINE_PORT: 20,
+ SET_DISPLAY_CLEAR_PORT: 21,
+ SET_SEARCH_LIGHT_PORT: 22,
+ SET_BALL_HOLDER_PORT: 27,
+ SET_ULTRASONIC_ANGLE_PORT: 29,
+ SET_ROBOT_ARM_GRIPPER_PORT: 30,
+ SET_ROBOT_ARM_PUSHER_PORT: 31,
+ SET_ROBOT_ARM_RAISER_PORT: 32,
+ SET_ROBOT_ARM_ROTATOR_PORT: 33,
+ SET_COLOR_LED_PORT: 34,
+ },
+ CONST_VAL: {
+ MAX_SPEED: 126,
+ },
+ MID_VALUE: {
+ BASIC_MODEL: 1,
+ BT_RC_CAR: 2,
+ BALL_HOLDER_CAR: 3,
+ TEMP_HUM_DUST_CAR: 4,
+ ULTRASONIC_CAR: 5,
+ SHOOTING_CAR: 6,
+ ROBOT_ARM_CAR: 8,
+ },
+ toneTable: {
+ '0': 0,
+ C: 1,
+ CS: 2,
+ D: 3,
+ DS: 4,
+ E: 5,
+ F: 6,
+ FS: 7,
+ G: 8,
+ GS: 9,
+ A: 10,
+ AS: 11,
+ B: 12,
+ },
+ toneMap: {
+ '1': [33, 65, 131, 262, 523, 1046, 2093, 4186],
+ '2': [35, 69, 139, 277, 554, 1109, 2217, 4435],
+ '3': [37, 73, 147, 294, 587, 1175, 2349, 4699],
+ '4': [39, 78, 156, 311, 622, 1245, 2849, 4978],
+ '5': [41, 82, 165, 330, 659, 1319, 2637, 5274],
+ '6': [44, 87, 175, 349, 698, 1397, 2794, 5588],
+ '7': [46, 92, 185, 370, 740, 1480, 2960, 5920],
+ '8': [49, 98, 196, 392, 784, 1568, 3136, 6272],
+ '9': [52, 104, 208, 415, 831, 1661, 3322, 6645],
+ '10': [55, 110, 220, 440, 880, 1760, 3520, 7040],
+ '11': [58, 117, 233, 466, 932, 1865, 3729, 7459],
+ '12': [62, 123, 247, 494, 988, 1976, 3951, 7902],
+ },
+ highList: ['high', '1', 'on', 'up'],
+ lowList: ['low', '0', 'off', 'down'],
+ BlockState: {},
+};
+
+Entry.Kaboino.setLanguage = function() {
+ globalThis.isFirstAlertStatement = false;
+ return {
+ ko: {
+ Blocks: {
+ KABOINO_on: '켜기',
+ KABOINO_off: '끄기',
+ KABOINO_front_LED: '전방전조등',
+ KABOINO_left_LED: '왼쪽회전등',
+ KABOINO_right_LED: '오른쪽회전등',
+ KABOINO_front_center_ir_sensor: '중앙 적외선 센서',
+ KABOINO_front_left_ir_sensor: '왼쪽 적외선 센서',
+ KABOINO_front_right_ir_sensor: '오른쪽 적외선 센서',
+ KABOINO_bottom_center_ir_sensor: '중앙 적외선 센서',
+ KABOINO_bottom_left_ir_sensor: '왼쪽 적외선 센서',
+ KABOINO_bottom_right_ir_sensor: '오른쪽 적외선 센서',
+ KABOINO_forward_wheel: '직진',
+ KABOINO_backward_wheel: '후진',
+ KABOINO_turn_right: '우회전',
+ KABOINO_turn_left: '좌회전',
+ KABOINO_spin_right: '우측돌기',
+ KABOINO_spin_left: '좌측돌기',
+ KABOINO_color_white: '흰색',
+ KABOINO_color_red: '빨강',
+ KABOINO_color_green: '녹색',
+ KABOINO_color_blue: '파랑',
+ KABOINO_color_black: '검정',
+ KABOINO_environment_temp_sensor: '온도 센서',
+ KABOINO_environment_humidity_sensor: '습도 센서',
+ KABOINO_up: '올리기',
+ KABOINO_down: '내리기',
+ KABOINO_ultrasonic_angle_center: '정면',
+ KABOINO_ultrasonic_angle_left: '왼쪽',
+ KABOINO_ultrasonic_angle_right: '오른쪽',
+ KABOINO_robot_arm_gripper: '집게',
+ KABOINO_robot_arm_pusher: '내밀기',
+ KABOINO_robot_arm_raiser: '들어올리기',
+ KABOINO_robot_arm_rotator: '회전하기',
+ },
+ template: {
+ kaboino_get_obstacle_sensor_value: '카보이노 장애물 감지 %1 값',
+ kaboino_get_light_sensor_value: '카보이노 빛 감지 센서 값',
+ kaboino_get_color_sensor_value: '카보이노 색상 감지 센서 값',
+ kaboino_get_line_trace_sensor_value: '카보이노 라인 트레이서 감지 %1 값',
+ kaboino_get_analog_value_map: '카보이노 값 범위 조정 %1 를 %2 ~ %3 에서 %4 ~ %5 로 바꾼 값',
+ kaboino_set_light: '카보이노 라이트 %1 을(를) %2 %3',
+ kaboino_set_tone: '카보이노 음소리 %1 옥타브 %2 음으로 %3 초 연주하기 %4',
+ kaboino_set_body_speed_straight: '카보이노 차체 %1 속도 %2 , 회전 %3 속도 %4 로 이동 %5',
+ kaboino_set_wheel_spin: '카보이노 제자리 %1 속도 %2 로 돌기 %3',
+ kaboino_set_wheel_balance: '카보이노 바퀴 균형 방향 %1 속도 %2 로 맞추기 %3',
+ kaboino_set_wheel_speed: '카보이노 좌 바퀴 %1 %2 , 우 바퀴 %3 %4 로 이동 %5',
+ kaboino_set_display: '카보이노 OLED 라인 %1 위치에 %2 표시하기 %3',
+ kaboino_set_display_clear: '카보이노 OLED 화면 지우기 %1',
+ kaboino_get_color_sensor_value: '카보이노 색깔 감지 %1',
+ kaboino_set_color_sensor_led: '카보이노 색깔 감지 LED %1 %2',
+ kaboino_set_search_light: '카보이노 확장 1 서치라이트 %1 %2',
+ kaboino_set_ball_holder: '카보이노 확장 2 볼 홀더 %1 %2',
+ kaboino_get_environmnet_sensor_value: '카보이노 확장 3 환경 감지 %1 값',
+ kaboino_get_dust_sensor_value: '카보이노 확장 3 미세먼지 감지 센서 값',
+ kaboino_get_ultrasonic_value: '카보이노 확장 4 원거리 장애물 감지 센서값',
+ kaboino_set_ultrasonic_angle: '카보이노 확장 4 원거리 장애물 감지 센서 방향 %1 각도 %2 %3',
+ kaboino_get_sound_sensor_value: '카보이노 확장 5 타겟 감지 센서 값',
+ kaboino_set_robot_arm: '카보이노 확장 7 로봇 팔 %1 조정 %2 %3',
+ },
+ },
+ en: {
+ Blocks: {
+ KABOINO_on: 'on',
+ KABOINO_off: 'off',
+ KABOINO_front_LED: 'center LED',
+ KABOINO_left_LED: 'left LED',
+ KABOINO_right_LED: 'right LED',
+ KABOINO_front_center_ir_sensor: 'center ir sensor',
+ KABOINO_front_left_ir_sensor: 'left ir sensor',
+ KABOINO_front_right_ir_sensor: 'right ir sensor',
+ KABOINO_bottom_center_ir_sensor: 'center ir sensor',
+ KABOINO_bottom_left_ir_sensor: 'left ir sensor',
+ KABOINO_bottom_right_ir_sensor: 'right ir sensor',
+ KABOINO_spin_right: 'spin right',
+ KABOINO_spin_left: 'spin left',
+ KABOINO_forward_wheel: 'straight wheel',
+ KABOINO_backward_wheel: 'reverse wheel',
+ KABOINO_turn_right: 'turn right',
+ KABOINO_turn_left: 'turn left',
+ KABOINO_spin_right: 'spin right',
+ KABOINO_spin_left: 'spin left',
+ KABOINO_color_white: 'white',
+ KABOINO_color_red: 'red',
+ KABOINO_color_green: 'green',
+ KABOINO_color_blue: 'blue',
+ KABOINO_color_black: 'black',
+ KABOINO_environment_temp_sensor: 'temperature sensor',
+ KABOINO_environment_humidity_sensor: 'humidity sensor',
+ KABOINO_up: 'up',
+ KABOINO_down: 'down',
+ KABOINO_ultrasonic_angle_center: 'center',
+ KABOINO_ultrasonic_angle_left: 'left',
+ KABOINO_ultrasonic_angle_right: 'right',
+ KABOINO_robot_arm_gripper: 'gripper',
+ KABOINO_robot_arm_pusher: 'pusher',
+ KABOINO_robot_arm_raiser: 'raiser',
+ KABOINO_robot_arm_rotator: 'rotator',
+ },
+ template: {
+ kaboino_get_obstacle_sensor_value: 'Obstacle sensor %1 value',
+ kaboino_get_light_sensor_value: 'Light sensor value',
+ kaboino_get_color_sensor_value: 'Color sensor value',
+ kaboino_get_line_trace_sensor_value: 'Line Trace sensor %1 value',
+ kaboino_get_analog_value_map: 'Map Value %1 %2 ~ %3 to %4 ~ %5',
+ kaboino_set_light: 'Set light %1 as %2 %3',
+ kaboino_set_tone: 'Play tone on note %1 octave %2 beat %3 %4',
+ kaboino_set_body_speed_straight: 'Move Whell straight %1 Speed %2 Turn %3 Speed %4 %5',
+ kaboino_set_wheel_spin: 'Wheel spin direction %1 speed %2 %3',
+ kaboino_set_wheel_balance:'Wheel balance direction %1 speed %2 %3',
+ kaboino_set_wheel_speed: 'Move Left wheel direction %1 Speed %2 Right wheel direction %3 Speed %4 %5',
+ kaboino_set_display: 'Display height %1 string %2 %3',
+ kaboino_set_display_clear: 'Clear display %1',
+ kaboino_get_color_sensor_value: 'Color sensor value %1',
+ kaboino_set_color_sensor_led: 'Set color led light %1 %2',
+ kaboino_set_search_light: 'Extension 1 Set search light %1 %2',
+ kaboino_set_ball_holder: 'Extension 2 Set ball holder %1 %2',
+ kaboino_get_environmnet_sensor_value: 'Extension 3 Environment sensor %1 value',
+ kaboino_get_dust_sensor_value: 'Extension 3 Dust Sensor value',
+ kaboino_get_ultrasonic_value: 'Extension 4 Read ULTRASONIC sensor value',
+ kaboino_set_ultrasonic_angle: 'Extension 4 set ULTRASONIC sensor direction %1 , angle %2 %3',
+ kaboino_get_sound_sensor_value: 'Extension 5 Target sensor value',
+ kaboino_set_robot_arm: 'Extension 7 Robot arm %1 control %2 %3',
+ },
+ },
+ };
+};
+
+Entry.Kaboino.blockMenuBlocks = [
+ 'kaboino_get_obstacle_sensor_value',
+ 'kaboino_get_light_sensor_value',
+ 'kaboino_get_line_trace_sensor_value',
+ 'kaboino_get_analog_value_map',
+ 'kaboino_get_color_sensor_value',
+ 'kaboino_set_light',
+ 'kaboino_set_tone',
+ 'kaboino_set_spin_speed',
+ 'kaboino_set_body_speed_straight',
+ 'kaboino_set_wheel_spin',
+ 'kaboino_set_wheel_balance',
+ 'kaboino_set_wheel_speed',
+ 'kaboino_set_display',
+ 'kaboino_set_display_clear',
+ 'kaboino_get_color_sensor_value',
+ 'kaboino_set_color_sensor_led',
+ 'kaboino_set_search_light',
+ 'kaboino_set_ball_holder',
+ 'kaboino_get_environmnet_sensor_value',
+ 'kaboino_get_dust_sensor_value',
+ 'kaboino_get_ultrasonic_value',
+ 'kaboino_set_ultrasonic_angle',
+ 'kaboino_get_sound_sensor_value',
+ 'kaboino_set_robot_arm',
+];
+
+Entry.Kaboino.getBlocks = function() {
+ return {
+ kaboino_obstacle_sensor_list: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ statements: [],
+ template: '%1',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_front_center_ir_sensor, "frontCenterIR"],
+ [Lang.Blocks.KABOINO_front_left_ir_sensor, "frontLeftIR"],
+ [Lang.Blocks.KABOINO_front_right_ir_sensor, "frontRightIR"],
+ ],
+ value: "frontCenterIR",
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ func(sprite, script) {
+ var port = script.getStringField('PORT', script);
+ return port;
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: '%1',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_front_center_ir_sensor, "frontCenterIR"],
+ [Lang.Blocks.KABOINO_front_left_ir_sensor, "frontLeftIR"],
+ [Lang.Blocks.KABOINO_front_right_ir_sensor, "frontRightIR"],
+ ],
+ value: "frontCenterIR",
+ fontSize: 11,
+ converter: Entry.block.converters.returnStringValue,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ keyOption: 'kaboino_obstacle_sensor_list',
+ },
+ ],
+ },
+ },
+ kaboino_get_obstacle_sensor_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_string_field',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'kaboino_obstacle_sensor_list',
+ },
+ ],
+ type: 'kaboino_get_obstacle_sensor_value',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'KaboinoGet',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ let receivedStringKey = script.getValue('PORT', script);
+ let port = 0;
+ if (receivedStringKey == "frontCenterIR") {
+ port = Entry.Kaboino.PORT_MAP.GET_IR_FOR_CENTER_PORT - 3;
+ }
+ else if (receivedStringKey == "frontLeftIR") {
+ port = Entry.Kaboino.PORT_MAP.GET_IR_FOR_LEFT_PORT - 3;
+ }
+ else if (receivedStringKey == "frontRightIR") {
+ port = Entry.Kaboino.PORT_MAP.GET_IR_FOR_RIGHT_PORT -3;
+ }
+
+ const ANALOG = Entry.hw.portData.ANALOG;
+
+ return String(ANALOG[port]);
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.readObstacleSensor(%1)',
+ },
+ ],
+ },
+ },
+ kaboino_get_light_sensor_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_string_field',
+ statements: [],
+ params: [],
+ events: {},
+ def: {
+ params: [],
+ type: 'kaboino_get_light_sensor_value',
+ },
+ paramsKeyMap: {},
+ class: 'KaboinoGet',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ let port = Entry.Kaboino.PORT_MAP.GET_LIGHT_SENSOR_PORT - 3;
+ const ANALOG = Entry.hw.portData.ANALOG;
+ return String(ANALOG[port]);
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.readLightSensor()',
+ },
+ ],
+ },
+ },
+ kaboino_get_line_trace_sensor_value_list: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ statements: [],
+ template: '%1',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_bottom_center_ir_sensor, "lineCenterIR"],
+ [Lang.Blocks.KABOINO_bottom_left_ir_sensor, "lineLeftIR"],
+ [Lang.Blocks.KABOINO_bottom_right_ir_sensor, "lineRightIR"],
+ ],
+ value: "lineCenterIR",
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ func(sprite, script) {
+ var port = script.getStringField('PORT', script);
+ return port;
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: '%1',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_bottom_center_ir_sensor, "lineCenterIR"],
+ [Lang.Blocks.KABOINO_bottom_left_ir_sensor, "lineLeftIR"],
+ [Lang.Blocks.KABOINO_bottom_right_ir_sensor, "lineRightIR"],
+ ],
+ value: "lineCenterIR",
+ fontSize: 11,
+ converter: Entry.block.converters.returnStringValue,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ keyOption: 'kaboino_get_line_trace_sensor_value_list',
+ },
+ ],
+ },
+ },
+ kaboino_get_line_trace_sensor_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_boolean_field',
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'kaboino_get_line_trace_sensor_value_list',
+ },
+ ],
+ type: 'kaboino_get_line_trace_sensor_value',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'KaboinoGet',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ let receivedStringKey = script.getValue('PORT', script);
+ let port = 0;
+
+ if (receivedStringKey == "lineCenterIR") {
+ port = 0;
+ }
+ else if (receivedStringKey == "lineLeftIR") {
+ port = 1;
+ }
+ else if (receivedStringKey == "lineRightIR") {
+ port = 2;
+ }
+
+ const DIGITAL = Entry.hw.portData.DIGITAL;
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Kaboino.sensorTypes.DIGITAL] = {
+ port,
+ time: new Date().getTime(),
+ };
+
+ return DIGITAL ? DIGITAL[port] || 0 : 0;
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.readLineTraceSensor(%1)',
+ },
+ ],
+ },
+ },
+
+ kaboino_get_analog_value_map: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_string_field',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'kaboino_get_analog_value',
+ params: [
+ {
+ type: 'kaboino_analog_list',
+ },
+ ],
+ },
+ {
+ type: 'number',
+ params: ['0'],
+ },
+ {
+ type: 'number',
+ params: ['1023'],
+ },
+ {
+ type: 'number',
+ params: ['0'],
+ },
+ {
+ type: 'number',
+ params: ['100'],
+ },
+ ],
+ type: 'kaboino_get_analog_value_map',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ VALUE2: 1,
+ VALUE3: 2,
+ VALUE4: 3,
+ VALUE5: 4,
+ },
+ class: 'KaboinoGet',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ let result = script.getValue('PORT', script);
+ const ANALOG = Entry.hw.portData.ANALOG;
+ let value2 = script.getNumberValue('VALUE2', script);
+ let value3 = script.getNumberValue('VALUE3', script);
+ let value4 = script.getNumberValue('VALUE4', script);
+ let value5 = script.getNumberValue('VALUE5', script);
+ const stringValue4 = script.getValue('VALUE4', script);
+ const stringValue5 = script.getValue('VALUE5', script);
+ let isFloat = false;
+
+ if ((Entry.Utils.isNumber(stringValue4) && stringValue4.indexOf('.') > -1) ||
+ (Entry.Utils.isNumber(stringValue5) && stringValue5.indexOf('.') > -1)) {
+ isFloat = true;
+ }
+
+ if (value2 > value3) {
+ var swap = value2;
+ value2 = value3;
+ value3 = swap;
+ }
+ if (value4 > value5) {
+ var swap = value4;
+ value4 = value5;
+ value5 = swap;
+ }
+ result -= value2;
+ result = result * ((value5 - value4) / (value3 - value2));
+ result += value4;
+ result = Math.min(value5, result);
+ result = Math.max(value4, result);
+
+ if (isFloat) {
+ result = Math.round(result * 100) / 100;
+ } else {
+ result = Math.round(result);
+ }
+
+ return result;
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.map(%1, %2, %3, %4, %5)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+ kaboino_light_port_list: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ statements: [],
+ template: '%1',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_front_LED, "centerLED"],
+ [Lang.Blocks.KABOINO_left_LED, "leftLED"],
+ [Lang.Blocks.KABOINO_right_LED, "rightLED"],
+ ],
+ value: "centerLED",
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ func(sprite, script) {
+ var port = script.getStringField('PORT', script);
+ return port;
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: '%1',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_front_LED, "centerLED"],
+ [Lang.Blocks.KABOINO_left_LED, "leftLED"],
+ [Lang.Blocks.KABOINO_right_LED, "rightLED"],
+ ],
+ value: "centerLED",
+ fontSize: 11,
+ converter: Entry.block.converters.returnStringValue,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ keyOption: 'kaboino_light_port_list',
+ },
+ ]
+ },
+ },
+ kaboino_on_off_list: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ statements: [],
+ template: '%1',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_on, 'on'],
+ [Lang.Blocks.KABOINO_off, 'off'],
+ ],
+ value: 'on',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ },
+ paramsKeyMap: {
+ VALUE: 0,
+ },
+ func(sprite, script) {
+ var value = script.getStringField('VALUE', script);
+ return value;
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: '%1',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_on, 'on'],
+ [Lang.Blocks.KABOINO_off, 'off'],
+ ],
+ value: 'on',
+ fontSize: 11,
+ converter: Entry.block.converters.returnStringValue,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ keyOption: 'kaboino_on_off_list',
+ },
+ ]
+ },
+ },
+ kaboino_set_light: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'kaboino_light_port_list',
+ },
+ {
+ type: 'kaboino_on_off_list',
+ },
+ null,
+ ],
+ type: 'kaboino_set_light',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ VALUE: 1,
+ },
+ class: 'KaboinoSet',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ let receivedPortStringKey = script.getValue('PORT', script);
+ let port = 0;
+ if (receivedPortStringKey == "centerLED") {
+ port = Entry.Kaboino.PORT_MAP.SET_CENTER_LGT_PORT;
+ }
+ else if (receivedPortStringKey == "leftLED") {
+ port = Entry.Kaboino.PORT_MAP.SET_LEFT_LGT_PORT;
+ }
+ else if (receivedPortStringKey == "rightLED") {
+ port = Entry.Kaboino.PORT_MAP.SET_RIGHT_LGT_PORT;
+ }
+
+ let receivedValueStringKey = script.getValue('VALUE', script);
+ let value = 0;
+
+ if (receivedValueStringKey == 'on') {
+ value = 0xf;
+ }
+ else if (receivedValueStringKey == 'off') {
+ value = 0;
+ }
+
+ if (!Entry.hw.sendQueue.SET) {
+ Entry.hw.sendQueue.SET = {};
+ }
+ Entry.hw.sendQueue.SET[port] = {
+ type: Entry.Kaboino.sensorTypes.SET_LGT,
+ data: value,
+ time: new Date().getTime(),
+ };
+
+ return script.callReturn();
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.setLight(%1, %2)',
+ },
+ ],
+ },
+ },
+ kaboino_tone_list: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ statements: [],
+ template: '%1',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.silent, '0'],
+ [Lang.Blocks.do_name, 'C'],
+ [Lang.Blocks.do_sharp_name, 'CS'],
+ [Lang.Blocks.re_name, 'D'],
+ [Lang.Blocks.re_sharp_name, 'DS'],
+ [Lang.Blocks.mi_name, 'E'],
+ [Lang.Blocks.fa_name, 'F'],
+ [Lang.Blocks.fa_sharp_name, 'FS'],
+ [Lang.Blocks.sol_name, 'G'],
+ [Lang.Blocks.sol_sharp_name, 'GS'],
+ [Lang.Blocks.la_name, 'A'],
+ [Lang.Blocks.la_sharp_name, 'AS'],
+ [Lang.Blocks.si_name, 'B'],
+ ],
+ value: 'C',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ },
+ paramsKeyMap: {
+ NOTE: 0,
+ },
+ func(sprite, script) {
+ return script.getField('NOTE');
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: '%1',
+ textParams: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.silent, '0'],
+ [Lang.Blocks.do_name, 'C'],
+ [Lang.Blocks.do_sharp_name, 'CS'],
+ [Lang.Blocks.re_name, 'D'],
+ [Lang.Blocks.re_sharp_name, 'DS'],
+ [Lang.Blocks.mi_name, 'E'],
+ [Lang.Blocks.fa_name, 'F'],
+ [Lang.Blocks.fa_sharp_name, 'FS'],
+ [Lang.Blocks.sol_name, 'G'],
+ [Lang.Blocks.sol_sharp_name, 'GS'],
+ [Lang.Blocks.la_name, 'A'],
+ [Lang.Blocks.la_sharp_name, 'AS'],
+ [Lang.Blocks.si_name, 'B'],
+ ],
+ value: 'C',
+ fontSize: 11,
+ converter: Entry.block.converters.returnStringValueUpperCase,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ keyOption: 'kaboino_tone_list',
+ },
+ ],
+ },
+ },
+ kaboino_tone_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ statements: [],
+ template: '%1',
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'kaboino_tone_list',
+ },
+ ],
+ type: 'kaboino_tone_value',
+ },
+ paramsKeyMap: {
+ NOTE: 0,
+ },
+ func(sprite, script) {
+ return script.getNumberValue('NOTE');
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: '%1',
+ keyOption: 'kaboino_tone_value',
+ },
+ ],
+ },
+ },
+ kaboino_octave_list: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ statements: [],
+ template: '%1',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['1', '1'],
+ ['2', '2'],
+ ['3', '3'],
+ ['4', '4'],
+ ['5', '5'],
+ ['6', '6'],
+ ['7', '7'],
+ ],
+ value: '4',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ },
+ paramsKeyMap: {
+ OCTAVE: 0,
+ },
+ func(sprite, script) {
+ return script.getField('OCTAVE');
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: '%1',
+ keyOption: 'kaboino_octave_list',
+ },
+ ],
+ },
+ },
+ kaboino_set_tone: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'kaboino_tone_list',
+ },
+ {
+ type: 'kaboino_octave_list',
+ },
+ {
+ type: 'text',
+ params: ['1'],
+ },
+ null,
+ ],
+ type: 'kaboino_set_tone',
+ },
+ paramsKeyMap: {
+ NOTE: 0,
+ OCTAVE: 1,
+ DURATION: 2,
+ },
+ class: 'KaboinoSet',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ const sq = Entry.hw.sendQueue;
+ const port = Entry.Kaboino.PORT_MAP.SET_TONE_PORT;
+
+ if (!script.isStart) {
+ let note = script.getValue('NOTE', script);
+ if (!Entry.Utils.isNumber(note)) {
+ note = Entry.Kaboino.toneTable[note];
+ }
+
+ if (note < 0) {
+ note = 0;
+ }
+ else if (note > 12) {
+ note = 12;
+ }
+
+ let duration = script.getNumberValue('DURATION', script);
+
+ if (duration < 0) {
+ duration = 0;
+ }
+
+ if (!sq.SET) {
+ sq.SET = {};
+ }
+
+ if (duration === 0) {
+ sq.SET[port] = {
+ type: Entry.Kaboino.sensorTypes.SET_TONE,
+ data: 0,
+ time: new Date().getTime(),
+ };
+ return script.callReturn();
+ }
+
+ let octave = script.getNumberValue('OCTAVE', script) - 1;
+ if (octave < 0) {
+ octave = 0;
+ }
+ else if (octave > 7) {
+ octave = 7;
+ }
+
+ let value = 0;
+
+ if (note != 0) {
+ value = Entry.Kaboino.toneMap[note][octave];
+ }
+
+ duration = duration * 1000;
+ script.isStart = true;
+ script.timeFlag = 1;
+
+ sq.SET[port] = {
+ type: Entry.Kaboino.sensorTypes.SET_TONE,
+ data: {
+ value,
+ duration,
+ },
+ time: new Date().getTime(),
+ };
+
+ setTimeout(() => {
+ script.timeFlag = 0;
+ }, duration + 32);
+ return script;
+ }
+ else if (script.timeFlag == 1) {
+ return script;
+ }
+ else {
+ delete script.timeFlag;
+ delete script.isStart;
+ sq.SET[port] = {
+ type: Entry.Kaboino.sensorTypes.SET_TONE,
+ data: 0,
+ time: new Date().getTime(),
+ };
+ Entry.engine.isContinue = false;
+
+ return script.callReturn();
+ }
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.setTone(%1, %2, %3)',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+ kaboino_set_wheel_straight_list: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ statements: [],
+ template: '%1',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_forward_wheel, "forward"],
+ [Lang.Blocks.KABOINO_backward_wheel, "reverse"],
+ ],
+ value: "forward",
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ func(sprite, script) {
+ return script.getStringField('PORT');
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: '%1',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_forward_wheel, "forward"],
+ [Lang.Blocks.KABOINO_backward_wheel, "reverse"],
+ ],
+ value: "forward",
+ fontSize: 11,
+ converter: Entry.block.converters.returnStringValue,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ keyOption: 'kaboino_set_wheel_straight_list',
+ },
+ ]
+ },
+ },
+ kaboino_set_wheel_turn_list: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ statements: [],
+ template: '%1',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_turn_left, "leftTurn"],
+ [Lang.Blocks.KABOINO_turn_right, "rightTurn"],
+ ],
+ value: "leftTurn",
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ func(sprite, script) {
+ return script.getStringField('PORT');
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: '%1',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_turn_left, "leftTurn"],
+ [Lang.Blocks.KABOINO_turn_right, "rightTurn"],
+ ],
+ value: "leftTurn",
+ fontSize: 11,
+ converter: Entry.block.converters.returnStringValue,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ keyOption: 'kaboino_set_wheel_turn_list',
+ },
+ ]
+ },
+ },
+ kaboino_set_body_speed_straight: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'kaboino_set_wheel_straight_list',
+ },
+ {
+ type: 'text',
+ params: ['10'],
+ },
+ {
+ type: 'kaboino_set_wheel_turn_list',
+ },
+ {
+ type: 'text',
+ params: ['0'],
+ },
+ null,
+ ],
+ type: 'kaboino_set_body_speed_straight',
+ },
+ paramsKeyMap: {
+ CAR_BODY_STRAIGHT: 0,
+ CAR_BODY_SPEED: 1,
+ CAR_BODY_TURN: 2,
+ CAR_BODY_TURN_SPEED: 3,
+ },
+ class: 'KaboinoSet',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ let car_body_straight = script.getValue('CAR_BODY_STRAIGHT', script);
+ let car_body_speed = script.getValue('CAR_BODY_SPEED', script);
+ let car_body_turn = script.getValue('CAR_BODY_TURN', script);
+ let car_body_turn_speed = script.getValue('CAR_BODY_TURN_SPEED', script);
+ const port = Entry.Kaboino.PORT_MAP.SET_BODY_SPEED_TURN_PORT;
+
+ car_body_speed = Math.round(car_body_speed);
+ car_body_speed = Math.max(car_body_speed, 0);
+ car_body_speed = Math.min(car_body_speed, 125);
+
+ car_body_turn_speed = Math.round(car_body_turn_speed);
+ car_body_turn_speed = Math.max(car_body_turn_speed, 0);
+ car_body_turn_speed = Math.min(car_body_turn_speed, 25);
+
+ let wheel_left_speed;
+ let wheel_right_speed;
+
+ if (car_body_straight == "forward") {
+ if (car_body_turn == "leftTurn") {
+ wheel_left_speed = car_body_speed - car_body_speed * Math.round(car_body_turn_speed/25);
+ wheel_right_speed = car_body_speed;
+ }
+ else if (car_body_turn == "rightTurn") {
+ wheel_left_speed = car_body_speed;
+ wheel_right_speed = car_body_speed - car_body_speed * Math.round(car_body_turn_speed/25);
+ }
+ }
+ else if (car_body_straight == "reverse") {
+ if (car_body_turn == "leftTurn") {
+ wheel_left_speed = car_body_speed - car_body_speed * Math.round(car_body_turn_speed/25);
+ wheel_right_speed = car_body_speed;
+ }
+ else if (car_body_turn == "rightTurn") {
+ wheel_left_speed = car_body_speed;
+ wheel_right_speed = car_body_speed - car_body_speed * Math.round(car_body_turn_speed/25);
+ }
+ if (wheel_left_speed == 0) wheel_left_speed = 0;
+ else wheel_left_speed = wheel_left_speed + Entry.Kaboino.CONST_VAL.MAX_SPEED;
+ if (wheel_right_speed == 0) wheel_right_speed = 0;
+ else wheel_right_speed = wheel_right_speed + Entry.Kaboino.CONST_VAL.MAX_SPEED;
+ }
+
+ if (!(last_wheel_left_speed == wheel_left_speed) || !(last_wheel_right_speed == wheel_right_speed)) {
+ if (!Entry.hw.sendQueue.SET) {
+ Entry.hw.sendQueue.SET = {};
+ }
+ Entry.hw.sendQueue.SET[port] = {
+ type: Entry.Kaboino.sensorTypes.SET_BODY_SPEED_TURN,
+ data: [wheel_left_speed, wheel_right_speed],
+ time: new Date().getTime(),
+ };
+ last_wheel_left_speed = wheel_left_speed;
+ last_wheel_right_speed = wheel_right_speed;
+ return script;
+ }
+ else return script.callReturn();
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.writeBodySpeedStraight(%1, %2, %3, %4)',
+ },
+ ],
+ },
+ },
+ kaboino_set_wheel_spin_list: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ statements: [],
+ template: '%1',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_spin_left, "leftSpin"],
+ [Lang.Blocks.KABOINO_spin_right, "rightSpin"],
+ ],
+ value: "leftSpin",
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ func(sprite, script) {
+ return script.getStringField('PORT');
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: '%1',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_spin_left, "leftSpin"],
+ [Lang.Blocks.KABOINO_spin_right, "rightSpin"],
+ ],
+ value: "leftSpin",
+ fontSize: 11,
+ converter: Entry.block.converters.returnStringValue,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ keyOption: 'kaboino_set_wheel_spin_list',
+ },
+ ]
+ },
+ },
+ kaboino_set_wheel_spin: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'kaboino_set_wheel_spin_list',
+ },
+ {
+ type: 'text',
+ params: ['10'],
+ },
+ null,
+ ],
+ type: 'kaboino_set_wheel_spin',
+ },
+ paramsKeyMap: {
+ SPIN_DIR: 0,
+ SPIN_SPEED: 1,
+ },
+ class: 'KaboinoSet',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ let spin_dir = script.getValue('SPIN_DIR', script);
+ let spin_speed = script.getValue('SPIN_SPEED', script);
+ const port = Entry.Kaboino.PORT_MAP.SET_BODY_WHEEL_SPIN_PORT;
+
+ spin_speed = Math.round(spin_speed);
+ spin_speed = Math.max(spin_speed, 0);
+ spin_speed = Math.min(spin_speed, 125);
+
+ let wheel_left_speed;
+ let wheel_right_speed;
+
+ if (spin_dir == "leftSpin") {
+ wheel_left_speed = spin_speed + Entry.Kaboino.CONST_VAL.MAX_SPEED;
+ wheel_right_speed = spin_speed;
+ }
+ else if (spin_dir == "rightSpin") {
+ wheel_left_speed = spin_speed;
+ wheel_right_speed = spin_speed + Entry.Kaboino.CONST_VAL.MAX_SPEED;
+ }
+
+ if (!(last_wheel_left_speed == wheel_left_speed) || !(last_wheel_right_speed == wheel_right_speed)) {
+ if (!Entry.hw.sendQueue.SET) {
+ Entry.hw.sendQueue.SET = {};
+ }
+ Entry.hw.sendQueue.SET[port] = {
+ type: Entry.Kaboino.sensorTypes.SET_BODY_WHEEL_SPIN,
+ data: [wheel_left_speed, wheel_right_speed],
+ time: new Date().getTime(),
+ };
+ last_wheel_left_speed = wheel_left_speed;
+ last_wheel_right_speed = wheel_right_speed;
+ return script;
+ }
+ else return script.callReturn();
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.writeSpinPWM(%1, %2)',
+ },
+ ],
+ },
+ },
+
+ kaboino_set_wheel_speed: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'kaboino_set_wheel_straight_list',
+ },
+ {
+ type: 'text',
+ params: ['10'],
+ },
+ {
+ type: 'kaboino_set_wheel_straight_list',
+ },
+ {
+ type: 'text',
+ params: ['10'],
+ },
+ null,
+ ],
+ type: 'kaboino_set_wheel_speed',
+ },
+ paramsKeyMap: {
+ WHEEL_LEFT_STRAIGHT: 0,
+ WHEEL_LEFT_SPEED: 1,
+ WHEEL_RIGHT_STRAIGHT: 2,
+ WHEEL_RIGHT_SPEED: 3,
+ },
+ class: 'KaboinoSet',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ let wheel_left_straight = script.getValue('WHEEL_LEFT_STRAIGHT', script);
+ let wheel_left_speed = script.getValue('WHEEL_LEFT_SPEED', script);
+ let wheel_right_straight = script.getValue('WHEEL_RIGHT_STRAIGHT', script);
+ let wheel_right_speed = script.getValue('WHEEL_RIGHT_SPEED', script);
+ let port = Entry.Kaboino.PORT_MAP.SET_WHEEL_SPEED_PORT;
+
+ wheel_left_speed = Math.round(wheel_left_speed);
+ wheel_left_speed = Math.max(wheel_left_speed, 0);
+ wheel_left_speed = Math.min(wheel_left_speed, (Entry.Kaboino.CONST_VAL.MAX_SPEED - 1));
+
+ wheel_right_speed = Math.round(wheel_right_speed);
+ wheel_right_speed = Math.max(wheel_right_speed, 0);
+ wheel_right_speed = Math.min(wheel_right_speed, (Entry.Kaboino.CONST_VAL.MAX_SPEED - 1));
+
+ if(wheel_left_straight == "forward")
+ {
+ wheel_left_speed = wheel_left_speed;
+ }
+ else if (wheel_left_straight == "reverse")
+ {
+ wheel_left_speed = wheel_left_speed + Entry.Kaboino.CONST_VAL.MAX_SPEED;
+ }
+
+ if(wheel_right_straight == "forward")
+ {
+ wheel_right_speed = wheel_right_speed;
+ }
+ else if (wheel_right_straight == "reverse")
+ {
+ wheel_right_speed = wheel_right_speed + Entry.Kaboino.CONST_VAL.MAX_SPEED;
+ }
+
+ if (!(last_wheel_left_speed == wheel_left_speed) || !(last_wheel_right_speed == wheel_right_speed)) {
+ if (!Entry.hw.sendQueue.SET) {
+ Entry.hw.sendQueue.SET = {};
+ }
+ Entry.hw.sendQueue.SET[port] = {
+ type: Entry.Kaboino.sensorTypes.SET_WHEEL_SPEED,
+ data: [wheel_left_speed, wheel_right_speed],
+ time: new Date().getTime(),
+ };
+ last_wheel_left_speed = wheel_left_speed;
+ last_wheel_right_speed = wheel_right_speed;
+ return script;
+ }
+ else return script.callReturn();
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.writeMotorSpeed(%1, %2, %3, %4)',
+ },
+ ],
+ },
+ },
+ kaboino_set_display: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'number',
+ params: ['1'],
+ },
+ {
+ type: 'text',
+ params: ['Welcome to Kaboino!'],
+ },
+ null,
+ ],
+ type: 'kaboino_set_display',
+ },
+ paramsKeyMap: {
+ HEIGHT: 0,
+ STRING: 1,
+ },
+ class: 'KaboinoSet',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ let port = Entry.Kaboino.PORT_MAP.SET_DISPLAY_LINE_PORT;
+ let width = 0;
+ let line = script.getValue('HEIGHT', script);
+ let height = line;
+ let current_string = script.getValue('STRING', script);
+ let character = [];
+ let buf;
+ line = Math.round(line);
+ line = Math.max(line, 1);
+ line = Math.min(line, 6);
+ let line1_string = '';
+ let line2_string = '';
+ let line3_string = '';
+ let line4_string = '';
+ let line5_string = '';
+ let line6_string = '';
+ lcd_clear = 'not_cleared';
+ height = (line - 1) * 10;
+
+ if (line == 1) {
+ line1_string = current_string;
+ }
+ else if (line == 2) {
+ line2_string = current_string;
+ }
+ else if (line == 3) {
+ line3_string = current_string;
+ }
+ else if (line == 4) {
+ line4_string = current_string;
+ }
+ else if (line == 5) {
+ line5_string = current_string;
+ }
+ else if (line == 6) {
+ line6_string = current_string;
+ }
+
+ if (typeof current_string === 'string') {
+ for (var i = 0; i < current_string.length; i++) {
+ buf = Entry.memaker.toByte(current_string[parseInt(i, 10)]);
+ character[parseInt(i, 10)] = buf;
+ }
+ } else {
+ character[0] = current_string;
+ }
+
+ if ((!(last_line1_string == line1_string) && (line == 1)) ||
+ (!(last_line2_string == line2_string) && (line == 2)) ||
+ (!(last_line3_string == line3_string) && (line == 3)) ||
+ (!(last_line4_string == line4_string) && (line == 4)) ||
+ (!(last_line5_string == line5_string) && (line == 5)) ||
+ (!(last_line6_string == line6_string) && (line == 6))) {
+ if (!Entry.hw.sendQueue.SET) {
+ Entry.hw.sendQueue.SET = {};
+ }
+ Entry.hw.sendQueue.SET[port] = {
+ type: Entry.Kaboino.sensorTypes.SET_DISPLAY_STRING,
+ data: [
+ width,
+ height,
+ character[0],
+ character[1],
+ character[2],
+ character[3],
+ character[4],
+ character[5],
+ character[6],
+ character[7],
+ character[8],
+ character[9],
+ character[10],
+ character[11],
+ character[12],
+ character[13],
+ character[14],
+ character[15],
+ character[16],
+ character[17],
+ character[18],
+ character[19],
+ character[20]
+ ],
+ time: new Date().getTime(),
+ };
+
+ if (line == 1) {
+ last_line1_string = current_string;
+ }
+ else if (line == 2) {
+ last_line2_string = current_string;
+ }
+ else if (line == 3) {
+ last_line3_string = current_string;
+ }
+ else if (line == 4) {
+ last_line4_string = current_string;
+ }
+ else if (line == 5) {
+ last_line5_string = current_string;
+ }
+ else if (line == 6) {
+ last_line6_string = current_string;
+ }
+
+ return script;
+ }
+ else return script.callReturn();
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.displayLineString(%1, %2)',
+ textParams: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ },
+ ],
+ },
+ },
+ kaboino_set_display_clear: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ ],
+ type: 'kaboino_set_display_clear',
+ },
+ paramsKeyMap: {
+
+ },
+ class: 'KaboinoSet',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ const port = Entry.Kaboino.PORT_MAP.SET_DISPLAY_CLEAR_PORT;
+ if (!(lcd_clear == 'cleared')) {
+ if (!Entry.hw.sendQueue.SET) {
+ Entry.hw.sendQueue.SET = {};
+ }
+ Entry.hw.sendQueue.SET[port] = {
+ type: Entry.Kaboino.sensorTypes.SET_DISPLAY_CLEAR,
+ data: {
+ data: 0,
+ },
+ time: new Date().getTime(),
+ };
+ lcd_clear = 'cleared';
+ last_line1_string = ' ';
+ last_line2_string = ' ';
+ last_line3_string = ' ';
+ last_line4_string = ' ';
+ last_line5_string = ' ';
+ last_line6_string = ' ';
+ return script;
+ }
+ else return script.callReturn();
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.displayClearLine()',
+ },
+ ],
+ },
+ },
+ kaboino_get_color_sensor_value_list: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ statements: [],
+ template: '%1',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_color_white, "white"],
+ [Lang.Blocks.KABOINO_color_red, "red"],
+ [Lang.Blocks.KABOINO_color_green, "green"],
+ [Lang.Blocks.KABOINO_color_blue, "blue"],
+ [Lang.Blocks.KABOINO_color_black, "black"],
+ ],
+ value: "white",
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ func(sprite, script) {
+ var port = script.getStringField('PORT', script);
+
+ return port;
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: '%1',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_color_white, "white"],
+ [Lang.Blocks.KABOINO_color_red, "red"],
+ [Lang.Blocks.KABOINO_color_green, "green"],
+ [Lang.Blocks.KABOINO_color_blue, "blue"],
+ [Lang.Blocks.KABOINO_color_black, "black"],
+ ],
+ value: "white",
+ fontSize: 11,
+ converter: Entry.block.converters.returnStringValue,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ keyOption: 'kaboino_get_color_sensor_value_list',
+ },
+ ],
+ },
+ },
+ kaboino_get_color_sensor_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_boolean_field',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'kaboino_get_color_sensor_value_list',
+ },
+ ],
+ type: 'kaboino_get_color_sensor_value',
+ },
+ paramsKeyMap: {
+ COLOR_NUMBER: 0,
+ },
+ class: 'KaboinoGet',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ let receivedPortStringValue = script.getValue('COLOR_NUMBER', script);
+ let color_number;
+
+ if (receivedPortStringValue == "white")
+ color_number = 4;
+ else if (receivedPortStringValue == "red")
+ color_number = 1;
+ else if (receivedPortStringValue == "green")
+ color_number = 2;
+ else if (receivedPortStringValue == "blue")
+ color_number = 3;
+ else if (receivedPortStringValue == "black")
+ color_number = 5;
+
+ const ColorPort = Entry.Kaboino.PORT_MAP.GET_COLOR_SENSOR_PORT - 3;
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Kaboino.sensorTypes.GET_COLOR_SENSOR] = {
+ port: ColorPort,
+ time: new Date().getTime(),
+ };
+ const COLOR_VALUE = Entry.hw.portData.COLOR;
+
+ if (color_number == COLOR_VALUE) {
+
+ }
+ else {
+
+ }
+
+ return (color_number == COLOR_VALUE) || 0;
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.readColorSensor(%1)',
+ },
+ ],
+ },
+ },
+ kaboino_set_color_sensor_led: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_on, 'on'],
+ [Lang.Blocks.KABOINO_off, 'off'],
+ ],
+ value: 'off',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ null,
+ ],
+ type: 'kaboino_set_color_sensor_led',
+ },
+ paramsKeyMap: {
+ VALUE: 0,
+ },
+ class: 'KaboinoSet',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ let port = Entry.Kaboino.PORT_MAP.SET_COLOR_LED_PORT;
+ let value = script.getValue('VALUE', script);
+
+ if (typeof value === 'string') {
+ value = value.toLowerCase();
+ }
+ if (value == 'on') {
+ value = 0xf;
+ } else if (value == 'off') {
+ value = 0;
+ }
+
+ if (!Entry.hw.sendQueue.SET) {
+ Entry.hw.sendQueue.SET = {};
+ }
+ Entry.hw.sendQueue.SET[port] = {
+ type: Entry.Kaboino.sensorTypes.SET_COLOR_SEN_LED,
+ data: value,
+ time: new Date().getTime(),
+ };
+ return script.callReturn();
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.setColorSenLED(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_on, 'on'],
+ [Lang.Blocks.KABOINO_off, 'off'],
+ ],
+ value: 'off',
+ fontSize: 11,
+ converter: Entry.block.converters.returnStringValue,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ },
+ ],
+ },
+ },
+ kaboino_set_search_light: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_on, 'on'],
+ [Lang.Blocks.KABOINO_off, 'off'],
+ ],
+ value: 'on',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ null,
+ ],
+ type: 'kaboino_set_search_light',
+ },
+ paramsKeyMap: {
+ VALUE: 0,
+ },
+ class: 'KaboinoSet_2',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ let port = Entry.Kaboino.PORT_MAP.SET_SEARCH_LIGHT_PORT;
+ let value = script.getValue('VALUE', script);
+
+ if (typeof value === 'string') {
+ value = value.toLowerCase();
+ }
+
+ if (value == 'on') {
+ value = 0xf;
+ } else if (value == 'off') {
+ value = 0;
+ }
+
+ if (!Entry.hw.sendQueue.SET) {
+ Entry.hw.sendQueue.SET = {};
+ }
+ Entry.hw.sendQueue.SET[port] = {
+ type: Entry.Kaboino.sensorTypes.SET_SEARCH_LIGHT,
+ data: value,
+ time: new Date().getTime(),
+ };
+ return script.callReturn();
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.turnSearchLight(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_on, 'on'],
+ [Lang.Blocks.KABOINO_off, 'off'],
+ ],
+ value: 'on',
+ fontSize: 11,
+ converter: Entry.block.converters.returnStringValue,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ },
+ ],
+ },
+ },
+ kaboino_set_ball_holder: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_up, "up"],
+ [Lang.Blocks.KABOINO_down, "down"],
+ ],
+ value: "up",
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ null,
+ ],
+ type: 'kaboino_set_ball_holder',
+ },
+ paramsKeyMap: {
+ VALUE: 0,
+ },
+ class: 'KaboinoSet_3',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ let port = '0';
+ let value = script.getValue('VALUE', script);
+
+ if (typeof value === 'string') {
+ value = value.toLowerCase();
+ }
+
+ if (value == "up") value = 180;
+ else if (value == "down") value = 0;
+
+ if (!Entry.hw.sendQueue.SET) {
+ Entry.hw.sendQueue.SET = {};
+ }
+ Entry.hw.sendQueue.SET[port] = {
+ type: Entry.Kaboino.sensorTypes.SET_BALL_HOLDER,
+ data: value,
+ time: new Date().getTime(),
+ };
+ return script.callReturn();
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.liftBallHolder(%1)',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_up, "up"],
+ [Lang.Blocks.KABOINO_down, "down"],
+ ],
+ value: "up",
+ fontSize: 11,
+ converter: Entry.block.converters.returnStringValue,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ },
+ ],
+ },
+ },
+ kaboino_get_environmnet_sensor_value_list: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ statements: [],
+ template: '%1',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_environment_temp_sensor, "tempSensor"],
+ [Lang.Blocks.KABOINO_environment_humidity_sensor, "humSensor"],
+ ],
+ value: "tempSensor",
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ func(sprite, script) {
+ var port = script.getStringField('PORT', script);
+ return port;
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: '%1',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_environment_temp_sensor, "tempSensor"],
+ [Lang.Blocks.KABOINO_environment_humidity_sensor, "humSensor"],
+ ],
+ value: "tempSensor",
+ fontSize: 11,
+ converter: Entry.block.converters.returnStringValue,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ keyOption: 'kaboino_get_environmnet_sensor_value_list',
+ },
+ ],
+ },
+ },
+ kaboino_get_environmnet_sensor_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_string_field',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'kaboino_get_environmnet_sensor_value_list',
+ },
+ ],
+ type: 'kaboino_get_environmnet_sensor_value',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'KaboinoGet_4',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ const ANALOG = Entry.hw.portData.ANALOG;
+ let port = script.getValue('PORT', script);
+
+ if (port == "tempSensor") {
+ port = Entry.Kaboino.PORT_MAP.GET_TEMP_SND_SENSOR_PORT - 3;
+ } else if (port == "humSensor" ){
+ port = Entry.Kaboino.PORT_MAP.GET_HUMIDITY_SENSOR_PORT - 3;
+ }
+
+ if (port[0] === 'A') {
+ port = port.substring(1);
+ }
+
+ return String(ANALOG[port]/100);
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.readEnvironmentSensor(%1)',
+ },
+ ],
+ },
+ },
+ kaboino_get_dust_sensor_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_string_field',
+ statements: [],
+ params: [],
+ events: {},
+ def: {
+ params: [],
+ type: 'kaboino_get_dust_sensor_value',
+ },
+ paramsKeyMap: {},
+ class: 'KaboinoGet_4',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ const DustPort = Entry.Kaboino.PORT_MAP.GET_DUST_ULTRA_SENSOR_PORT - 3;
+
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Kaboino.sensorTypes.GET_DUST_SENSOR] = {
+ port: DustPort,
+ time: new Date().getTime(),
+ };
+ const DUST_VALUE = Entry.hw.portData.DUST;
+
+ return String(DUST_VALUE || 0);
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.readDustSensor()',
+ },
+ ],
+ },
+ },
+ kaboino_get_ultrasonic_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_string_field',
+ statements: [],
+ params: [],
+ events: {},
+ def: {
+ params: [],
+ type: 'kaboino_get_ultrasonic_value',
+ },
+ paramsKeyMap: {},
+ class: 'KaboinoGet_5',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+
+ const UltrasonicPort = Entry.Kaboino.PORT_MAP.GET_DUST_ULTRA_SENSOR_PORT - 3;
+
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Kaboino.sensorTypes.GET_ULTRASONIC_SENSOR] = {
+ port: UltrasonicPort,
+ time: new Date().getTime(),
+ };
+ const ULTRASONIC_VALUE = Entry.hw.portData.ULTRASONIC;
+
+ return String(ULTRASONIC_VALUE || 0);
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.readUltrasonicSensor()',
+ },
+ ],
+ },
+ },
+ kaboino_set_ultrasonic_angle_list: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ statements: [],
+ template: '%1',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_ultrasonic_angle_center, "ultraCenterAng"],
+ [Lang.Blocks.KABOINO_ultrasonic_angle_left, "ultraLeftAng"],
+ [Lang.Blocks.KABOINO_ultrasonic_angle_right, "ultraRightAng"],
+ ],
+ value: "ultraCenterAng",
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ func(sprite, script) {
+ var port = script.getStringField('PORT', script);
+
+ return port;
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: '%1',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_ultrasonic_angle_center, "ultraCenterAng"],
+ [Lang.Blocks.KABOINO_ultrasonic_angle_left, "ultraLeftAng"],
+ [Lang.Blocks.KABOINO_ultrasonic_angle_right, "ultraRightAng"],
+ ],
+ value: "ultraCenterAng",
+ fontSize: 11,
+ converter: Entry.block.converters.returnStringValue,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ keyOption: 'kaboino_set_ultrasonic_angle_list',
+ },
+ ],
+ },
+ },
+ kaboino_set_ultrasonic_angle: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'kaboino_set_ultrasonic_angle_list',
+ },
+ {
+ type: 'text',
+ params: ['0'],
+ },
+ null,
+ ],
+ type: 'kaboino_set_ultrasonic_angle',
+ },
+ paramsKeyMap: {
+ DIRECTION: 0,
+ VALUE: 1,
+ },
+ class: 'KaboinoSet_5',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ let port = Entry.Kaboino.PORT_MAP.SET_ULTRASONIC_ANGLE_PORT;
+ let direction = script.getValue('DIRECTION', script);
+ let value = script.getValue('VALUE', script);
+ let ultrasonic_angle = 90;
+
+ value = Math.round(value);
+ value = Math.max(value, 0);
+ value = Math.min(value, 90);
+
+ if (direction == "ultraCenterAng") {
+ ultrasonic_angle = 90;
+ }
+ else if (direction == "ultraLeftAng") {
+ ultrasonic_angle = 90 + value;
+ }
+ else if (direction == "ultraRightAng") {
+ ultrasonic_angle = 90 - value;
+ }
+
+ if (!Entry.hw.sendQueue.SET) {
+ Entry.hw.sendQueue.SET = {};
+ }
+ Entry.hw.sendQueue.SET[port] = {
+ type: Entry.Kaboino.sensorTypes.SET_ULTRASONIC_ANGLE,
+ data: ultrasonic_angle,
+ time: new Date().getTime(),
+ };
+
+ return script.callReturn();
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.setUltrasonicAngle(%1)',
+ },
+ ],
+ },
+ },
+ kaboino_get_sound_sensor_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_string_field',
+ statements: [],
+ params: [],
+ events: {},
+ def: {
+ params: [],
+ type: 'kaboino_get_sound_sensor_value',
+ },
+ paramsKeyMap: {},
+ class: 'KaboinoGet_6',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ const SNDPort = Entry.Kaboino.PORT_MAP.GET_TEMP_SND_SENSOR_PORT - 3;
+
+ if (!Entry.hw.sendQueue.GET) {
+ Entry.hw.sendQueue.GET = {};
+ }
+ Entry.hw.sendQueue.GET[Entry.Kaboino.sensorTypes.GET_SND_SENSOR] = {
+ port: SNDPort,
+ time: new Date().getTime(),
+ };
+
+ const SND_VALUE = Entry.hw.portData.SND;
+
+ return String(SND_VALUE || 0);
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.readShootingValue()',
+ },
+ ],
+ },
+ },
+
+ kaboino_set_robot_arm_list: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ statements: [],
+ template: '%1',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_robot_arm_gripper, "armGripper"],
+ [Lang.Blocks.KABOINO_robot_arm_pusher, "armPusher"],
+ [Lang.Blocks.KABOINO_robot_arm_raiser, "armRaiser"],
+ [Lang.Blocks.KABOINO_robot_arm_rotator, "armRotator"],
+ ],
+ value: "armGripper",
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ func(sprite, script) {
+ return script.getStringField('PORT', script);
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: '%1',
+ blockType: 'param',
+ textParams: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.KABOINO_robot_arm_gripper, "armGripper"],
+ [Lang.Blocks.KABOINO_robot_arm_pusher, "armPusher"],
+ [Lang.Blocks.KABOINO_robot_arm_raiser, "armRaiser"],
+ [Lang.Blocks.KABOINO_robot_arm_rotator, "armRotator"],
+ ],
+ value: "armGripper",
+ fontSize: 11,
+ converter: Entry.block.converters.returnStringValue,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ keyOption: 'kaboino_set_robot_arm_list',
+ },
+ ],
+ },
+ },
+ kaboino_set_robot_arm: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ defaultType: 'number',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'kaboino_set_robot_arm_list',
+ },
+ {
+ type: 'text',
+ params: ['0'],
+ },
+ null,
+ ],
+ type: 'kaboino_set_robot_arm',
+ },
+ paramsKeyMap: {
+ ACTOR: 0,
+ VALUE: 1,
+ },
+ class: 'KaboinoSet_8',
+ isNotFor: ['Kaboino'],
+ func(sprite, script) {
+ let port;
+ let actorPort = script.getValue('ACTOR', script);
+ let value = script.getValue('VALUE', script);
+
+ value = Math.round(value);
+ value = Math.max(value, 0);
+ value = Math.min(value, 180);
+
+ if (actorPort == "armGripper") {
+ port = Entry.Kaboino.PORT_MAP.SET_ROBOT_ARM_GRIPPER_PORT;
+ }
+ else if (actorPort == "armPusher") {
+ port = Entry.Kaboino.PORT_MAP.SET_ROBOT_ARM_PUSHER_PORT;
+ }
+ else if (actorPort == "armRaiser") {
+ port = Entry.Kaboino.PORT_MAP.SET_ROBOT_ARM_RAISER_PORT;
+ }
+ else if (actorPort == "armRotator") {
+ port = Entry.Kaboino.PORT_MAP.SET_ROBOT_ARM_ROTATOR_PORT;
+ }
+
+ if (!Entry.hw.sendQueue.SET) {
+ Entry.hw.sendQueue.SET = {};
+ }
+ Entry.hw.sendQueue.SET[port] = {
+ type: Entry.Kaboino.sensorTypes.SET_ROBOT_ARM,
+ data: value,
+ time: new Date().getTime(),
+ };
+ return script.callReturn();
+ },
+ syntax: {
+ js: [],
+ py: [
+ {
+ syntax: 'Kaboino.controlRobotArm(%1, %2)',
+ },
+ ],
+ },
+ },
+ };
+};
+
+module.exports = Entry.Kaboino;
diff --git a/src/playground/blocks/hardware/block_robotis.js b/src/playground/blocks/hardware/block_robotis.js
index 31a2c7352d..863bb96ee8 100644
--- a/src/playground/blocks/hardware/block_robotis.js
+++ b/src/playground/blocks/hardware/block_robotis.js
@@ -1,6581 +1,7511 @@
-'use strict';
-
-Entry.Robotis_carCont = {
- INSTRUCTION: {
- NONE: 0,
- WRITE: 3,
- READ: 2,
- },
- CONTROL_TABLE: {
- // [default address, default length, address (when reads together), length (when reads together)]
- CM_LED: [67, 1],
- CM_SPRING_RIGHT: [69, 1, 69, 2],
- CM_SPRING_LEFT: [70, 1, 69, 2],
- CM_SWITCH: [71, 1],
- CM_SOUND_DETECTED: [86, 1],
- CM_SOUND_DETECTING: [87, 1],
- CM_IR_LEFT: [91, 2, 91, 4],
- CM_IR_RIGHT: [93, 2, 91, 4],
- CM_CALIBRATION_LEFT: [95, 2],
- CM_CALIBRATION_RIGHT: [97, 2],
-
- AUX_MOTOR_SPEED_LEFT: [152, 2], // car_cont
- AUX_MOTOR_SPEED_RIGHT: [154, 2],
- },
- setZero: function() {
- // instruction / address / length / value / default length
- Entry.hw.sendQueue['setZero'] = [1];
- this.update();
- this.setRobotisData(null);
- Entry.hw.sendQueue['setZero'] = null;
- this.update();
- this.setRobotisData([
- [Entry.Robotis_carCont.INSTRUCTION.WRITE, 152, 2, 0],
- [Entry.Robotis_carCont.INSTRUCTION.WRITE, 154, 2, 0],
- ]);
-
- this.update();
- },
- id: '7.1',
- name: 'robotis_carCont',
- url: 'http://www.robotis.com/index/product.php?cate_code=111310',
- imageName: 'robotis_carCont.png',
- title: {
- ko: '로보티즈 로봇자동차',
- en: 'Robotis Robot car',
- },
- delay: 40,
- postCallReturn: function(script, data, ms) {
- if (ms <= 0) {
- this.setRobotisData(data);
- this.update();
- return script.callReturn();
- }
-
- Entry.hw.portData = {};
- setTimeout(function() {
- Entry.hw.sendQueue = {}
- // Entry.hw.portData = {};
- }, ms - 100);
-
- setTimeout(function() {
- Entry.hw.sendQueue = {}
- //Entry.hw.portData = {};
- }, ms);
-
- setTimeout(function() {
- Entry.hw.sendQueue = {}
- //Entry.hw.portData = {};
- }, ms + 100);
-
- setTimeout(function() {
- Entry.hw.sendQueue = {}
- // Entry.hw.portData = {};
- }, ms + 200);
-
- if (!script.isStart) {
- script.isStart = true;
- script.timeFlag = 1;
- //data setting
- this.setRobotisData(data);
- this.update();
-
- //delay xx ms
- setTimeout(function() {
- script.timeFlag = 0;
-
- }, ms);
-
- return script;
- } else if (script.timeFlag == 1) {
- this.setRobotisData(null);
- this.update();
- return script;
- } else {
- delete script.timeFlag;
- delete script.isStart;
- Entry.engine.isContinue = false;
- this.update();
- return script.callReturn();
- }
- },
- wait: function(sq, ms) {
- Entry.hw.socket.send(JSON.stringify(sq));
-
- var start = new Date().getTime();
- var end = start;
- while (end < start + ms) {
- //wait XX ms
- end = new Date().getTime();
- }
- },
- update: function() {
- Entry.hw.update();
- var ROBOTIS_DATA = Entry.hw.sendQueue['ROBOTIS_DATA'];
- if (ROBOTIS_DATA) {
- ROBOTIS_DATA.forEach(function(data) {
- data['send'] = true;
- });
- }
- this.setRobotisData(null);
- },
- filterSendData: function() {
- var ROBOTIS_DATA = Entry.hw.sendQueue['ROBOTIS_DATA'];
- if (ROBOTIS_DATA) {
- return ROBOTIS_DATA.filter(function(data) {
- return data.send !== true;
- });
- } else {
- return null;
- }
- },
- setRobotisData: function(data) {
- var filterData = this.filterSendData();
- if (data == null) {
- Entry.hw.sendQueue['ROBOTIS_DATA'] = filterData;
- } else {
- Entry.hw.sendQueue['ROBOTIS_DATA'] = filterData ? filterData.concat(data) : data;
- }
- },
-};
-
-Entry.Robotis_openCM70 = {
- hasPracticalCourse: true,
- INSTRUCTION: {
- NONE: 0,
- WRITE: 3,
- READ: 2,
- },
- CONTROL_TABLE: {
- // [default address, default length, address (when reads together), length (when reads together)]
- CM_LED_R: [79, 1],
- CM_LED_G: [80, 1],
- CM_LED_B: [81, 1],
- CM_BUZZER_INDEX: [84, 1],
- CM_BUZZER_TIME: [85, 1],
- CM_SOUND_DETECTED: [86, 1],
- CM_SOUND_DETECTING: [87, 1],
- CM_USER_BUTTON: [26, 1],
- CM_MOTION: [66, 1],
-
- AUX_SERVO_POSITION: [152, 2],
- AUX_IR: [168, 2],
- AUX_TOUCH: [202, 1],
- AUX_TEMPERATURE: [234, 1],
- AUX_ULTRASONIC: [242, 1],
- AUX_MAGNETIC: [250, 1],
- AUX_MOTION_DETECTION: [258, 1],
- AUX_COLOR: [266, 1],
- AUX_CUSTOM: [216, 2],
- AUX_BRIGHTNESS: [288, 2],
- AUX_HYDRO_THEMO_HUMIDITY: [274, 1],
- AUX_HYDRO_THEMO_TEMPER: [282, 1],
-
- AUX_SERVO_MODE: [126, 1],
- AUX_SERVO_SPEED: [136, 2],
- AUX_MOTOR_SPEED: [136, 2],
- AUX_LED_MODULE: [210, 1],
- },
- IRS_MODULEWRITE: {
- PORT3: false,
- PORT4: false,
- PORT5: false,
- PORT6: false,
- },
- SERVO_MODULEWRITE: {
- PORT3: false,
- PORT4: false,
- PORT5: false,
- PORT6: false,
- },
- setZero: function() {
- // instruction / address / length / value / default length
- Entry.hw.sendQueue['setZero'] = [1];
- Entry.Robotis_carCont.update();
- Entry.Robotis_carCont.setRobotisData(null);
- Entry.hw.sendQueue['setZero'] = null;
- Entry.Robotis_carCont.update();
- Entry.Robotis_carCont.setRobotisData([
- /*[Entry.Robotis_openCM70.INSTRUCTION.WRITE, 136, 2, 0],
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 138, 2, 0],
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 140, 2, 0],
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 142, 2, 0],
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 144, 2, 0],
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 146, 2, 0],*/
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 136, 12, 0],
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 79, 3, 0],
- /*[Entry.Robotis_openCM70.INSTRUCTION.WRITE, 79, 1, 0],
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 80, 1, 0],
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 81, 1, 0],*/
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 86, 1, 0], // 최종 소리 // add by kjs start 170605
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 108, 4, 0],
- /*[Entry.Robotis_openCM70.INSTRUCTION.WRITE, 108, 1, 0], // port 3
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 109, 1, 0], // port 4
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 110, 1, 0], // port 5
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 111, 1, 0] // port 6 // add by kjs end 170605*/
- ]);
-
- Entry.Robotis_carCont.update();
-
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 = false;
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 = false;
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 = false;
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 = false;
-
- Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT3 = false;
- Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT4 = false;
- Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT5 = false;
- Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT6 = false;
- /*
- Entry.hw.sendQueue['temp'] = [0];
- Entry.Robotis_carCont.update();
- Entry.hw.sendQueue['temp'] = null;*/
- //Entry.Robotis_carCont.update();
- },
- id: '7.2',
- name: 'robotis_openCM70',
- url: 'http://www.robotis.com/index/product.php?cate_code=111310',
- imageName: 'robotis_openCM70.png',
- title: {
- ko: '로보티즈 IoT',
- en: 'Robotis Open CM70',
- },
- delay: 15,
- readDelay: 30
-};
-
-Entry.Robotis_openCM70EDU = {
- hasPracticalCourse: true,
- INSTRUCTION: {
- NONE: 0,
- WRITE: 3,
- READ: 2,
- },
- CONTROL_TABLE: {
- // [default address, default length, address (when reads together), length (when reads together)]
- CM_LED_R: [79, 1],
- CM_LED_G: [80, 1],
- CM_LED_B: [81, 1],
- CM_BUZZER_INDEX: [84, 1],
- CM_BUZZER_TIME: [85, 1],
- CM_SOUND_DETECTED: [86, 1],
- CM_SOUND_DETECTING: [87, 1],
- CM_USER_BUTTON: [26, 1],
- CM_MOTION: [66, 1],
-
- AUX_SERVO_POSITION: [152, 2],
- AUX_IR: [168, 2],
- AUX_TOUCH: [202, 1],
- AUX_TEMPERATURE: [234, 1],
- AUX_ULTRASONIC: [242, 1],
- AUX_MAGNETIC: [250, 1],
- AUX_MOTION_DETECTION: [258, 1],
- AUX_COLOR: [266, 1],
- AUX_CUSTOM: [216, 2],
- AUX_BRIGHTNESS: [288, 2],
- AUX_HYDRO_THEMO_HUMIDITY: [274, 1],
- AUX_HYDRO_THEMO_TEMPER: [282, 1],
-
- AUX_SERVO_MODE: [126, 1],
- AUX_SERVO_SPEED: [136, 2],
- AUX_MOTOR_SPEED: [136, 2],
- AUX_LED_MODULE: [210, 1],
- },
- IRS_MODULEWRITE: {
- PORT3: false,
- PORT4: false,
- PORT5: false,
- PORT6: false,
- },
- SERVO_MODULEWRITE: {
- PORT3: false,
- PORT4: false,
- PORT5: false,
- PORT6: false,
- },
- setZero: function() {
- // instruction / address / length / value / default length
- Entry.hw.sendQueue['setZero'] = [1];
- Entry.Robotis_carCont.update();
- Entry.Robotis_carCont.setRobotisData(null);
- Entry.hw.sendQueue['setZero'] = null;
- Entry.Robotis_carCont.update();
- Entry.Robotis_carCont.setRobotisData([
- /*[Entry.Robotis_openCM70.INSTRUCTION.WRITE, 136, 2, 0],
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 138, 2, 0],
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 140, 2, 0],
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 142, 2, 0],
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 144, 2, 0],
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 146, 2, 0],*/
- [Entry.Robotis_openCM70EDU.INSTRUCTION.WRITE, 136, 12, 0],
- [Entry.Robotis_openCM70EDU.INSTRUCTION.WRITE, 79, 3, 0],
- /*[Entry.Robotis_openCM70.INSTRUCTION.WRITE, 79, 1, 0],
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 80, 1, 0],
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 81, 1, 0],*/
- [Entry.Robotis_openCM70EDU.INSTRUCTION.WRITE, 86, 1, 0], // 최종 소리 // add by kjs start 170605
- [Entry.Robotis_openCM70EDU.INSTRUCTION.WRITE, 108, 4, 0],
- /*[Entry.Robotis_openCM70.INSTRUCTION.WRITE, 108, 1, 0], // port 3
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 109, 1, 0], // port 4
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 110, 1, 0], // port 5
- [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 111, 1, 0] // port 6 // add by kjs end 170605*/
- ]);
-
- Entry.Robotis_carCont.update();
-
- Entry.Robotis_openCM70EDU.IRS_MODULEWRITE.PORT3 = false;
- Entry.Robotis_openCM70EDU.IRS_MODULEWRITE.PORT4 = false;
- Entry.Robotis_openCM70EDU.IRS_MODULEWRITE.PORT5 = false;
- Entry.Robotis_openCM70EDU.IRS_MODULEWRITE.PORT6 = false;
-
- Entry.Robotis_openCM70EDU.SERVO_MODULEWRITE.PORT3 = false;
- Entry.Robotis_openCM70EDU.SERVO_MODULEWRITE.PORT4 = false;
- Entry.Robotis_openCM70EDU.SERVO_MODULEWRITE.PORT5 = false;
- Entry.Robotis_openCM70EDU.SERVO_MODULEWRITE.PORT6 = false;
-
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 = false;
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 = false;
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 = false;
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 = false;
-
- Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT3 = false;
- Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT4 = false;
- Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT5 = false;
- Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT6 = false;
- /*
- Entry.hw.sendQueue['temp'] = [0];
- Entry.Robotis_carCont.update();
- Entry.hw.sendQueue['temp'] = null;*/
- //Entry.Robotis_carCont.update();
- },
- monitorTemplate: {
- imgPath: 'hw/robotis_opencm70.png',
- width: 800,
- height: 800,
- listPorts: {
- DETECTEDSOUNDE: { name: '최종소리', type: 'input', pos: { x: 0, y: 0 } },
- DETECTINGSOUNDE1: { name: '실시간소리', type: 'input', pos: { x: 0, y: 0 } },
- //SND: { name: Lang.Hw.buzzer, type: 'output', pos: { x: 0, y: 0 } },
- //FND: { name: '전원', type: 'output', pos: { x: 0, y: 0 } },
- },
- ports: {
- USERBUTTONSTATE: { name: 'USERBUTTON', type: 'input', pos: { x: 565, y: 335 } },
- //'LEDR': { name: 'R', type: 'input', pos: { x: 140, y: 300 } },
- //'LEDG': { name: 'G', type: 'input', pos: { x: 170, y: 300 } },
- //'LEDB': { name: 'B', type: 'input', pos: { x: 200, y: 300 } },
- //'GM1': { name: 'GEARD1', type: 'input', pos: { x: 450, y: 300 } },
- //'GM2': { name: 'GEARD2', type: 'input', pos: { x: 450, y: 480 } },
- MONITORPORT0: { name: 'PORT3', type: 'input', pos: { x: 320, y: 320 } },
- MONITORPORT1: { name: 'PORT4', type: 'input', pos: { x: 330, y: 330 } },
- MONITORPORT2: { name: 'PORT5', type: 'input', pos: { x: 320, y: 440 } },
- MONITORPORT3: { name: 'PORT6', type: 'input', pos: { x: 330, y: 460 } },
- },
- mode: 'both',
- },
- id: '7.3',
- name: 'robotis_openCM70EDU',
- url: 'http://www.robotis.com/index/product.php?cate_code=111310',
- imageName: 'robotis_openCM70EDU.png',
- title: {
- ko: '로보티즈 실과',
- en: 'ROBOTIS InfoRobot',
- },
- delay: 15,
-};
-
-Entry.Robotis_carCont.blockMenuBlocks = [
- 'robotis_carCont_sensor_value',
- 'robotis_carCont_cm_led',
- 'robotis_carCont_cm_sound_detected_clear',
- 'robotis_carCont_aux_motor_speed',
- 'robotis_carCont_aux_motor_speed2',
- 'robotis_carCont_cm_calibration',
-];
-
-Entry.Robotis_carCont.setLanguage = function() {
- return {
- ko: {
- template: {
- robotis_carCont_sensor_value: '%1 값',
- robotis_carCont_cm_led: '4번 LED %1 , 1번 LED %2 %3',
- robotis_carCont_cm_sound_detected_clear: '최종소리감지횟수 초기화 %1',
- robotis_carCont_aux_motor_speed:
- '%1 감속모터 속도를 %2 , 출력값을 %3 (으)로 정하기 %4',
- robotis_carCont_cm_calibration:
- '%1 적외선 센서 캘리브레이션 값을 %2 (으)로 정하기 %3',
- robotis_openCM70_cm_custom_value: '직접입력 주소 ( %1 ) %2 값',
- robotis_openCM70_sensor_value: '제어기 %1 값',
- robotis_openCM70_aux_sensor_value: '%1 %2 값',
- robotis_openCM70_cm_buzzer_index: '제어기 음계값 %1 을(를) %2 초 동안 연주 %3',
- robotis_openCM70_cm_buzzer_melody: '제어기 멜로디 %1 번 연주 %2',
- robotis_openCM70_cm_sound_detected_clear: '최종소리감지횟수 초기화 %1',
- robotis_openCM70_cm_led: '제어기 %1 LED %2 %3',
- robotis_openCM70_cm_motion: '모션 %1 번 실행 %2',
- robotis_openCM70_aux_motor_speed:
- '%1 감속모터 속도를 %2 , 출력값을 %3 (으)로 정하기 %4',
- robotis_openCM70_aux_servo_mode: '%1 서보모터 모드를 %2 (으)로 정하기 %3',
- robotis_openCM70_aux_servo_speed:
- '%1 서보모터 속도를 %2 , 출력값을 %3 (으)로 정하기 %4',
- robotis_openCM70_aux_servo_position: '%1 서보모터 위치를 %2 (으)로 정하기 %3',
- robotis_openCM70_aux_led_module: '%1 LED 모듈을 %2 (으)로 정하기 %3',
- robotis_openCM70_aux_custom: '%1 사용자 장치를 %2 (으)로 정하기 %3',
- robotis_openCM70_cm_custom: '직접입력 주소 ( %1 ) (을)를 %2 (으)로 정하기 %3',
- },
- Helper: {
- robotis_carCont_sensor_value:
- '왼쪽 접속 센서 : 접촉(1), 비접촉(0) 값 입니다.
오른쪽 접촉 센서 : 접촉(1), 비접촉(0) 값 입니다.
선택 버튼 상태 : 접촉(1), 비접촉(0) 값 입니다.
최종 소리 감지 횟수 : 마지막 실시간 소리 감지 횟수 값 입니다.
실시간 소리 감지 횟수 : 약 1초 안에 다음 소리가 감지되면 1씩 증가합니다.
왼쪽 적외선 센서 : 물체와 가까울 수록 큰 값 입니다.
오른쪽 적외선 센서 : 물체와 가까울 수록 큰 값 값 입니다.
왼쪽 적외선 센서 캘리브레이션 값 : 적외선 센서의 캘리브레이션 값 입니다.
오른쪽 적외선 센서 캘리브레이션 값 : 적외선 센서의 캘리브레이션 값 입니다.
(*캘리브레이션 값 - 적외선센서 조정 값)',
- robotis_carCont_cm_led:
- '4개의 LED 중 1번 또는 4번 LED 를 켜거나 끕니다.
LED 2번과 3번은 동작 지원하지 않습니다.',
- robotis_carCont_cm_sound_detected_clear:
- '최종 소리 감지횟 수를 0 으로 초기화 합니다.',
- robotis_carCont_aux_motor_speed: '감속모터 속도를 0 ~ 1023 의 값(으)로 정합니다.',
- robotis_carCont_cm_calibration:
- '적외선센서 조정 값(http://support.robotis.com/ko/: 자동차로봇> 2. B. 적외선 값 조정)을 직접 정합니다.',
- robotis_openCM70_sensor_value:
- '최종 소리 감지 횟수 : 마지막 실시간 소리 감지 횟수 값 입니다.
실시간 소리 감지 횟수 : 약 1초 안에 다음 소리가 감지되면 1씩 증가합니다.
사용자 버튼 상태 : 접촉(1), 비접촉(0) 값 입니다.최종 소리 감지 횟수 : 마지막 실시간 소리 감지 횟수 값 입니다.
실시간 소리 감지 횟수 : 약 1초 안에 다음 소리가 감지되면 1씩 증가합니다.
사용자 버튼 상태 : 접촉(1), 비접촉(0) 값 입니다.',
- robotis_openCM70_aux_sensor_value:
- '서보모터 위치 : 0 ~ 1023, 중간 위치의 값은 512 입니다.
적외선센서 : 물체와 가까울 수록 큰 값 입니다.
접촉센서 : 접촉(1), 비접촉(0) 값 입니다.
조도센서(CDS) : 0 ~ 1023, 밝을 수록 큰 값 입니다.
온습도센서(습도) : 0 ~ 100, 습할 수록 큰 값 입니다.
온습도센서(온도) : -20 ~ 100, 온도가 높을 수록 큰 값 입니다.
온도센서 : -20 ~ 100, 온도가 높을 수록 큰 값 입니다.
초음파센서 : -
자석센서 : 접촉(1), 비접촉(0) 값 입니다.
동작감지센서 : 동작 감지(1), 동작 미감지(0) 값 입니다.
컬러센서 : 알수없음(0), 흰색(1), 검은색(2), 빨간색(3), 녹색(4), 파란색(5), 노란색(6) 값 입니다.
사용자 장치 : 사용자 센서 제작에 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.',
- robotis_openCM70_cm_buzzer_index: '음계를 0.1 ~ 5 초 동안 연주 합니다.',
- robotis_openCM70_cm_buzzer_melody:
- "멜로디를 연주 합니다.
멜로디를 연속으로 재생하는 경우, 다음 소리가 재생되지 않으면 '흐름 > X 초 기다리기' 블록을 사용하여 기다린 후 실행합니다.",
- robotis_openCM70_cm_sound_detected_clear:
- '최종 소리 감지횟 수를 0 으로 초기화 합니다.',
- robotis_openCM70_cm_led: '제어기의 빨간색, 녹색, 파란색 LED 를 켜거나 끕니다.',
- robotis_openCM70_cm_motion: '제어기에 다운로드 되어있는 모션을 실행합니다.',
- robotis_openCM70_aux_motor_speed: '감속모터 속도를 0 ~ 1023 의 값(으)로 정합니다.',
- robotis_openCM70_aux_servo_mode:
- '서보모터를 회전모드 또는 관절모드로 정합니다.
한번 설정된 모드는 계속 적용됩니다.
회전모드는 서보모터 속도를 지정하여 서보모터를 회전 시킵니다.
관절모드는 지정한 서보모터 속도로 서보모터 위치를 이동 시킵니다.',
- robotis_openCM70_aux_servo_speed: '서보모터 속도를 0 ~ 1023 의 값(으)로 정합니다.',
- robotis_openCM70_aux_servo_position:
- '서보모터 위치를 0 ~ 1023 의 값(으)로 정합니다.
서보모터 속도와 같이 사용해야 합니다.',
- robotis_openCM70_aux_led_module: 'LED 모듈의 LED 를 켜거나 끕니다.',
- robotis_openCM70_aux_custom:
- '사용자 센서 제작에 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.',
- robotis_openCM70_cm_custom_value:
- '컨트롤 테이블 주소를 직접 입력하여 값을 확인 합니다.
컨트롤 테이블 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.',
- robotis_openCM70_cm_custom:
- '컨트롤 테이블 주소를 직접 입력하여 값을 정합니다.
컨트롤 테이블 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.',
- },
- Blocks: {
- robotis_carCont_aux_motor_speed_1: '감속모터 속도를',
- robotis_carCont_aux_motor_speed_2: ', 출력값을',
- robotis_carCont_calibration_1: '적외선 센서 캘리브레이션 값을',
- robotis_common_case_01: '(을)를',
- robotis_common_set: '(으)로 정하기',
- robotis_common_value: '값',
- robotis_common_clockwhise: '시계방향',
- robotis_common_counter_clockwhise: '반시계방향',
- robotis_common_wheel_mode: '회전모드',
- robotis_common_joint_mode: '관절모드',
- robotis_common_red_color: '빨간색',
- robotis_common_green_color: '녹색',
- robotis_common_blue_color: '파란색',
- robotis_common_on: '켜기',
- robotis_common_off: '끄기',
- robotis_common_cm: '제어기',
- robotis_common_port_1: '포트 1',
- robotis_common_port_2: '포트 2',
- robotis_common_port_3: '포트 3',
- robotis_common_port_4: '포트 4',
- robotis_common_port_5: '포트 5',
- robotis_common_port_6: '포트 6',
- robotis_common_play_buzzer: '연주',
- robotis_common_play_motion: '실행',
- robotis_common_motion: '모션',
- robotis_common_index_number: '번',
- robotis_cm_custom: '직접입력 주소',
- robotis_cm_spring_left: '왼쪽 접촉 센서',
- robotis_cm_spring_right: '오른쪽 접촉 센서',
- robotis_cm_led_left: '왼쪽 LED',
- robotis_cm_led_right: '오른쪽 LED',
- robotis_cm_led_both: '양 쪽 LED',
- robotis_cm_switch: '선택 버튼 상태',
- robotis_cm_user_button: '사용자 버튼 상태',
- robotis_cm_sound_detected: '최종 소리 감지 횟수',
- robotis_cm_sound_detecting: '실시간 소리 감지 횟수',
- robotis_cm_ir_left: '왼쪽 적외선 센서',
- robotis_cm_ir_right: '오른쪽 적외선 센서',
- robotis_cm_calibration_left: '왼쪽 적외선 센서 캘리브레이션 값',
- robotis_cm_calibration_right: '오른쪽 적외선 센서 캘리브레이션 값',
- robotis_cm_clear_sound_detected: '최종소리감지횟수 초기화',
- robotis_cm_buzzer_index: '음계값',
- robotis_cm_buzzer_melody: '멜로디',
- robotis_cm_led_1: '1번 LED',
- robotis_cm_led_4: '4번 LED',
- robotis_aux_servo_position: '서보모터 위치',
- robotis_aux_ir: '적외선센서',
- robotis_aux_touch: '접촉센서',
- robotis_aux_brightness: '조도센서(CDS)',
- robotis_aux_hydro_themo_humidity: '온습도센서(습도)',
- robotis_aux_hydro_themo_temper: '온습도센서(온도)',
- robotis_aux_temperature: '온도센서',
- robotis_aux_ultrasonic: '초음파센서',
- robotis_aux_magnetic: '자석센서',
- robotis_aux_motion_detection: '동작감지센서',
- robotis_aux_color: '컬러센서',
- robotis_aux_custom: '사용자 장치',
- },
- },
- en: {
- template: {
- robotis_carCont_sensor_value: 'Value %1',
- robotis_carCont_cm_led: '%1 LED 4, %2 LED %3',
- robotis_carCont_cm_sound_detected_clear:
- 'Initialize the final number of sound detection %1',
- robotis_carCont_aux_motor_speed:
- 'Set the speed of decelerating motor of %1 to %2, and the output value to %3 %4',
- robotis_carCont_cm_calibration:
- 'Set %1 value of infrared sensor calibration to %2 %3',
- robotis_openCM70_cm_custom_value: 'Custom address ( %1 ) value %2',
- robotis_openCM70_sensor_value: 'Controller value %1',
- robotis_openCM70_aux_sensor_value: 'Value %1 %2',
- robotis_openCM70_cm_buzzer_index:
- 'Play %1 controller scale value for %2 seconds %3 ',
- robotis_openCM70_cm_buzzer_melody: 'Play controller melody %1 times %2',
- robotis_openCM70_cm_sound_detected_clear:
- 'Initialize the final number of sound detection %1',
- robotis_openCM70_cm_led: 'Controller %1 LED %2 %3',
- robotis_openCM70_cm_motion: 'Play the motion %1 times',
- robotis_openCM70_aux_motor_speed:
- 'Set the speed of decelerating motor of %1 to %2 , and the output value to %3 %4',
- robotis_openCM70_aux_servo_mode: 'Set the mode of %1 servo motor to %2 %3',
- robotis_openCM70_aux_servo_speed:
- 'Set the speed of servo motor of %1 to %2 , and the output value to %3 %4',
- robotis_openCM70_aux_servo_position: 'Set the position of %1 servo motor to %2 %3',
- robotis_openCM70_aux_led_module: 'Set the LED module of %1 as %2 %3',
- robotis_openCM70_aux_custom: 'Set the user device of %1 as %2 %3',
- robotis_openCM70_cm_custom: 'Set the custom address ( %1 ) as %2 %3',
- },
- Helper: {
- robotis_openCM70_sensor_value:
- 'Final number of sound detection : the value of the final detected sound times.
Number of live sound detection : increases by 1 when it detects the next sound within 1 second.
Status of user button: the value of contact (1), non-contact (0).Final number of sound detection : the value of the number of last live sound detection.
Number of live sound detection : increases by 1 when it detects the next sound within 1 second.
Status of user button : the value of contact (1), non-contact (0).',
- robotis_openCM70_aux_sensor_value:
- "Position of servo motor: 0-1023, the value of the middle is 512.
Infrared sensor : the value is larger when it's close to an object.
Contact sensor: the value of contact(1), non-contact(0).
CDS: 0-1023, the value is larger when it's brighter.
Temperature-humidity sensor (humidity) : 0-100, the value is larger when it's more humid.
Temperature-humidity sensor (temperature) : -20 - 100, the value is larger when it's higher in temperature.
Temperature sensor : -20 - 100, the value is larger when it's higher in temperature.
Ultrasound sensor: -
Magnetic sensor : the value of contact(1), non-contact(0).
Motion detector: the value of detected motion(1), non-detected motion(0).
Color sensor: the value of unknown(0), white(1), black(2), red(3), green(4), blue(5), yellow(6).
User device: please refer to ROBOTIS e-manual (http://support.robotis.com/ko/) for the explanation on user sensor production.",
- robotis_openCM70_cm_buzzer_index: 'Plays the scale for 0.1 to 5 seconds.',
- robotis_openCM70_cm_buzzer_melody:
- "Plays melody.
If the following sound doesn't play when repeatedly playing melodies, use the block 'flow > wait for X seconds' and execute it again.",
- robotis_openCM70_cm_sound_detected_clear: 'Final number of sound detection ',
- robotis_openCM70_cm_led: 'Turns the red, green, blue LED of the device on or off.',
- robotis_openCM70_cm_motion: 'Executes the motion downloaded on the device.',
- robotis_openCM70_aux_motor_speed:
- 'Sets the speed of decelerating motor to the value of 0 - 1023.',
- robotis_openCM70_aux_servo_mode:
- "Sets the servo motor as wheel mode or joint mode.
The same mode continues to apply once it's set.
Wheel mode designates the servo motor's speed, and spins the servo motor.
Joint mode moves the servo motor's position with the set servo motor speed.",
- robotis_openCM70_aux_servo_speed:
- "Sets servo motor's speed to the value of 0 - 1023.",
- robotis_openCM70_aux_servo_position:
- "Sets servo motor's position to the value of 0-1023.
Use as servo motor speed",
- robotis_openCM70_aux_led_module: 'Turns the LED of LED module on or off.',
- robotis_openCM70_aux_custom:
- 'Please refer to the ROBOTIS e-manual (http://support.robotis.com/ko/) for the explanation of user sensor production.',
- robotis_openCM70_cm_custom_value:
- 'Checks the value by directly inputting the control table address.
Please refer to the ROBOTIS e-manual (http://support.robotis.com/ko/) for the explanation about control table.',
- robotis_openCM70_cm_custom:
- 'Checks the value by directly inputting the control table address.
Please refer to the ROBOTIS e-manual (http://support.robotis.com/ko/) for the explanation about control table.',
- robotis_carCont_sensor_value:
- "Left connected sensor : the value of contact (1), non-contact (0).
Right contact sensor: the value of contact (1), non-contact (0).
Final number of sound detection : the value of the number of last live sound detection.
Number of live sound detection : increases by 1 when it detects the next sound within 1 second.
Right infrared sensor: the value is larger when it's closer to an object.
Value of left infrared sensor calibration : the calibration value of the infrared sensor.
Value of right infrared sensor calibration : the calibration value of the infrared sensor.
(*Calibration value - control value of infrared sensor)",
- robotis_carCont_cm_led:
- 'Turns LED 1 or LED 4 among the 4 LEDs on or off.
Not applicable to LED 2 and LED 3.',
- robotis_carCont_cm_sound_detected_clear:
- 'Initializes the final amount of detected sound to 0.',
- robotis_carCont_aux_motor_speed:
- 'Sets the speed of decelerating motor to the value of 0-1023.',
- robotis_carCont_cm_calibration:
- 'Sets the controlling value of infrared sensor (http://support.robotis.com/ko/: automobile robot> 2. B. control infrared value).',
- },
- Blocks: {
- robotis_carCont_aux_motor_speed_1: 'Speed of decelerating motor',
- robotis_carCont_aux_motor_speed_2: ', the output value',
- robotis_carCont_calibration_1: 'Value of the infrared sensor calibration ',
- robotis_common_case_01: '(을)를',
- robotis_common_set: 'the output value',
- robotis_common_value: 'Value',
- robotis_common_clockwhise: 'Clockwise',
- robotis_common_counter_clockwhise: 'Counterclockwise',
- robotis_common_wheel_mode: 'Wheel mode',
- robotis_common_joint_mode: 'Joint mode',
- robotis_common_red_color: 'Red',
- robotis_common_green_color: 'Green',
- robotis_common_blue_color: 'Blue',
- robotis_common_on: 'Turn on',
- robotis_common_off: 'Turn off',
- robotis_common_cm: 'Controller',
- robotis_common_port_1: 'Port 1',
- robotis_common_port_2: 'Port 2',
- robotis_common_port_3: 'Port 3',
- robotis_common_port_4: 'Port 4',
- robotis_common_port_5: 'Port 5',
- robotis_common_port_6: 'Port 6',
- robotis_common_play_buzzer: 'Play',
- robotis_common_play_motion: 'Play',
- robotis_common_motion: 'Motion',
- robotis_common_index_number: 'Number',
- robotis_cm_custom: 'Custom address',
- robotis_cm_spring_left: 'Left contact sensor',
- robotis_cm_spring_right: 'Right contact sensor',
- robotis_cm_led_left: 'Left LED',
- robotis_cm_led_right: 'Right LED',
- robotis_cm_led_both: 'Both LED',
- robotis_cm_switch: 'Status of the switch',
- robotis_cm_user_button: 'Status of user button',
- robotis_cm_sound_detected: 'Final number of sound detection ',
- robotis_cm_sound_detecting: 'Number of live sound detection ',
- robotis_cm_ir_left: 'Left infrared sensor',
- robotis_cm_ir_right: 'Right infrared sensor',
- robotis_cm_calibration_left: 'Value of the left infrared sensor calibration ',
- robotis_cm_calibration_right: 'Value of the right infrared sensor calibration ',
- robotis_cm_clear_sound_detected: 'Initialize the final number of sound detection',
- robotis_cm_buzzer_index: 'Scale index',
- robotis_cm_buzzer_melody: 'Melody',
- robotis_cm_led_1: 'LED 1',
- robotis_cm_led_4: 'LED 4',
- robotis_aux_servo_position: 'Position of servo motor',
- robotis_aux_ir: 'Infrared sensor',
- robotis_aux_touch: 'Contact sensor',
- robotis_aux_brightness: 'CDS',
- robotis_aux_hydro_themo_humidity: 'Temperature-humidity sensor (humidity)',
- robotis_aux_hydro_themo_temper: 'Temperature-humidity sensor (temperature)',
- robotis_aux_temperature: 'Temperature sensor',
- robotis_aux_ultrasonic: 'Ultrasonic sensor',
- robotis_aux_magnetic: 'Magnetic sensor',
- robotis_aux_motion_detection: 'Motion detector',
- robotis_aux_color: 'Color sensor',
- robotis_aux_custom: 'User device',
- },
- },
- };
-};
-
-Entry.Robotis_carCont.getBlocks = function() {
- return {
- //region robotis 로보티즈 carCont
- robotis_carCont_sensor_value: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- fontColor: '#fff',
- skeleton: 'basic_string_field',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_cm_spring_left, 'CM_SPRING_LEFT'],
- [Lang.Blocks.robotis_cm_spring_right, 'CM_SPRING_RIGHT'],
- [Lang.Blocks.robotis_cm_switch, 'CM_SWITCH'],
- [Lang.Blocks.robotis_cm_sound_detected, 'CM_SOUND_DETECTED'],
- [Lang.Blocks.robotis_cm_sound_detecting, 'CM_SOUND_DETECTING'],
- [Lang.Blocks.robotis_cm_ir_left, 'CM_IR_LEFT'],
- [Lang.Blocks.robotis_cm_ir_right, 'CM_IR_RIGHT'],
- [Lang.Blocks.robotis_cm_calibration_left, 'CM_CALIBRATION_LEFT'],
- [Lang.Blocks.robotis_cm_calibration_right, 'CM_CALIBRATION_RIGHT'],
- ],
- value: 'CM_SPRING_LEFT',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- ],
- events: {},
- def: {
- params: [null],
- type: 'robotis_carCont_sensor_value',
- },
- paramsKeyMap: {
- SENSOR: 0,
- },
- class: 'robotis_carCont_cm',
- isNotFor: ['robotis_carCont'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
- var data_instruction = Entry.Robotis_carCont.INSTRUCTION.READ;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- var data_default_address = 0;
- var data_default_length = 0;
-
- var sensor = script.getStringField('SENSOR');
-
- if (sensor == 'CM_SPRING_LEFT') {
- data_default_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[0];
- data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[1];
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[2];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[3];
- } else if (sensor == 'CM_SPRING_RIGHT') {
- data_default_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[0];
- data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[1];
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[2];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[3];
- } else if (sensor == 'CM_SWITCH') {
- data_default_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0];
- data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1];
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1];
- } else if (sensor == 'CM_SOUND_DETECTED') {
- data_default_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0];
- data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1];
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1];
- } else if (sensor == 'CM_SOUND_DETECTING') {
- data_default_address =
- Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0];
- data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1];
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1];
- } else if (sensor == 'CM_IR_LEFT') {
- data_default_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[0];
- data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[1];
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[2];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[3];
- } else if (sensor == 'CM_IR_RIGHT') {
- data_default_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[0];
- data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[1];
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[2];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[3];
- } else if (sensor == 'CM_CALIBRATION_LEFT') {
- data_default_address =
- Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0];
- data_default_length =
- Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1];
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1];
- } else if (sensor == 'CM_CALIBRATION_RIGHT') {
- data_default_address =
- Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0];
- data_default_length =
- Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1];
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1];
- } else if (sensor == 'CM_BUTTON_STATUS') {
- data_default_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0];
- data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1];
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1];
- }
-
- //Entry.Robotis_carCont.setRobotisData([[data_instruction, data_address, data_length, data_value, data_default_length]]);
- //// Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
- //Entry.Robotis_carCont.update();
- //
- //return Entry.hw.portData[data_default_address];
-
- if (
- Entry.hw.sendQueue.prevAddress &&
- Entry.hw.sendQueue.prevAddress == data_default_address
- ) {
- if (
- Entry.hw.sendQueue.prevTime &&
- new Date() - Entry.hw.sendQueue.prevTime < 300
- ) {
- //throw new Entry.Utils.AsyncError();
- return Entry.hw.sendQueue.prevResult;
- }
- }
-
- Entry.Robotis_carCont.setRobotisData([
- [data_instruction, data_address, data_length, data_value, data_default_length],
- ]);
- // Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
- Entry.Robotis_carCont.update();
-
- var result = Entry.hw.portData[data_default_address];
- Entry.hw.sendQueue.prevAddress = data_default_address;
- Entry.hw.sendQueue.prevTime = new Date();
- Entry.hw.sendQueue.prevResult = result;
-
- return result;
- },
- syntax: { js: [], py: ['Robotis.carcont_sensor_value(%1)'] },
- },
- robotis_carCont_cm_led: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_on, '1'],
- [Lang.Blocks.robotis_common_off, '0'],
- ],
- value: '1',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_on, '1'],
- [Lang.Blocks.robotis_common_off, '0'],
- ],
- value: '1',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null, null, null],
- type: 'robotis_carCont_cm_led',
- },
- paramsKeyMap: {
- VALUE_LEFT: 0,
- VALUE_RIGHT: 1,
- },
- class: 'robotis_carCont_cm',
- isNotFor: ['robotis_carCont'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
- var value_left = script.getField('VALUE_LEFT', script);
- var value_right = script.getField('VALUE_RIGHT', script);
-
- var data_instruction = Entry.Robotis_carCont.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[0];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[1];
-
- if (value_left == 1 && value_right == 1) {
- data_value = 9;
- } else if (value_left == 1 && value_right == 0) {
- data_value = 8;
- }
- if (value_left == 0 && value_right == 1) {
- data_value = 1;
- }
-
- var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_carCont.delay
- );
- },
- syntax: { js: [], py: ['Robotis.carcont_cm_led(%1, %2)'] },
- },
- robotis_carCont_cm_sound_detected_clear: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null],
- type: 'robotis_carCont_cm_sound_detected_clear',
- },
- class: 'robotis_carCont_cm',
- isNotFor: ['robotis_carCont'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
-
- var data_instruction = Entry.Robotis_carCont.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1];
- data_value = 0;
-
- var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_carCont.delay
- );
- },
- syntax: { js: [], py: ['Robotis.carcont_cm_sound_clear()'] },
- },
- robotis_carCont_aux_motor_speed: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.General.left, 'LEFT'],
- [Lang.General.right, 'RIGHT'],
- ],
- value: 'LEFT',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_clockwhise, 'CW'],
- [Lang.Blocks.robotis_common_counter_clockwhise, 'CCW'],
- ],
- value: 'CW',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- null,
- {
- type: 'number',
- params: ['500'],
- },
- null,
- ],
- type: 'robotis_carCont_aux_motor_speed',
- },
- paramsKeyMap: {
- DIRECTION: 0,
- DIRECTION_ANGLE: 1,
- VALUE: 2,
- },
- class: 'robotis_carCont_cm',
- isNotFor: ['robotis_carCont'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
- var direction = script.getField('DIRECTION', script);
- var directionAngle = script.getField('DIRECTION_ANGLE', script);
- var value = script.getNumberValue('VALUE');
-
- var data_instruction = Entry.Robotis_carCont.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- if (direction == 'LEFT') {
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[0];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[1];
- } else {
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[0];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[1];
- }
-
- if (directionAngle == 'CW') {
- value = value + 1024;
- if (value > 2047) {
- value = 2047;
- }
- } else {
- if (value > 1023) {
- value = 1023;
- }
- }
-
- data_value = value;
-
- var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_carCont.delay
- );
- },
- syntax: {
- js: [],
- py: ['Robotis.carcont_aux_motor_speed(%1, %2, %3)'],
- },
- },
- robotis_carCont_aux_motor_speed2: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- template:
- '왼쪽 감속모터 속도를 %1, 출력값을 %2 (으)로 오른쪽 감속모터 속도를 %3, 출력값을 %4 (으)로 정하기 %5',
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_clockwhise, 'CW'],
- [Lang.Blocks.robotis_common_counter_clockwhise, 'CCW'],
- ],
- value: 'CW',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_clockwhise, 'CW'],
- [Lang.Blocks.robotis_common_counter_clockwhise, 'CCW'],
- ],
- value: 'CW',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- {
- type: 'number',
- params: ['500'],
- },
- null,
- {
- type: 'number',
- params: ['500'],
- },
- null,
- ],
- type: 'robotis_carCont_aux_motor_speed2',
- },
- paramsKeyMap: {
- LEFT_ANGLE: 0,
- LEFT_VALUE: 1,
- RIGHT_ANGLE: 2,
- RIGHT_VALUE: 3,
- },
- class: 'robotis_carCont_cm',
- isNotFor: ['robotis_carCont'],
- func: function(sprite, script) {
- var data_instruction = Entry.Robotis_carCont.INSTRUCTION.WRITE,
- address = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[0];
-
- var leftAngle = script.getField('LEFT_ANGLE', script);
- var leftValue = script.getNumberValue('LEFT_VALUE');
- var rightAngle = script.getField('RIGHT_ANGLE', script);
- var rightValue = script.getNumberValue('RIGHT_VALUE');
-
- leftValue = Math.min(leftValue, 1023);
- leftValue = Math.max(leftValue, 0);
- rightValue = Math.min(rightValue, 1023);
- rightValue = Math.max(rightValue, 0);
-
- if (leftAngle === 'CW') {
- leftValue += 1024;
- }
- if (rightAngle === 'CW') {
- rightValue += 1024;
- }
-
- var value = leftValue + (rightValue << 16);
- var data_sendqueue = [[data_instruction, address, 4, value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_carCont.delay
- );
- },
- },
- robotis_carCont_cm_calibration: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.General.left, 'LEFT'],
- [Lang.General.right, 'RIGHT'],
- ],
- value: 'LEFT',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- {
- type: 'number',
- params: ['0'],
- },
- null,
- ],
- type: 'robotis_carCont_cm_calibration',
- },
- paramsKeyMap: {
- DIRECTION: 0,
- VALUE: 1,
- },
- class: 'robotis_carCont_cm',
- isNotFor: ['robotis_carCont'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
- var direction = script.getField('DIRECTION', script);
- var value = script.getNumberValue('VALUE');
-
- var data_instruction = Entry.Robotis_carCont.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- if (direction == 'LEFT') {
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1];
- } else {
- data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0];
- data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1];
- }
-
- data_value = value;
-
- var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_carCont.delay
- );
-
- // Entry.hw.sendQueue['ROBOTIS_DATA'] = [[data_instruction, data_address, data_length, data_value]];
- // update();
- // return script.callReturn();
- },
- syntax: { js: [], py: ['Robotis.carcont_cm_calibration(%1, %2)'] },
- },
- //endregion robotis 로보티즈
- };
-};
-
-Entry.Robotis_openCM70.blockMenuBlocks = [
- //robotis_openCM70
- 'robotis_openCM70_sensor_value',
- 'robotis_openCM70_aux_sensor_value',
- 'robotis_openCM70_cm_buzzer_index',
- 'robotis_openCM70_cm_buzzer_melody',
- 'robotis_openCM70_cm_sound_detected_clear',
- 'robotis_openCM70_cm_led',
- 'robotis_openCM70_cm_motion',
- 'robotis_openCM70_aux_motor_speed',
- 'robotis_openCM70_aux_servo_mode',
- 'robotis_openCM70_aux_servo_speed',
- 'robotis_openCM70_aux_servo_position',
- 'robotis_openCM70_aux_led_module',
- 'robotis_openCM70_aux_custom',
- 'robotis_openCM70_cm_custom_value',
- 'robotis_openCM70_cm_custom',
-];
-
-Entry.Robotis_openCM70.getBlocks = function() {
- return {
- //region robotis 로보티즈 openCM70
- robotis_openCM70_cm_custom_value: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- fontColor: '#fff',
- skeleton: 'basic_string_field',
- statements: [],
- params: [
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Dropdown',
- options: [
- ['BYTE', 'BYTE'],
- ['WORD', 'WORD'],
- ['DWORD', 'DWORD'],
- ],
- value: 'BYTE',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- ],
- events: {},
- def: {
- params: [
- {
- type: 'number',
- params: ['0'],
- },
- null,
- ],
- type: 'robotis_openCM70_cm_custom_value',
- },
- paramsKeyMap: {
- VALUE: 0,
- SIZE: 1,
- },
- class: 'robotis_openCM70_custom',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- func: function(sprite, script) {
- var scope = script.executor.scope;
-
- // instruction / address / length / value / default length
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.READ;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- var data_default_address = 0;
- var data_default_length = 0;
-
- var size = script.getStringField('SIZE');
-
- if (size == 'BYTE') {
- data_length = 1;
- } else if (size == 'WORD') {
- data_length = 2;
- } else if (size == 'DWORD') {
- data_length = 4;
- }
-
- data_address = script.getNumberValue('VALUE');
-
- data_default_address = data_address;
- data_default_length = data_length;
-
- if (
- Entry.hw.sendQueue.prevAddress &&
- Entry.hw.sendQueue.prevAddress == data_default_address
- ) {
- if (
- Entry.hw.sendQueue.prevTime &&
- new Date() - Entry.hw.sendQueue.prevTime < 200
- ) {
- //throw new Entry.Utils.AsyncError();
- return Entry.hw.sendQueue.prevResult;
- }
- }
-
- Entry.Robotis_carCont.setRobotisData([
- [data_instruction, data_address, data_length, data_value, data_default_length],
- ]);
- // Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
- Entry.Robotis_carCont.update();
-
- var result = Entry.hw.portData[data_default_address];
- Entry.hw.sendQueue.prevAddress = data_default_address;
- Entry.hw.sendQueue.prevTime = new Date();
- Entry.hw.sendQueue.prevResult = result;
-
- return result;
- },
- syntax: {
- js: [],
- py: ['Robotis.opencm70_cm_custom_value(%1, %2)'],
- },
- },
- robotis_openCM70_sensor_value: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- fontColor: '#fff',
- skeleton: 'basic_string_field',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_cm_sound_detected, 'CM_SOUND_DETECTED'],
- [Lang.Blocks.robotis_cm_sound_detecting, 'CM_SOUND_DETECTING'],
- [Lang.Blocks.robotis_cm_user_button, 'CM_USER_BUTTON'],
- ],
- value: 'CM_SOUND_DETECTED',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- ],
- events: {},
- def: {
- params: [null],
- type: 'robotis_openCM70_sensor_value',
- },
- paramsKeyMap: {
- SENSOR: 0,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- func: function(sprite, script) {
- var scope = script.executor.scope;
-
- scope.isStart = true;
- scope.count = 0;
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.READ;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- var data_default_address = 0;
- var data_default_length = 0;
-
- var sensor = script.getStringField('SENSOR');
-
- var increase = 0;
-
- if (sensor == 'CM_SOUND_DETECTED') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0];
- data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1];
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1];
- } else if (sensor == 'CM_SOUND_DETECTING') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1];
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1];
- } else if (sensor == 'CM_USER_BUTTON') {
- data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0];
- data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1];
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1];
- }
-
- data_default_address = data_default_address + increase * data_default_length;
-
- if (
- Entry.hw.sendQueue.prevAddress &&
- Entry.hw.sendQueue.prevAddress == data_default_address
- ) {
- if (
- Entry.hw.sendQueue.prevTime &&
- new Date() - Entry.hw.sendQueue.prevTime < 200
- ) {
- //throw new Entry.Utils.AsyncError();
- return Entry.hw.sendQueue.prevResult;
- }
- }
-
- Entry.Robotis_carCont.setRobotisData([
- [data_instruction, data_address, data_length, data_value, data_default_length],
- ]);
- // Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
- Entry.Robotis_carCont.update();
-
- var result = Entry.hw.portData[data_default_address];
- Entry.hw.sendQueue.prevAddress = data_default_address;
- Entry.hw.sendQueue.prevTime = new Date();
- Entry.hw.sendQueue.prevResult = result;
-
- return result;
- },
- syntax: { js: [], py: ['Robotis.opencm70_sensor_value(%1)'] },
- },
- robotis_openCM70_aux_sensor_value: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- fontColor: '#fff',
- skeleton: 'basic_string_field',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- ['3', 'PORT_3'],
- ['4', 'PORT_4'],
- ['5', 'PORT_5'],
- ['6', 'PORT_6'],
- ],
- value: 'PORT_3',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_aux_servo_position, 'AUX_SERVO_POSITION'],
- [Lang.Blocks.robotis_aux_ir, 'AUX_IR'],
- [Lang.Blocks.robotis_aux_touch, 'AUX_TOUCH'],
- [Lang.Blocks.robotis_aux_brightness, 'AUX_BRIGHTNESS'],
- [Lang.Blocks.robotis_aux_hydro_themo_humidity, 'AUX_HYDRO_THEMO_HUMIDITY'],
- [Lang.Blocks.robotis_aux_hydro_themo_temper, 'AUX_HYDRO_THEMO_TEMPER'],
- [Lang.Blocks.robotis_aux_temperature, 'AUX_TEMPERATURE'],
- [Lang.Blocks.robotis_aux_ultrasonic, 'AUX_ULTRASONIC'],
- [Lang.Blocks.robotis_aux_magnetic, 'AUX_MAGNETIC'],
- [Lang.Blocks.robotis_aux_motion_detection, 'AUX_MOTION_DETECTION'],
- [Lang.Blocks.robotis_aux_color, 'AUX_COLOR'],
- [Lang.Blocks.robotis_aux_custom, 'AUX_CUSTOM'],
- ],
- value: 'AUX_SERVO_POSITION',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- ],
- events: {},
- def: {
- params: [null, null],
- type: 'robotis_openCM70_aux_sensor_value',
- },
- paramsKeyMap: {
- PORT: 0,
- SENSOR: 1,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- func: function(sprite, script) {
- var scope = script.executor.scope;
-
- // instruction / address / length / value / default length
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.READ;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- var data_default_address = 0;
- var data_default_length = 0;
-
- var port = script.getStringField('PORT');
- var sensor = script.getStringField('SENSOR');
-
- var increase = 0;
- if (port == 'PORT_3') {
- increase = 2;
- } else if (port == 'PORT_4') {
- increase = 3;
- } else if (port == 'PORT_5') {
- increase = 4;
- } else if (port == 'PORT_6') {
- increase = 5;
- }
-
- if (sensor == 'AUX_SERVO_POSITION') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];
- } else if (sensor == 'AUX_IR') {
- data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0];
- data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1];
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1];
- } else if (sensor == 'AUX_TOUCH') {
- data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0];
- data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1];
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1];
- } else if (sensor == 'AUX_TEMPERATURE') {
- data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0];
- data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1];
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1];
- } else if (sensor == 'AUX_BRIGHTNESS') {
- data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0];
- data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1];
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1];
- } else if (sensor == 'AUX_HYDRO_THEMO_HUMIDITY') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1];
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1];
- } else if (sensor == 'AUX_HYDRO_THEMO_TEMPER') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1];
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1];
- } else if (sensor == 'AUX_ULTRASONIC') {
- data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0];
- data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1];
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1];
- } else if (sensor == 'AUX_MAGNETIC') {
- data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0];
- data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1];
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1];
- } else if (sensor == 'AUX_MOTION_DETECTION') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1];
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1];
- } else if (sensor == 'AUX_COLOR') {
- data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0];
- data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1];
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1];
- } else if (sensor == 'AUX_CUSTOM') {
- data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];
- data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];
- }
-
- data_default_address = data_default_address + increase * data_default_length;
- data_address = data_default_address;
- // if (increase != 0) {
- // data_length = 6 * data_default_length;
- // }
-
- if (
- Entry.hw.sendQueue.prevAddress &&
- Entry.hw.sendQueue.prevAddress == data_default_address
- ) {
- if (
- Entry.hw.sendQueue.prevTime &&
- new Date() - Entry.hw.sendQueue.prevTime < 200
- ) {
- //throw new Entry.Utils.AsyncError();
- return Entry.hw.sendQueue.prevResult;
- }
- }
-
- Entry.Robotis_carCont.setRobotisData([
- [data_instruction, data_address, data_length, data_value, data_default_length],
- ]);
- // Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
- Entry.Robotis_carCont.update();
-
- var result = Entry.hw.portData[data_default_address];
- Entry.hw.sendQueue.prevAddress = data_default_address;
- Entry.hw.sendQueue.prevTime = new Date();
- Entry.hw.sendQueue.prevResult = result;
-
- return result;
- },
- syntax: {
- js: [],
- py: ['Robotis.opencm70_aux_sensor_value(%1, %2)'],
- },
- },
- robotis_openCM70_cm_buzzer_index: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.General.note_a + '(0)', '0'],
- [Lang.General.note_a + '#(1)', '1'],
- [Lang.General.note_b + '(2)', '2'],
- [Lang.General.note_c + '(3)', '3'],
- [Lang.General.note_c + '#(4)', '4'],
- [Lang.General.note_d + '(5)', '5'],
- [Lang.General.note_d + '#(6)', '6'],
- [Lang.General.note_e + '(7)', '7'],
- [Lang.General.note_f + '(8)', '8'],
- [Lang.General.note_f + '#(9)', '9'],
- [Lang.General.note_g + '(10)', '10'],
- [Lang.General.note_g + '#(11)', '11'],
- [Lang.General.note_a + '(12)', '12'],
- [Lang.General.note_a + '#(13)', '13'],
- [Lang.General.note_b + '(14)', '14'],
- [Lang.General.note_c + '(15)', '15'],
- [Lang.General.note_c + '#(16)', '16'],
- [Lang.General.note_d + '(17)', '17'],
- [Lang.General.note_d + '#(18)', '18'],
- [Lang.General.note_e + '(19)', '19'],
- [Lang.General.note_f + '(20)', '20'],
- [Lang.General.note_f + '#(21)', '21'],
- [Lang.General.note_g + '(22)', '22'],
- [Lang.General.note_g + '#(23)', '23'],
- [Lang.General.note_a + '(24)', '24'],
- [Lang.General.note_a + '#(25)', '25'],
- [Lang.General.note_b + '(26)', '26'],
- [Lang.General.note_c + '(27)', '27'],
- [Lang.General.note_c + '#(28)', '28'],
- [Lang.General.note_d + '(29)', '29'],
- [Lang.General.note_d + '#(30)', '30'],
- [Lang.General.note_e + '(31)', '31'],
- [Lang.General.note_f + '(32)', '32'],
- [Lang.General.note_f + '#(33)', '33'],
- [Lang.General.note_g + '(34)', '34'],
- [Lang.General.note_g + '#(35)', '35'],
- [Lang.General.note_a + '(36)', '36'],
- [Lang.General.note_a + '#(37)', '37'],
- [Lang.General.note_b + '(38)', '38'],
- [Lang.General.note_c + '(39)', '39'],
- [Lang.General.note_c + '#(40)', '40'],
- [Lang.General.note_d + '(41)', '41'],
- [Lang.General.note_d + '#(42)', '42'],
- [Lang.General.note_e + '(43)', '43'],
- [Lang.General.note_f + '(44)', '44'],
- [Lang.General.note_f + '#(45)', '45'],
- [Lang.General.note_g + '(46)', '46'],
- [Lang.General.note_g + '#(47)', '47'],
- [Lang.General.note_a + '(48)', '48'],
- [Lang.General.note_a + '#(49)', '49'],
- [Lang.General.note_b + '(50)', '50'],
- [Lang.General.note_c + '(51)', '51'],
- ],
- value: '0',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- {
- type: 'number',
- params: ['1'],
- },
- null,
- ],
- type: 'robotis_openCM70_cm_buzzer_index',
- },
- paramsKeyMap: {
- CM_BUZZER_INDEX: 0,
- CM_BUZZER_TIME: 1,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
- var cmBuzzerIndex = script.getField('CM_BUZZER_INDEX', script);
- var cmBuzzerTime = script.getNumberValue('CM_BUZZER_TIME', script);
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address_1 = 0;
- var data_length_1 = 0;
- var data_value_1 = 0;
- var data_address_2 = 0;
- var data_length_2 = 0;
- var data_value_2 = 0;
- var interval = 100;
-
- data_address_1 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];
- data_length_1 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];
- // data_value_1 = cmBuzzerTime * 10;
- // TODO 텍스트 입력으로 바꾸고 최대는 5초 : 0.5 초 하려면 5를 입력 - console.log(parseInt(0.59 * 10)); max 는 5초
- data_value_1 = parseInt(cmBuzzerTime * 10);
- if (data_value_1 > 50) {
- data_value_1 = 50;
- }
-
- data_address_2 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0];
- data_length_2 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1];
- data_value_2 = cmBuzzerIndex;
-
- var data_sendqueue = [
- [data_instruction, data_address_1, data_length_1, data_value_1],
- [data_instruction, data_address_2, data_length_2, data_value_2],
- ];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- cmBuzzerTime * 1000 + interval
- );
- },
- syntax: {
- js: [],
- py: ['Robotis.opencm70_cm_buzzer_index(%1, %2)'],
- },
- },
- robotis_openCM70_cm_buzzer_melody: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- ['0', '0'],
- ['1', '1'],
- ['2', '2'],
- ['3', '3'],
- ['4', '4'],
- ['5', '5'],
- ['6', '6'],
- ['7', '7'],
- ['8', '8'],
- ['9', '9'],
- ['10', '10'],
- ['11', '11'],
- ['12', '12'],
- ['13', '13'],
- ['14', '14'],
- ['15', '15'],
- ['16', '16'],
- ['17', '17'],
- ['18', '18'],
- ['19', '19'],
- ['20', '20'],
- ['21', '21'],
- ['22', '22'],
- ['23', '23'],
- ['24', '24'],
- ],
- value: '0',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null, null],
- type: 'robotis_openCM70_cm_buzzer_melody',
- },
- paramsKeyMap: {
- CM_BUZZER_MELODY: 0,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
- var cmBuzzerMelody = script.getField('CM_BUZZER_MELODY', script);
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address_1 = 0;
- var data_length_1 = 0;
- var data_value_1 = 0;
- var data_address_2 = 0;
- var data_length_2 = 0;
- var data_value_2 = 0;
- var interval = 100;
-
- data_address_1 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];
- data_length_1 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];
- data_value_1 = 255;
-
- data_address_2 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0];
- data_length_2 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1];
- data_value_2 = cmBuzzerMelody;
-
- var data_sendqueue = [
- [data_instruction, data_address_1, data_length_1, data_value_1],
- [data_instruction, data_address_2, data_length_2, data_value_2],
- ];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- 1000 + interval
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_cm_buzzer_melody(%1)'] },
- },
- robotis_openCM70_cm_sound_detected_clear: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null],
- type: 'robotis_openCM70_cm_sound_detected_clear',
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1];
- data_value = 0;
-
- var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_cm_sound_clear()'] },
- },
- robotis_openCM70_cm_led: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_red_color, 'CM_LED_R'],
- [Lang.Blocks.robotis_common_green_color, 'CM_LED_G'],
- [Lang.Blocks.robotis_common_blue_color, 'CM_LED_B'],
- ],
- value: 'CM_LED_R',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_on, '1'],
- [Lang.Blocks.robotis_common_off, '0'],
- ],
- value: '1',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null, null, null],
- type: 'robotis_openCM70_cm_led',
- },
- paramsKeyMap: {
- CM_LED: 0,
- VALUE: 1,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
- var cmLed = script.getField('CM_LED', script);
- var value = script.getField('VALUE', script);
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- if (cmLed == 'CM_LED_R') {
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[1];
- } else if (cmLed == 'CM_LED_G') {
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[1];
- } else if (cmLed == 'CM_LED_B') {
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[1];
- }
-
- data_value = value;
-
- var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_cm_led(%1, %2)'] },
- },
- robotis_openCM70_cm_motion: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- {
- type: 'number',
- params: ['1'],
- },
- null,
- ],
- type: 'robotis_openCM70_cm_motion',
- },
- paramsKeyMap: {
- VALUE: 0,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[1];
- data_value = script.getNumberValue('VALUE', script);
-
- var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_cm_motion(%1)'] },
- },
- robotis_openCM70_aux_motor_speed: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_port_1, '1'],
- [Lang.Blocks.robotis_common_port_2, '2'],
- ],
- value: '1',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_clockwhise, 'CW'],
- [Lang.Blocks.robotis_common_counter_clockwhise, 'CCW'],
- ],
- value: 'CW',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- null,
- {
- type: 'number',
- params: ['500'],
- },
- null,
- ],
- type: 'robotis_openCM70_aux_motor_speed',
- },
- paramsKeyMap: {
- PORT: 0,
- DIRECTION_ANGLE: 1,
- VALUE: 2,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
- var port = script.getField('PORT', script);
- var directionAngle = script.getField('DIRECTION_ANGLE', script);
- var value = script.getNumberValue('VALUE');
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1];
-
- data_address = data_address + (port - 1) * data_length;
-
- if (directionAngle == 'CW') {
- value = value + 1024;
- if (value > 2047) {
- value = 2047;
- }
- } else {
- if (value > 1023) {
- value = 1023;
- }
- }
-
- data_value = value;
-
- var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: {
- js: [],
- py: ['Robotis.opencm70_aux_motor_speed(%1, %2, %3)'],
- },
- },
- robotis_openCM70_aux_servo_mode: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_port_3, '3'],
- [Lang.Blocks.robotis_common_port_4, '4'],
- [Lang.Blocks.robotis_common_port_5, '5'],
- [Lang.Blocks.robotis_common_port_6, '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_wheel_mode, '0'],
- [Lang.Blocks.robotis_common_joint_mode, '1'],
- ],
- value: '0',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null, null, null],
- type: 'robotis_openCM70_aux_servo_mode',
- },
- paramsKeyMap: {
- PORT: 0,
- MODE: 1,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
- var port = script.getField('PORT', script);
- var mode = script.getField('MODE', script);
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[1];
-
- data_address = data_address + (port - 1) * data_length;
- data_value = mode;
-
- var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_aux_servo_mode(%1, %2)'] },
- },
- robotis_openCM70_aux_servo_speed: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_port_3, '3'],
- [Lang.Blocks.robotis_common_port_4, '4'],
- [Lang.Blocks.robotis_common_port_5, '5'],
- [Lang.Blocks.robotis_common_port_6, '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_clockwhise, 'CW'],
- [Lang.Blocks.robotis_common_counter_clockwhise, 'CCW'],
- ],
- value: 'CW',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- null,
- {
- type: 'number',
- params: ['500'],
- },
- null,
- ],
- type: 'robotis_openCM70_aux_servo_speed',
- },
- paramsKeyMap: {
- PORT: 0,
- DIRECTION_ANGLE: 1,
- VALUE: 2,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
- var port = script.getField('PORT', script);
- var directionAngle = script.getField('DIRECTION_ANGLE', script);
- var value = script.getNumberValue('VALUE');
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[1];
-
- data_address = data_address + (port - 1) * data_length;
-
- if (directionAngle == 'CW') {
- value = value + 1024;
- if (value > 2047) {
- value = 2047;
- }
- } else {
- if (value > 1023) {
- value = 1023;
- }
- }
-
- data_value = value;
-
- var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: {
- js: [],
- py: ['Robotis.opencm70_aux_servo_speed(%1, %2, %3)'],
- },
- },
- robotis_openCM70_aux_servo_position: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_port_3, '3'],
- [Lang.Blocks.robotis_common_port_4, '4'],
- [Lang.Blocks.robotis_common_port_5, '5'],
- [Lang.Blocks.robotis_common_port_6, '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- {
- type: 'number',
- params: ['512'],
- },
- null,
- ],
- type: 'robotis_openCM70_aux_servo_position',
- },
- paramsKeyMap: {
- PORT: 0,
- VALUE: 1,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
- var port = script.getField('PORT', script);
- var value = script.getNumberValue('VALUE');
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];
-
- data_address = data_address + (port - 1) * data_length;
-
- if (value > 1023) {
- value = 1023;
- } else if (value < 0) {
- value = 0;
- }
-
- data_value = value;
-
- var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: {
- js: [],
- py: ['Robotis.opencm70_aux_servo_position(%1, %2)'],
- },
- },
- robotis_openCM70_aux_led_module: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_port_3, '3'],
- [Lang.Blocks.robotis_common_port_4, '4'],
- [Lang.Blocks.robotis_common_port_5, '5'],
- [Lang.Blocks.robotis_common_port_6, '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_cm_led_both + Lang.Blocks.robotis_common_off, '0'],
- [Lang.Blocks.robotis_cm_led_right + Lang.Blocks.robotis_common_on, '1'],
- [Lang.Blocks.robotis_cm_led_left + Lang.Blocks.robotis_common_on, '2'],
- [Lang.Blocks.robotis_cm_led_both + Lang.Blocks.robotis_common_on, '3'],
- ],
- value: '0',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null, null, null],
- type: 'robotis_openCM70_aux_led_module',
- },
- paramsKeyMap: {
- PORT: 0,
- LED_MODULE: 1,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
- var port = script.getField('PORT', script);
- var ledModule = script.getField('LED_MODULE', script);
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];
-
- data_address = data_address + (port - 1) * data_length;
- data_value = ledModule;
-
- var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_aux_led_module(%1, %2)'] },
- },
- robotis_openCM70_aux_custom: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_port_3, '3'],
- [Lang.Blocks.robotis_common_port_4, '4'],
- [Lang.Blocks.robotis_common_port_5, '5'],
- [Lang.Blocks.robotis_common_port_6, '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- {
- type: 'number',
- params: ['0'],
- },
- null,
- ],
- type: 'robotis_openCM70_aux_custom',
- },
- paramsKeyMap: {
- PORT: 0,
- VALUE: 1,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
- var port = script.getField('PORT', script);
- var value = script.getNumberValue('VALUE');
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];
-
- data_address = data_address + (port - 1) * data_length;
- data_value = value;
-
- var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_aux_custom(%1, %2)'] },
- },
- robotis_openCM70_cm_custom: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- {
- type: 'number',
- params: ['0'],
- },
- {
- type: 'number',
- params: ['0'],
- },
- null,
- ],
- type: 'robotis_openCM70_cm_custom',
- },
- paramsKeyMap: {
- ADDRESS: 0,
- VALUE: 1,
- },
- class: 'robotis_openCM70_custom',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- func: function(sprite, script) {
- // instruction / address / length / value / default length
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address = script.getNumberValue('ADDRESS');
- data_value = script.getNumberValue('VALUE');
- if (data_value > 65535) {
- data_length = 4;
- } else if (data_value > 255) {
- data_length = 2;
- } else {
- data_length = 1;
- }
-
- var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_cm_custom(%1, %2)'] },
- },
- //endregion robotis 로보티즈
- };
-};
-
-Entry.Robotis_openCM70.practicalBlockMenuBlocks = {
- hw_motor: [
- 'robotis_aux_move_for',
- 'robotis_aux_stop_for',
- 'robotis_set_servo_joint',
- 'robotis_set_servo_wheel',
- 'robotis_move_for_secs',
- ],
- hw_melody: [
- 'robotis_melody_note_for',
- ],
- hw_sensor: [
- 'robotis_touch_value',
- 'robotis_touch_value_boolean',
- 'robotis_irs_value',
- 'robotis_irs_value_boolean',
- 'robotis_light_value',
- 'robotis_light_value_boolean',
- 'robotis_detectedsound_value',
- 'robotis_detectingsound_value',
- 'robotis_detectedsound_value_boolean',
- 'robotis_detectingsound_value_boolean',
- 'robotis_detectedsound_value_init',
- 'robotis_color_value',
- 'robotis_color_value_boolean',
- 'robotis_humidity_value',
- 'robotis_humidity_value_boolean',
- 'robotis_temperature_value',
- 'robotis_temperature_value_boolean',
- 'robotis_userbutton_value',
- 'robotis_userbutton_value_boolean',
- ],
- hw_led: [
- 'robotis_set_led',
- ],
-}
-
-Entry.Robotis_openCM70.getPracticalBlocks = function() {
- return{
- robotis_set_led: {
- color: '#2AB4D3',
- outerLine: '#0e93b1',
- skeleton: 'basic',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1번 포트 LED를 %2 %3',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['PORT 3', '3'],
- ['PORT 4', '4'],
- ['PORT 5', '5'],
- ['PORT 6', '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: '#0e93b1',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Dropdown',
- options: [
- ['모두 끄기', '0'],
- ['노랑색 켜기', '1'],
- ['파랑색 켜기', '2'],
- ['모두 켜기', '3'],
- ],
- value: '0',
- fontSize: 11,
- bgColor: '#0e93b1',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Indicator',
- img: 'block_icon/practical_course/light.png',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null],
- type: 'robotis_set_led',
- },
- paramsKeyMap: {
- PORT: 0,
- COLOR: 1,
- },
- class: 'robotis_led',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
-
- const port = script.getStringField('PORT');
- const value = 0;
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- let data_address = 0;
- const data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];
- const data_value = script.getNumberField('COLOR');
- switch (port) {
- case '3':
- data_address = 212;
- break;
- case '4':
- data_address = 213;
- break;
- case '5':
- data_address = 214;
- break;
- case '6':
- data_address = 215;
- break;
- }
- const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- //Entry.Robotis_carCont.update();
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- },
- robotis_touch_value: {
- color: '#2AB4D3',
- outerLine: '#0e93b1',
- skeleton: 'basic_string_field',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1번 포트 접촉 센서 값',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['PORT 3', '3'],
- ['PORT 4', '4'],
- ['PORT 5', '5'],
- ['PORT 6', '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: '#0e93b1',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- ],
- events: {},
- def: {
- params: [null],
- type: 'robotis_touch_value',
- },
- paramsKeyMap: {
- PORT: 0,
- },
- class: 'robotis_touch',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const port = script.getStringField('PORT');
- let value = 0;
-
- switch (port) {
- case '3':
- value = Entry.hw.portData.TOUCH0;
- break;
- case '4':
- value = Entry.hw.portData.TOUCH1;
- break;
- case '5':
- value = Entry.hw.portData.TOUCH2;
- break;
- case '6':
- value = Entry.hw.portData.TOUCH3;
- break;
- }
- return value;
- },
- },
- robotis_touch_value_boolean: {
- color: '#2AB4D3',
- outerLine: '#0e93b1',
- skeleton: 'basic_boolean_field',
- fontColor: '#fff',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1번 포트 접촉 센서가 %2',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['PORT 3', '3'],
- ['PORT 4', '4'],
- ['PORT 5', '5'],
- ['PORT 6', '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: '#0e93b1',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Dropdown',
- options: [
- ['접촉 되면', '1'],
- ['접촉 안되면', '0'],
- ],
- value: '1',
- fontSize: 11,
- bgColor: '#0e93b1',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- ],
- def: {
- params: [null, null, null],
- type: 'robotis_touch_value_boolean',
- },
- paramsKeyMap: {
- PORT: 0,
- TOUCH: 1,
- },
- class: 'robotis_touch',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const port = script.getStringField('PORT');
- const touch = script.getNumberField('TOUCH', script);
- let value = 0;
- switch (port) {
- case '3':
- value = Entry.hw.portData.TOUCH0;
- break;
- case '4':
- value = Entry.hw.portData.TOUCH1;
- break;
- case '5':
- value = Entry.hw.portData.TOUCH2;
- break;
- case '6':
- value = Entry.hw.portData.TOUCH3;
- break;
- }
- const isTouch = !((value == 1) ^ touch);
-
- return isTouch;
- },
- },
- robotis_irs_value: {
- color: '#C4065C',
- outerLine: '#9a0045',
- skeleton: 'basic_string_field',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1번 포트 적외선 센서 값',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['PORT 3', '3'],
- ['PORT 4', '4'],
- ['PORT 5', '5'],
- ['PORT 6', '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: '#9a0045',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- ],
- events: {},
- def: {
- params: [null],
- type: 'robotis_irs_value',
- },
- paramsKeyMap: {
- PORT: 0,
- },
- class: 'robotis_irs',
- //'isNotFor': ['mini'],
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const port = script.getStringField('PORT');
- let value = 0;
- let data_address = 0;
- switch (port) {
- case '3':
- value = Entry.hw.portData.IR0;
- data_address = 108;
- break;
- case '4':
- value = Entry.hw.portData.IR1;
- data_address = 109;
- break;
- case '5':
- value = Entry.hw.portData.IR2;
- data_address = 110;
- break;
- case '6':
- value = Entry.hw.portData.IR3;
- data_address = 111;
- break;
- }
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- const data_length = 1;
- const data_value = 2;
-
- const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- //Entry.Robotis_carCont.update();
- if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 && port == '3') {
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 = true;
- }
- if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 && port == '4') {
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 = true;
- }
- if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 && port == '5') {
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 = true;
- }
- if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 && port == '6') {
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 = true;
- }
- //var value = (Entry.hw.portData['IN' + port] > 125) ? 1 : 0;
- return value;
- },
- },
- robotis_irs_value_boolean: {
- color: '#C4065C',
- outerLine: '#9a0045',
- skeleton: 'basic_boolean_field',
- fontColor: '#fff',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1번 포트 적외선 센서 값 %2 %3',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['PORT 3', '3'],
- ['PORT 4', '4'],
- ['PORT 5', '5'],
- ['PORT 6', '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: '#9a0045',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Dropdown',
- options: [
- ['=', 'EQUAL'],
- ['>', 'GREATER'],
- ['<', 'LESS'],
- ['≥', 'GREATER_OR_EQUAL'],
- ['≤', 'LESS_OR_EQUAL'],
- ],
- value: 'LESS',
- fontSize: 11,
- bgColor: '#9a0045',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- noaRrow: true,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- ],
- def: {
- params: [
- null,
- null,
- {
- type: 'number',
- params: ['100'],
- },
- ],
- type: 'robotis_irs_value_boolean',
- },
- paramsKeyMap: {
- PORT: 0,
- OPERATOR: 1,
- RIGHTVALUE: 2,
- },
- class: 'robotis_irs',
- //'isNotFor': ['mini'],
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const port = script.getStringField('PORT', script);
- const operator = script.getField('OPERATOR', script);
- const rightValue = script.getNumberValue('RIGHTVALUE', script);
- let leftValue = 0;
- let isCheck = false;
- let data_address = 0;
-
- switch (port) {
- case '3':
- leftValue = Entry.hw.portData.IR0;
- data_address = 108;
- break;
- case '4':
- leftValue = Entry.hw.portData.IR1;
- data_address = 109;
- break;
- case '5':
- leftValue = Entry.hw.portData.IR2;
- data_address = 110;
- break;
- case '6':
- leftValue = Entry.hw.portData.IR3;
- data_address = 111;
- break;
- }
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- const data_length = 1;
- const data_value = 2;
-
- const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- //Entry.Robotis_carCont.update();
- if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 && port == '3') {
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 = true;
- }
- if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 && port == '4') {
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 = true;
- }
- if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 && port == '5') {
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 = true;
- }
- if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 && port == '6') {
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
- Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 = true;
- }
-
- switch (operator) {
- case 'EQUAL':
- isCheck = leftValue == rightValue;
- break;
- case 'GREATER':
- isCheck = Number(leftValue) > Number(rightValue);
- break;
- case 'LESS':
- isCheck = Number(leftValue) < Number(rightValue);
- break;
- case 'GREATER_OR_EQUAL':
- isCheck = Number(leftValue) >= Number(rightValue);
- break;
- case 'LESS_OR_EQUAL':
- isCheck = Number(leftValue) <= Number(rightValue);
- break;
- }
-
- return isCheck;
- },
- },
- robotis_light_value: {
- color: '#ff8d0f',
- outerLine: '#e37100',
- skeleton: 'basic_string_field',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1번 포트 빛 감지 센서 값',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['PORT 3', '0'],
- ['PORT 4', '1'],
- ['PORT 5', '2'],
- ['PORT 6', '3'],
- ],
- value: '0',
- outerLine: '#e37100',
- fontSize: 11,
- bgColor: '#e37100',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- ],
- events: {},
- def: {
- params: [null],
- type: 'robotis_light_value',
- },
- paramsKeyMap: {
- PORT: 0,
- },
- class: 'robotis_light',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const port = script.getStringField('PORT');
- return Entry.hw.portData[`LIGHT${port}`];
- },
- },
- robotis_light_value_boolean: {
- color: '#ff8d0f',
- outerLine: '#e37100',
- skeleton: 'basic_boolean_field',
- fontColor: '#fff',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1번 포트 빛 감지 센서 값 %2 %3',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['PORT 3', '0'],
- ['PORT 4', '1'],
- ['PORT 5', '2'],
- ['PORT 6', '3'],
- ],
- value: '0',
- fontSize: 11,
- bgColor: '#e37100',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Dropdown',
- options: [
- ['=', 'EQUAL'],
- ['>', 'GREATER'],
- ['<', 'LESS'],
- ['≥', 'GREATER_OR_EQUAL'],
- ['≤', 'LESS_OR_EQUAL'],
- ],
- value: 'LESS',
- fontSize: 11,
- bgColor: '#e37100',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- noaRrow: true,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- ],
- def: {
- params: [
- null,
- null,
- {
- type: 'number',
- params: ['100'],
- },
- ],
- type: 'robotis_light_value_boolean',
- },
- paramsKeyMap: {
- PORT: 0,
- OPERATOR: 1,
- RIGHTVALUE: 2,
- },
- class: 'robotis_light',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const port = script.getNumberField('PORT', script);
- const operator = script.getField('OPERATOR', script);
- const rightValue = script.getNumberValue('RIGHTVALUE', script);
- const leftValue = Entry.hw.portData[`LIGHT${port}`];
- let isCheck = false;
-
- switch (operator) {
- case 'EQUAL':
- isCheck = leftValue == rightValue;
- break;
- case 'GREATER':
- isCheck = Number(leftValue) > Number(rightValue);
- break;
- case 'LESS':
- isCheck = Number(leftValue) < Number(rightValue);
- break;
- case 'GREATER_OR_EQUAL':
- isCheck = Number(leftValue) >= Number(rightValue);
- break;
- case 'LESS_OR_EQUAL':
- isCheck = Number(leftValue) <= Number(rightValue);
- break;
- }
-
- return isCheck;
- },
- },
- robotis_userbutton_value: {
- color: '#2AB4D3',
- outerLine: '#0e93b1',
- skeleton: 'basic_string_field',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '사용자 버튼',
- events: {},
- params: [
- {
- type: 'Block',
- accept: 'string',
- },
- ],
- def: {
- params: [null],
- type: 'robotis_userbutton_value',
- },
- paramsKeyMap: {},
- class: 'robotis_userbutton',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- return Entry.hw.portData.USERBUTTONSTATE;
- },
- },
- robotis_userbutton_value_boolean: {
- color: '#2AB4D3',
- skeleton: 'basic_boolean_field',
- fontColor: '#fff',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '사용자 버튼이 %1',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['접촉 되면', '1'],
- ['접촉 안되면', '0'],
- ],
- value: '1',
- fontsIze: 11,
- },
- ],
- def: {
- params: [null],
- type: 'robotis_userbutton_value_boolean',
- },
- paramsKeyMap: {
- PORT: 0,
- },
- class: 'robotis_userbutton',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const port = script.getStringField('PORT');
- const value = Entry.hw.portData.USERBUTTONSTATE;
- var isTouch = false;
-
- var isTouch = port == value;
-
- return isTouch;
- },
- },
- robotis_detectedsound_value: {
- color: '#01d67f',
- outerLine: '#00b36a',
- skeleton: 'basic_string_field',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '소리 센서 최종 소리 횟수',
- events: {},
- params: [
- {
- type: 'Block',
- accept: 'string',
- },
- ],
- def: {
- params: [null],
- type: 'robotis_detectedsound_value',
- },
- paramsKeyMap: {},
- class: 'robotis_sound',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- return Entry.hw.portData.DETECTEDSOUNDE;
- },
- },
- robotis_detectedsound_value_boolean: {
- color: '#01d67f',
- outerLine: '#00b36a',
- skeleton: 'basic_boolean_field',
- fontColor: '#fff',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '소리 센서 최종 소리 횟수 %1 %2',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['=', 'EQUAL'],
- ['>', 'GREATER'],
- ['<', 'LESS'],
- ['≥', 'GREATER_OR_EQUAL'],
- ['≤', 'LESS_OR_EQUAL'],
- ],
- value: 'LESS',
- fontSize: 11,
- bgColor: '#00b36a',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- noaRrow: true,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- ],
- def: {
- params: [
- null,
- {
- type: 'number',
- params: ['100'],
- },
- ],
- type: 'robotis_detectedsound_value_boolean',
- },
- paramsKeyMap: {
- OPERATOR: 0,
- RIGHTVALUE: 1,
- },
- class: 'robotis_sound',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const operator = script.getField('OPERATOR', script);
- const rightValue = script.getNumberValue('RIGHTVALUE', script);
- const leftValue = Entry.hw.portData.DETECTEDSOUNDE;
- let isCheck = false;
-
- switch (operator) {
- case 'EQUAL':
- isCheck = leftValue == rightValue;
- break;
- case 'GREATER':
- isCheck = Number(leftValue) > Number(rightValue);
- break;
- case 'LESS':
- isCheck = Number(leftValue) < Number(rightValue);
- break;
- case 'GREATER_OR_EQUAL':
- isCheck = Number(leftValue) >= Number(rightValue);
- break;
- case 'LESS_OR_EQUAL':
- isCheck = Number(leftValue) <= Number(rightValue);
- break;
- }
-
- return isCheck;
- },
- },
- robotis_detectedsound_value_init: {
- color: '#00D67F',
- outerLine: '#00b36a',
- skeleton: 'basic',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '소리 센서 최종 소리 횟수 초기화 %1',
- params: [
- {
- type: 'Indicator',
- img: 'block_icon/practical_course/sound.png',
- size: 12,
- },
- ],
- def: {
- params: [null],
- type: 'robotis_detectedsound_value_init',
- },
- paramsKeyMap: {},
- class: 'robotis_sound',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- const data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0];
- const data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1];
- const data_value = 0;
-
- const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- //Entry.Robotis_carCont.update();
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- },
- robotis_detectingsound_value: {
- color: '#01d67f',
- outerLine: '#00b36a',
- skeleton: 'basic_string_field',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '소리 센서 실시간 소리 횟수',
- events: {},
- params: [
- {
- type: 'Block',
- accept: 'string',
- },
- ],
- def: {
- params: [null],
- type: 'robotis_detectingsound_value',
- },
- paramsKeyMap: {},
- class: 'robotis_sound',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- return Entry.hw.portData.DETECTINGSOUNDE1;
- },
- },
- robotis_detectedsound_value_boolean: {
- color: '#01d67f',
- outerLine: '#00b36a',
- skeleton: 'basic_boolean_field',
- fontColor: '#fff',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '소리 센서 최종 소리 횟수 %1 %2',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['=', 'EQUAL'],
- ['>', 'GREATER'],
- ['<', 'LESS'],
- ['≥', 'GREATER_OR_EQUAL'],
- ['≤', 'LESS_OR_EQUAL'],
- ],
- value: 'LESS',
- fontSize: 11,
- bgColor: '#00b36a',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- noaRrow: true,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- ],
- def: {
- params: [
- null,
- {
- type: 'number',
- params: ['100'],
- },
- ],
- type: 'robotis_detectedsound_value_boolean',
- },
- paramsKeyMap: {
- OPERATOR: 0,
- RIGHTVALUE: 1,
- },
- class: 'robotis_sound',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const operator = script.getField('OPERATOR', script);
- const rightValue = script.getNumberValue('RIGHTVALUE', script);
- const leftValue = Entry.hw.portData.DETECTEDSOUNDE;
- let isCheck = false;
-
- switch (operator) {
- case 'EQUAL':
- isCheck = leftValue == rightValue;
- break;
- case 'GREATER':
- isCheck = Number(leftValue) > Number(rightValue);
- break;
- case 'LESS':
- isCheck = Number(leftValue) < Number(rightValue);
- break;
- case 'GREATER_OR_EQUAL':
- isCheck = Number(leftValue) >= Number(rightValue);
- break;
- case 'LESS_OR_EQUAL':
- isCheck = Number(leftValue) <= Number(rightValue);
- break;
- }
-
- return isCheck;
- },
- },
- robotis_detectedsound_value_init: {
- color: '#00D67F',
- outerLine: '#00b36a',
- skeleton: 'basic',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '소리 센서 최종 소리 횟수 초기화 %1',
- params: [
- {
- type: 'Indicator',
- img: 'block_icon/practical_course/sound.png',
- size: 12,
- },
- ],
- def: {
- params: [null],
- type: 'robotis_detectedsound_value_init',
- },
- paramsKeyMap: {},
- class: 'robotis_sound',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- const data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0];
- const data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1];
- const data_value = 0;
-
- const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- //Entry.Robotis_carCont.update();
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- },
- robotis_detectingsound_value: {
- color: '#01d67f',
- outerLine: '#00b36a',
- skeleton: 'basic_string_field',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '소리 센서 실시간 소리 횟수',
- events: {},
- params: [
- {
- type: 'Block',
- accept: 'string',
- },
- ],
- def: {
- params: [null],
- type: 'robotis_detectingsound_value',
- },
- paramsKeyMap: {},
- class: 'robotis_sound',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- return Entry.hw.portData.DETECTINGSOUNDE1;
- },
- },
- robotis_detectingsound_value_boolean: {
- color: '#01d67f',
- outerLine: '#00b36a',
- skeleton: 'basic_boolean_field',
- fontColor: '#fff',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '소리 센서 실시간 소리 횟수 %1 %2',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['=', 'EQUAL'],
- ['>', 'GREATER'],
- ['<', 'LESS'],
- ['≥', 'GREATER_OR_EQUAL'],
- ['≤', 'LESS_OR_EQUAL'],
- ],
- value: 'LESS',
- fontSize: 11,
- bgColor: '#00b36a',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- noaRrow: true,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- ],
- def: {
- params: [
- null,
- {
- type: 'number',
- params: ['100'],
- },
- ],
- type: 'robotis_detectingsound_value_boolean',
- },
- paramsKeyMap: {
- OPERATOR: 0,
- RIGHTVALUE: 1,
- },
- class: 'robotis_sound',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const operator = script.getField('OPERATOR', script);
- const rightValue = script.getNumberValue('RIGHTVALUE', script);
- const leftValue = Entry.hw.portData.DETECTINGSOUNDE1;
- let isCheck = false;
-
- switch (operator) {
- case 'EQUAL':
- isCheck = leftValue == rightValue;
- break;
- case 'GREATER':
- isCheck = Number(leftValue) > Number(rightValue);
- break;
- case 'LESS':
- isCheck = Number(leftValue) < Number(rightValue);
- break;
- case 'GREATER_OR_EQUAL':
- isCheck = Number(leftValue) >= Number(rightValue);
- break;
- case 'LESS_OR_EQUAL':
- isCheck = Number(leftValue) <= Number(rightValue);
- break;
- }
-
- return isCheck;
- },
- },
- robotis_color_value: {
- color: '#2AB4D3',
- outerLine: '#0e93b1',
- skeleton: 'basic_string_field',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1번 포트 컬러 센서 값',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['PORT 3', '3'],
- ['PORT 4', '4'],
- ['PORT 5', '5'],
- ['PORT 6', '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: '#0e93b1',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- ],
- events: {},
- def: {
- params: [null],
- type: 'robotis_color_value',
- },
- paramsKeyMap: {
- PORT: 0,
- },
- class: 'robotis_color',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const port = script.getStringField('PORT');
- let value = 0;
- let data_address = 0;
- switch (port) {
- case '3':
- value = Entry.hw.portData.COLOR0;
- data_address = 108;
- break;
- case '4':
- value = Entry.hw.portData.COLOR1;
- data_address = 109;
- break;
- case '5':
- value = Entry.hw.portData.COLOR2;
- data_address = 110;
- break;
- case '6':
- value = Entry.hw.portData.COLOR3;
- data_address = 111;
- break;
- }
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- const data_length = 1;
- const data_value = 4;
-
- const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
-
- switch (value) {
- case 0:
- value = '알 수 없음';
- break;
- case 1:
- value = '흰색';
- break;
- case 2:
- value = '검은색';
- break;
- case 3:
- value = '빨강색';
- break;
- case 4:
- value = '초록색';
- break;
- case 5:
- value = '파랑색';
- break;
- case 6:
- value = '노랑색';
- break;
- }
-
- return value;
- },
- },
- robotis_color_value_boolean: {
- color: '#C4065C',
- outerLine: '#9a0045',
- skeleton: 'basic_boolean_field',
- fontColor: '#fff',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1번 포트 컬러 센서 값 %2 %3',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['PORT 3', '3'],
- ['PORT 4', '4'],
- ['PORT 5', '5'],
- ['PORT 6', '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: '#9a0045',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Dropdown',
- options: [
- ['=', 'EQUAL'],
- ['>', 'GREATER'],
- ['<', 'LESS'],
- ['≥', 'GREATER_OR_EQUAL'],
- ['≤', 'LESS_OR_EQUAL'],
- ],
- value: 'LESS',
- fontSize: 11,
- bgColor: '#9a0045',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- noaRrow: true,
- },
- {
- type: 'Dropdown',
- options: [
- ['알 수 없음 : 0', '0'],
- ['흰색 : 1', '1'],
- ['검은색 : 2', '2'],
- ['빨강색 : 3', '3'],
- ['초록색 : 4', '4'],
- ['파랑색 : 5', '5'],
- ['노랑색 : 6', '6'],
- ],
- value: '0',
- fontSize: 11,
- bgColor: '#9a0045',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- ],
- def: {
- params: [null, null, null],
- type: 'robotis_color_value_boolean',
- },
- paramsKeyMap: {
- PORT: 0,
- OPERATOR: 1,
- RIGHTVALUE: 2,
- },
- class: 'robotis_color',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const port = script.getField('PORT', script);
- const operator = script.getField('OPERATOR', script);
- const rightValue = script.getNumberField('RIGHTVALUE', script);
- let leftValue = 0;
- let data_address = 0;
- let isCheck = false;
-
- switch (port) {
- case '3':
- leftValue = Entry.hw.portData.COLOR0;
- data_address = 108;
- break;
- case '4':
- leftValue = Entry.hw.portData.COLOR1;
- data_address = 109;
- break;
- case '5':
- leftValue = Entry.hw.portData.COLOR2;
- data_address = 110;
- break;
- case '6':
- leftValue = Entry.hw.portData.COLOR3;
- data_address = 111;
- break;
- }
-
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- const data_length = 1;
- const data_value = 4;
-
- const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
-
- switch (operator) {
- case 'EQUAL':
- isCheck = leftValue == rightValue;
- break;
- case 'GREATER':
- isCheck = Number(leftValue) > Number(rightValue);
- break;
- case 'LESS':
- isCheck = Number(leftValue) < Number(rightValue);
- break;
- case 'GREATER_OR_EQUAL':
- isCheck = Number(leftValue) >= Number(rightValue);
- break;
- case 'LESS_OR_EQUAL':
- isCheck = Number(leftValue) <= Number(rightValue);
- break;
- }
-
- return isCheck;
- },
- },
- robotis_humidity_value: {
- color: '#2AB4D3',
- outerLine: '#0e93b1',
- skeleton: 'basic_string_field',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1번 포트 습도 센서 값',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['PORT 3', '3'],
- ['PORT 4', '4'],
- ['PORT 5', '5'],
- ['PORT 6', '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: '#0e93b1',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- ],
- events: {},
- def: {
- params: [null],
- type: 'robotis_humidity_value',
- },
- paramsKeyMap: {
- PORT: 0,
- },
- class: 'robotis_humidity',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const port = script.getStringField('PORT');
- let value = 0;
- let data_address = 0;
- switch (port) {
- case '3':
- value = Entry.hw.portData.HUMIDTY0;
- data_address = 108;
- break;
- case '4':
- value = Entry.hw.portData.HUMIDTY1;
- data_address = 109;
- break;
- case '5':
- value = Entry.hw.portData.HUMIDTY2;
- data_address = 110;
- break;
- case '6':
- value = Entry.hw.portData.HUMIDTY3;
- data_address = 111;
- break;
- }
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- const data_length = 1;
- const data_value = 5;
-
- const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
-
- return value;
- },
- },
- robotis_humidity_value_boolean: {
- color: '#C4065C',
- outerLine: '#9a0045',
- skeleton: 'basic_boolean_field',
- fontColor: '#fff',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1번 포트 습도 센서 값 %2 %3',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['PORT 3', '3'],
- ['PORT 4', '4'],
- ['PORT 5', '5'],
- ['PORT 6', '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: '#9a0045',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Dropdown',
- options: [
- ['=', 'EQUAL'],
- ['>', 'GREATER'],
- ['<', 'LESS'],
- ['≥', 'GREATER_OR_EQUAL'],
- ['≤', 'LESS_OR_EQUAL'],
- ],
- value: 'LESS',
- fontSize: 11,
- bgColor: '#9a0045',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- noaRrow: true,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- ],
- def: {
- params: [
- null,
- null,
- {
- type: 'number',
- params: ['50'],
- },
- ],
- type: 'robotis_humidity_value_boolean',
- },
- paramsKeyMap: {
- PORT: 0,
- OPERATOR: 1,
- RIGHTVALUE: 2,
- },
- class: 'robotis_humidity',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const port = script.getNumberField('PORT', script);
- const operator = script.getField('OPERATOR', script);
- const rightValue = script.getNumberValue('RIGHTVALUE', script);
- let leftValue = 0;
- let data_address = 0;
- let isCheck = true;
-
- switch (port) {
- case 3:
- leftValue = Entry.hw.portData.HUMIDTY0;
- data_address = 108;
- break;
- case 4:
- leftValue = Entry.hw.portData.HUMIDTY1;
- data_address = 109;
- break;
- case 5:
- leftValue = Entry.hw.portData.HUMIDTY2;
- data_address = 110;
- break;
- case 6:
- leftValue = Entry.hw.portData.HUMIDTY3;
- data_address = 111;
- break;
- }
-
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- const data_length = 1;
- const data_value = 5;
-
- const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
- switch (operator) {
- case 'EQUAL':
- isCheck = leftValue == rightValue;
- break;
- case 'GREATER':
- isCheck = Number(leftValue) > Number(rightValue);
- break;
- case 'LESS':
- isCheck = Number(leftValue) < Number(rightValue);
- break;
- case 'GREATER_OR_EQUAL':
- isCheck = Number(leftValue) >= Number(rightValue);
- break;
- case 'LESS_OR_EQUAL':
- isCheck = Number(leftValue) <= Number(rightValue);
- break;
- }
- return isCheck;
- },
- },
- robotis_temperature_value: {
- color: '#2AB4D3',
- outerLine: '#0e93b1',
- skeleton: 'basic_string_field',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1번 포트 온도 센서 값',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['PORT 3', '3'],
- ['PORT 4', '4'],
- ['PORT 5', '5'],
- ['PORT 6', '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: '#0e93b1',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- ],
- events: {},
- def: {
- params: [null],
- type: 'robotis_temperature_value',
- },
- paramsKeyMap: {
- PORT: 0,
- },
- class: 'robotis_temperature',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const port = script.getStringField('PORT');
- let value = 0;
- let data_address = 0;
- switch (port) {
- case '3':
- value = Entry.hw.portData.TEMPERATURE0;
- data_address = 108;
- break;
- case '4':
- value = Entry.hw.portData.TEMPERATURE1;
- data_address = 109;
- break;
- case '5':
- value = Entry.hw.portData.TEMPERATURE2;
- data_address = 110;
- break;
- case '6':
- value = Entry.hw.portData.TEMPERATURE3;
- data_address = 111;
- break;
- }
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- const data_length = 1;
- const data_value = 5;
-
- const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
-
- return value;
- },
- },
- robotis_temperature_value_boolean: {
- color: '#C4065C',
- outerLine: '#9a0045',
- skeleton: 'basic_boolean_field',
- fontColor: '#fff',
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1번 포트 온도 센서 값 %2 %3',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['PORT 3', '3'],
- ['PORT 4', '4'],
- ['PORT 5', '5'],
- ['PORT 6', '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: '#9a0045',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Dropdown',
- options: [
- ['=', 'EQUAL'],
- ['>', 'GREATER'],
- ['<', 'LESS'],
- ['≥', 'GREATER_OR_EQUAL'],
- ['≤', 'LESS_OR_EQUAL'],
- ],
- value: 'LESS',
- fontSize: 11,
- bgColor: '#9a0045',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- noaRrow: true,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- ],
- def: {
- params: [
- null,
- null,
- {
- type: 'number',
- params: ['50'],
- },
- ],
- type: 'robotis_temperature_value_boolean',
- },
- paramsKeyMap: {
- PORT: 0,
- OPERATOR: 1,
- RIGHTVALUE: 2,
- },
- class: 'robotis_temperature',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const port = script.getNumberField('PORT', script);
- const operator = script.getField('OPERATOR', script);
- const rightValue = script.getNumberValue('RIGHTVALUE', script);
- let leftValue = 0;
- let data_address = 0;
- let isCheck = true;
-
- switch (port) {
- case 3:
- leftValue = Entry.hw.portData.TEMPERATURE0;
- data_address = 108;
- break;
- case 4:
- leftValue = Entry.hw.portData.TEMPERATURE1;
- data_address = 109;
- break;
- case 5:
- leftValue = Entry.hw.portData.TEMPERATURE2;
- data_address = 110;
- break;
- case 6:
- leftValue = Entry.hw.portData.TEMPERATURE3;
- data_address = 111;
- break;
- }
-
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- const data_length = 1;
- const data_value = 5;
-
- const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
- switch (operator) {
- case 'EQUAL':
- isCheck = leftValue == rightValue;
- break;
- case 'GREATER':
- isCheck = Number(leftValue) > Number(rightValue);
- break;
- case 'LESS':
- isCheck = Number(leftValue) < Number(rightValue);
- break;
- case 'GREATER_OR_EQUAL':
- isCheck = Number(leftValue) >= Number(rightValue);
- break;
- case 'LESS_OR_EQUAL':
- isCheck = Number(leftValue) <= Number(rightValue);
- break;
- }
- return isCheck;
- },
- },
- robotis_move_for_secs: {
- color: '#00B200',
- outerLine: '#019101',
- skeleton: 'basic',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1모터를 %2 %3의 속도로 %4초 동안 회전 %5',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['왼쪽', '1'],
- ['오른쪽', '2'],
- ['양쪽', '3'],
- ],
- value: '1',
- fontSize: 11,
- bgColor: '#019101',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Dropdown',
- options: [
- ['앞으로', 'CW'],
- ['뒤로', 'CCW'],
- ],
- value: 'CW',
- fontSize: 11,
- bgColor: '#019101',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/practical_course/dcmotor.png',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- null,
- {
- type: 'practical_course_motor_speed',
- },
- {
- type: 'number',
- params: ['2'],
- },
- null,
- ],
- type: 'robotis_move_for_secs',
- },
- paramsKeyMap: {
- WHEEL: 0,
- DIRECTION: 1,
- SPEED: 2,
- DURATION: 3,
- },
- class: 'robotis_motor',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const duration = script.getNumberValue('DURATION');
- const wheel = script.getNumberField('WHEEL');
- let value = script.getNumberValue('SPEED');
- const direction = script.getStringField('DIRECTION');
-
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- let data_address = 0;
- let data_length = 0;
- let data_value = 0;
-
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0];
-
- if (wheel == '3') {
- data_length = 4;
- data_address = 136;
- } else {
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1];
- data_address = data_address + (wheel - 1) * data_length;
- }
-
- if (!script.isStart) {
- value = value * 68;
- if (wheel == '3' || wheel == '1') {
- if (direction == 'CCW') {
- value = value + 1024;
- if (value > 2047) {
- value = 2047;
- }
- } else {
- if (value > 1023) {
- value = 1023;
- }
- }
- } else {
- if (direction == 'CW') {
- value = value + 1024;
- if (value > 2047) {
- value = 2047;
- }
- } else {
- if (value > 1023) {
- value = 1023;
- }
- }
- }
-
- data_value = value;
-
- var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
-
- script.wheelMode = wheel;
-
- script.isStart = true;
- script.timeFlag = 1;
- setTimeout(() => {
- script.timeFlag = 0;
- }, duration * 1000);
-
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
- //return Entry.Robotis_carCont.postCallReturn(script, data_sendqueue, 2000);
- return script;
- } else if (script.timeFlag == 1) {
- //data_sendqueue = [[data_instruction, data_address, data_length, 0]];
- //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- return script;
- } else {
- delete script.timeFlag;
- delete script.isStart;
- delete script.wheelMode;
- Entry.engine.isContinue = false;
-
- data_sendqueue = [[data_instruction, data_address, data_length, 0]];
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.engine.isContinue = false;
- Entry.Robotis_carCont.update();
- return script.callReturn();
- }
- //return Entry.Robotis_carCont.postCallReturn(script, data_sendqueue, 2000);
- },
- },
- robotis_aux_move_for: {
- color: '#00B200',
- outerLine: '#019101',
- skeleton: 'basic',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1모터를 %2 %3의 속도로 계속 회전 %4',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['왼쪽', '1'],
- ['오른쪽', '2'],
- ['양쪽', '3'],
- ],
- value: '1',
- fontSize: 11,
- bgColor: '#019101',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Dropdown',
- options: [
- ['앞으로', 'CW'],
- ['뒤로', 'CCW'],
- ],
- value: 'CW',
- fontSize: 11,
- bgColor: '#019101',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/practical_course/dcmotor.png',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- null,
- {
- type: 'practical_course_motor_speed',
- },
- null,
- ],
- type: 'robotis_aux_move_for',
- },
- paramsKeyMap: {
- WHEEL: 0,
- DIRECTION: 1,
- SPEED: 2,
- },
- class: 'robotis_motor',
- //'isNotFor': ['mini'],
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const wheel = script.getNumberField('WHEEL');
- let value = script.getNumberValue('SPEED');
- const direction = script.getStringField('DIRECTION');
-
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- let data_address = 0;
- let data_length = 0;
- let data_value = 0;
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0];
-
- if (wheel == '3') {
- data_length = 4;
- data_address = 136;
- } else {
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1];
- data_address = data_address + (wheel - 1) * data_length;
- }
- value = value * 68;
-
- if (wheel == '3' || wheel == '1') {
- if (direction == 'CCW') {
- value = value + 1024;
- if (value > 2047) {
- value = 2047;
- }
- } else {
- if (value > 1023) {
- value = 1023;
- }
- }
- } else {
- if (direction == 'CW') {
- value = value + 1024;
- if (value > 2047) {
- value = 2047;
- }
- } else {
- if (value > 1023) {
- value = 1023;
- }
- }
- }
-
- data_value = value;
-
- const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- },
- robotis_aux_stop_for: {
- color: '#00B200',
- outerLine: '#019101',
- skeleton: 'basic',
- fontColor: '#fff',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1모터를 정지 %2',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['왼쪽', '1'],
- ['오른쪽', '2'],
- ['양쪽', '3'],
- ],
- value: '1',
- fontSize: 11,
- bgColor: '#019101',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Indicator',
- img: 'block_icon/practical_course/dcmotor.png',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null, null],
- type: 'robotis_aux_stop_for',
- },
- paramsKeyMap: {
- WHEEL: 0,
- },
- class: 'robotis_motor',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const wheel = script.getNumberField('WHEEL');
- const value = 0;
-
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- let data_address = 0;
- let data_length = 0;
- let data_value = 0;
-
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0];
- if (wheel == '3') {
- data_length = 4;
- data_address = 136;
- } else {
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1];
- data_address = data_address + (wheel - 1) * data_length;
- }
-
- data_value = value;
-
- const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- },
- robotis_set_servo_wheel: {
- color: '#D128BD',
- outerLine: '#a2049e',
- skeleton: 'basic',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1 포트의 서보모터를 %2 %3속도로 회전 %4',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['PORT 3', '3'],
- ['PORT 4', '4'],
- ['PORT 5', '5'],
- ['PORT 6', '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: '#A2049E',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Dropdown',
- options: [
- ['시계방향', 'CW'],
- ['반시계방향', 'CCW'],
- ],
- value: 'CW',
- fontSize: 11,
- bgColor: '#A2049E',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Dropdown',
- options: [
- ['1', 1],
- ['2', 2],
- ['3', 3],
- ['4', 4],
- ['5', 5],
- ['6', 6],
- ['7', 7],
- ['8', 8],
- ['9', 9],
- ['10', 10],
- ['11', 11],
- ['12', 12],
- ['13', 13],
- ['14', 14],
- ['15', 15],
- ],
- value: 7,
- fontSize: 11,
- bgColor: '#A2049E',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Indicator',
- img: 'block_icon/practical_course/servo.png',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null, null, null, null],
- type: 'robotis_set_servo_wheel',
- },
- paramsKeyMap: {
- PORT: 0,
- DIRECTION: 1,
- SPEED: 2,
- },
- class: 'robotis_servo_motor',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- // instruction / address / length / value / default length
- const port = script.getField('PORT', script);
- const direction = script.getStringField('DIRECTION');
- const speed = script.getNumberField('SPEED');
- const value = 0;
-
- let data_address3 = 0;
- let data_length3 = 0;
- let data_value3 = 0;
-
- let data_address2 = 0;
- const data_length2 = 1;
- const data_value2 = 7;
-
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- let data_address = 0;
- let data_length = 0;
- let data_value = 0;
-
- let data_address4 = 0; // servo speed
- let data_length4 = 2;
- let data_value4 = 0;
-
- data_value4 = speed * 68;
- if (data_value4 > 1023) {
- data_value4 = 1023;
- }
- switch (port) {
- case '3':
- data_address2 = 108;
- Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT3 = true;
- break;
- case '4':
- data_address2 = 109;
- Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT4 = true;
- break;
- case '5':
- data_address2 = 110;
- Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT5 = true;
- break;
- case '6':
- data_address2 = 111;
- Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT6 = true;
- break;
- }
-
- data_address3 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];
- data_length3 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];
-
- data_address3 = data_address3 + (port - 1) * data_length3;
-
- data_address4 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[0];
- data_length4 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[1];
-
- data_address4 = data_address4 + (port - 1) * data_length4;
-
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[1];
-
- data_address = data_address + (port - 1) * data_length;
- data_value = 0;
-
- if (direction == 'CW') {
- data_value4 = data_value4 + 1024;
- if (data_value4 > 2047) {
- data_value4 = 2047;
- }
- } else {
- if (data_value4 > 1023) {
- data_value4 = 1023;
- }
- }
-
- data_value3 = direction;
-
- //var data_sendqueue = [[data_instruction, data_address2, data_length2, data_value2], [data_instruction, data_address, data_length, data_value], [data_instruction, data_address4, data_length4, data_value4]];
- //return Entry.Robotis_carCont.postCallReturn(script, data_sendqueue, Entry.Robotis_openCM70.delay);
- //
- if (!script.isStart) {
- if (
- (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT3 && port == '3') ||
- (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT4 && port == '4') ||
- (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT5 && port == '5') ||
- (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT6 && port == '6')
- ) {
- var data_sendqueue = [
- [data_instruction, data_address2, data_length2, data_value2],
- ];
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
- script.isStart = true;
- script.timeFlag = 1;
- setTimeout(() => {
- script.timeFlag = 0;
- }, 1 * 650);
- } else {
- script.isStart = true;
- script.timeFlag = 0;
- }
-
- /*
- var data_sendqueue = [[data_instruction, data_address2, data_length2, data_value2]];
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.Robotis_carCont.update();
- script.isStart = true;
- script.timeFlag = 1;
- setTimeout(function () {
- script.timeFlag = 0;
- }, 1 * 650);
- */
-
- return script;
- } else if (script.timeFlag == 1) {
- //data_sendqueue = [[data_instruction, data_address, data_length, 0]];
- //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- return script;
- } else {
- delete script.timeFlag;
- delete script.isStart;
- delete script.wheelMode;
- Entry.engine.isContinue = false;
-
- data_sendqueue = [
- [data_instruction, data_address, data_length, data_value],
- [data_instruction, data_address4, data_length4, data_value4],
- ];
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.engine.isContinue = false;
- Entry.Robotis_carCont.update();
- return script.callReturn();
- }
- //
- },
- },
- robotis_set_servo_joint: {
- color: '#D128BD',
- outerLine: '#a2049e',
- skeleton: 'basic',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '%1 포트의 서보모터를 %2 도 %3속도로 이동 %4',
- params: [
- {
- type: 'Dropdown',
- options: [
- ['PORT 3', '3'],
- ['PORT 4', '4'],
- ['PORT 5', '5'],
- ['PORT 6', '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: '#A2049E',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Dropdown',
- options: [
- ['1', 1],
- ['2', 2],
- ['3', 3],
- ['4', 4],
- ['5', 5],
- ['6', 6],
- ['7', 7],
- ['8', 8],
- ['9', 9],
- ['10', 10],
- ['11', 11],
- ['12', 12],
- ['13', 13],
- ['14', 14],
- ['15', 15],
- ],
- value: 7,
- fontSize: 11,
- bgColor: '#A2049E',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Indicator',
- img: 'block_icon/practical_course/servo.png',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- {
- type: 'number',
- params: ['512'],
- },
- null,
- null,
- ],
- type: 'robotis_set_servo_joint',
- },
- paramsKeyMap: {
- PORT: 0,
- VALUE: 1,
- SPEED: 2,
- },
- class: 'robotis_servo_motor',
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- // instruction / address / length / value / default length
- const port = script.getField('PORT', script);
- let value = script.getNumberValue('VALUE');
- const speed = script.getNumberField('SPEED');
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- let data_address3 = 0;
- let data_length3 = 0;
- let data_value3 = 0;
-
- let data_address2 = 0;
- const data_length2 = 1;
- const data_value2 = 7;
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- let data_address = 0;
- let data_length = 0;
- let data_value = 0;
-
- let data_address4 = 0; // servo speed
- let data_length4 = 2;
- let data_value4 = 0;
-
- data_value4 = speed * 68;
- if (data_value4 > 1023) {
- data_value4 = 1023;
- }
- switch (port) {
- case '3':
- data_address2 = 108;
- break;
- case '4':
- data_address2 = 109;
- break;
- case '5':
- data_address2 = 110;
- break;
- case '6':
- data_address2 = 111;
- break;
- }
-
- data_address3 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];
- data_length3 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];
-
- data_address3 = data_address3 + (port - 1) * data_length3;
-
- data_address4 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[0];
- data_length4 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[1];
-
- data_address4 = data_address4 + (port - 1) * data_length4;
-
- data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[1];
-
- data_address = data_address + (port - 1) * data_length;
- data_value = 1;
-
- if (value > 1023) {
- value = 1023;
- } else if (value < 0) {
- value = 0;
- }
-
- data_value3 = value;
-
- if (!script.isStart) {
- var data_sendqueue = [[data_instruction, data_address2, data_length2, data_value2]];
- //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- //Entry.Robotis_carCont.update();
- if (
- (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT3 && port == '3') ||
- (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT4 && port == '4') ||
- (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT5 && port == '5') ||
- (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT6 && port == '6')
- ) {
- script.isStart = true;
- script.timeFlag = 1;
- setTimeout(() => {
- script.timeFlag = 0;
- }, 1 * 650);
- } else {
- script.isStart = true;
- script.timeFlag = 0;
- }
-
- return script;
- } else if (script.timeFlag == 1) {
- return script;
- } else {
- delete script.timeFlag;
- delete script.isStart;
- delete script.wheelMode;
- Entry.engine.isContinue = false;
-
- setTimeout(() => {
- script.timeFlag = 0;
- }, 1 * 70);
-
- data_sendqueue = [
- [data_instruction, data_address, data_length, data_value],
- [data_instruction, data_address4, data_length4, data_value4],
- [data_instruction, data_address3, data_length3, data_value3],
- ];
- Entry.Robotis_carCont.setRobotisData(data_sendqueue);
- Entry.engine.isContinue = false;
- Entry.Robotis_carCont.update();
- return script.callReturn();
- }
- //
- },
- },
- robotis_melody_note_for: {
- color: '#FC327F',
- skeleton: 'basic',
- statements: [],
- isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
- template: '멜로디 %1 을(를) %2 옥타브로 %3 만큼 소리내기 %4',
- params: [
- {
- type: 'Dropdown',
- options: [
- //['무음', '12'],
- ['도', '0'],
- ['도#(레♭)', '1'],
- ['레', '2'],
- ['레#(미♭)', '3'],
- ['미', '4'],
- ['파', '5'],
- ['파#(솔♭)', '6'],
- ['솔', '7'],
- ['솔#(라♭)', '8'],
- ['라', '9'],
- ['라#(시♭)', '10'],
- ['시', '11'],
- ],
- value: '0',
- fontSize: 11,
- bgColor: '#ce105e',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Dropdown',
- options: [
- ['1', '0'],
- ['2', '1'],
- ['3', '2'],
- ['4', '3'],
- ['5', '4'],
- ['6', '5'],
- ],
- value: '2',
- fontSize: 11,
- bgColor: '#ce105e',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Dropdown',
- options: [
- ['온음표', '4'],
- ['2분음표', '2'],
- ['4분음표', '1'],
- ['8분음표', '0.5'],
- ['16분음표', '0.25'],
- /*['4분음표', '4'],
- ['8분음표', '8'],
- ['16분음표', '16'],*/
- ],
- value: '4',
- fontSize: 11,
- bgColor: '#ce105e',
- arrowColor: EntryStatic.colorSet.common.WHITE,
- },
- {
- type: 'Indicator',
- img: 'block_icon/practical_course/melody.png',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null, null, null, null],
- type: 'robotis_melody_note_for',
- },
- paramsKeyMap: {
- NOTE: 0,
- OCTAVE: 1,
- DURATION: 2,
- },
- class: 'robotis_melody',
- //'isNotFor': ['mini'],
- func(sprite, script) {
- Entry.hw.sendQueue.IS_EDU = true;
- const note = script.getNumberField('NOTE', script);
- const octave = script.getNumberField('OCTAVE', script);
- const cmBuzzerTime = script.getNumberField('DURATION', script);
-
- let cmBuzzerIndex = note + octave * 12;
- if (cmBuzzerIndex > 51) {
- cmBuzzerIndex = 51;
- }
- if (cmBuzzerIndex < 0) {
- cmBuzzerIndex = 0;
- }
-
- const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- let data_address_1 = 0;
- let data_length_1 = 0;
- let data_value_1 = 0;
- let data_address_2 = 0;
- let data_length_2 = 0;
- let data_value_2 = 0;
-
- data_address_1 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];
- data_length_1 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];
-
- // TODO 텍스트 입력으로 바꾸고 최대는 5초 : 0.5 초 하려면 5를 입력 - console.log(parseInt(0.59 * 10)); max 는 5초
-
- data_value_1 = parseInt(cmBuzzerTime * 10);
- if (data_value_1 > 50) {
- data_value_1 = 50;
- }
- //data_value_1
- data_address_2 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0];
- data_length_2 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1];
- data_value_2 = cmBuzzerIndex;
-
- const data_sendqueue = [
- [data_instruction, data_address_1, data_length_1, data_value_1],
- [data_instruction, data_address_2, data_length_2, data_value_2],
- ];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- cmBuzzerTime * 1000
- );
- },
- },
- }
-}
-/*Entry.Robotis_openCM70EDU.blockMenuBlocks = [
- //Robotis_openCM70EDU
- 'robotis_openCM70_sensor_value',
- 'robotis_openCM70_aux_sensor_value',
- 'robotis_openCM70_cm_buzzer_index',
- 'robotis_openCM70_cm_buzzer_melody',
- 'robotis_openCM70_cm_sound_detected_clear',
- 'robotis_openCM70_cm_led',
- 'robotis_openCM70_cm_motion',
- 'robotis_openCM70_aux_motor_speed',
- 'robotis_openCM70_aux_servo_mode',
- 'robotis_openCM70_aux_servo_speed',
- 'robotis_openCM70_aux_servo_position',
- 'robotis_openCM70_aux_led_module',
- 'robotis_openCM70_aux_custom',
- 'robotis_openCM70_cm_custom_value',
- 'robotis_openCM70_cm_custom',
-];
-Entry.Robotis_openCM70EDU.getBlocks = function () {
- return {
- //region robotis 로보티즈 openCM70
- robotis_openCM70_cm_custom_value: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- fontColor: '#fff',
- skeleton: 'basic_string_field',
- statements: [],
- params: [
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Dropdown',
- options: [
- ['BYTE', 'BYTE'],
- ['WORD', 'WORD'],
- ['DWORD', 'DWORD'],
- ],
- value: 'BYTE',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- ],
- events: {},
- def: {
- params: [
- {
- type: 'number',
- params: ['0'],
- },
- null,
- ],
- type: 'robotis_openCM70_cm_custom_value',
- },
- paramsKeyMap: {
- VALUE: 0,
- SIZE: 1,
- },
- class: 'robotis_openCM70_custom',
- isNotFor: ['Robotis_openCM70EDU'],
- func: function (sprite, script) {
- var scope = script.executor.scope;
-
- // instruction / address / length / value / default length
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.READ;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- var data_default_address = 0;
- var data_default_length = 0;
-
- var size = script.getStringField('SIZE');
-
- if (size == 'BYTE') {
- data_length = 1;
- } else if (size == 'WORD') {
- data_length = 2;
- } else if (size == 'DWORD') {
- data_length = 4;
- }
-
- data_address = script.getNumberValue('VALUE');
-
- data_default_address = data_address;
- data_default_length = data_length;
-
- if (
- Entry.hw.sendQueue.prevAddress &&
- Entry.hw.sendQueue.prevAddress == data_default_address
- ) {
- if (
- Entry.hw.sendQueue.prevTime &&
- new Date() - Entry.hw.sendQueue.prevTime < 200
- ) {
- //throw new Entry.Utils.AsyncError();
- return Entry.hw.sendQueue.prevResult;
- }
- }
-
- Entry.Robotis_carCont.setRobotisData([
- [
- data_instruction,
- data_address,
- data_length,
- data_value,
- data_default_length,
- ],
- ]);
- // Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
- Entry.Robotis_carCont.update();
-
- var result = Entry.hw.portData[data_default_address];
- Entry.hw.sendQueue.prevAddress = data_default_address;
- Entry.hw.sendQueue.prevTime = new Date();
- Entry.hw.sendQueue.prevResult = result;
-
- return result;
- },
- syntax: {
- js: [],
- py: ['Robotis.opencm70_cm_custom_value(%1, %2)'],
- },
- },
- robotis_openCM70_sensor_value: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- fontColor: '#fff',
- skeleton: 'basic_string_field',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [
- Lang.Blocks.robotis_cm_sound_detected,
- 'CM_SOUND_DETECTED',
- ],
- [
- Lang.Blocks.robotis_cm_sound_detecting,
- 'CM_SOUND_DETECTING',
- ],
- [Lang.Blocks.robotis_cm_user_button, 'CM_USER_BUTTON'],
- ],
- value: 'CM_SOUND_DETECTED',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- ],
- events: {},
- def: {
- params: [null],
- type: 'robotis_openCM70_sensor_value',
- },
- paramsKeyMap: {
- SENSOR: 0,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['Robotis_openCM70EDU'],
- func: function (sprite, script) {
- var scope = script.executor.scope;
-
- scope.isStart = true;
- scope.count = 0;
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.READ;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- var data_default_address = 0;
- var data_default_length = 0;
-
- var sensor = script.getStringField('SENSOR');
-
- var increase = 0;
-
- if (sensor == 'CM_SOUND_DETECTED') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .CM_SOUND_DETECTED[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .CM_SOUND_DETECTED[1];
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .CM_SOUND_DETECTED[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .CM_SOUND_DETECTED[1];
- } else if (sensor == 'CM_SOUND_DETECTING') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .CM_SOUND_DETECTING[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .CM_SOUND_DETECTING[1];
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .CM_SOUND_DETECTING[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .CM_SOUND_DETECTING[1];
- } else if (sensor == 'CM_USER_BUTTON') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1];
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1];
- }
-
- data_default_address =
- data_default_address + increase * data_default_length;
-
- if (
- Entry.hw.sendQueue.prevAddress &&
- Entry.hw.sendQueue.prevAddress == data_default_address
- ) {
- if (
- Entry.hw.sendQueue.prevTime &&
- new Date() - Entry.hw.sendQueue.prevTime < 200
- ) {
- //throw new Entry.Utils.AsyncError();
- return Entry.hw.sendQueue.prevResult;
- }
- }
-
- Entry.Robotis_carCont.setRobotisData([
- [
- data_instruction,
- data_address,
- data_length,
- data_value,
- data_default_length,
- ],
- ]);
- // Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
- Entry.Robotis_carCont.update();
-
- var result = Entry.hw.portData[data_default_address];
- Entry.hw.sendQueue.prevAddress = data_default_address;
- Entry.hw.sendQueue.prevTime = new Date();
- Entry.hw.sendQueue.prevResult = result;
-
- return result;
- },
- syntax: { js: [], py: ['Robotis.opencm70_sensor_value(%1)'] },
- },
- robotis_openCM70_aux_sensor_value: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- fontColor: '#fff',
- skeleton: 'basic_string_field',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- ['3', 'PORT_3'],
- ['4', 'PORT_4'],
- ['5', 'PORT_5'],
- ['6', 'PORT_6'],
- ],
- value: 'PORT_3',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Dropdown',
- options: [
- [
- Lang.Blocks.robotis_aux_servo_position,
- 'AUX_SERVO_POSITION',
- ],
- [Lang.Blocks.robotis_aux_ir, 'AUX_IR'],
- [Lang.Blocks.robotis_aux_touch, 'AUX_TOUCH'],
- [Lang.Blocks.robotis_aux_brightness, 'AUX_BRIGHTNESS'],
- [
- Lang.Blocks.robotis_aux_hydro_themo_humidity,
- 'AUX_HYDRO_THEMO_HUMIDITY',
- ],
- [
- Lang.Blocks.robotis_aux_hydro_themo_temper,
- 'AUX_HYDRO_THEMO_TEMPER',
- ],
- [
- Lang.Blocks.robotis_aux_temperature,
- 'AUX_TEMPERATURE',
- ],
- [Lang.Blocks.robotis_aux_ultrasonic, 'AUX_ULTRASONIC'],
- [Lang.Blocks.robotis_aux_magnetic, 'AUX_MAGNETIC'],
- [
- Lang.Blocks.robotis_aux_motion_detection,
- 'AUX_MOTION_DETECTION',
- ],
- [Lang.Blocks.robotis_aux_color, 'AUX_COLOR'],
- [Lang.Blocks.robotis_aux_custom, 'AUX_CUSTOM'],
- ],
- value: 'AUX_SERVO_POSITION',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- ],
- events: {},
- def: {
- params: [null, null],
- type: 'robotis_openCM70_aux_sensor_value',
- },
- paramsKeyMap: {
- PORT: 0,
- SENSOR: 1,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['Robotis_openCM70EDU'],
- func: function (sprite, script) {
- var scope = script.executor.scope;
-
- // instruction / address / length / value / default length
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.READ;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- var data_default_address = 0;
- var data_default_length = 0;
-
- var port = script.getStringField('PORT');
- var sensor = script.getStringField('SENSOR');
-
- var increase = 0;
- if (port == 'PORT_3') {
- increase = 2;
- } else if (port == 'PORT_4') {
- increase = 3;
- } else if (port == 'PORT_5') {
- increase = 4;
- } else if (port == 'PORT_6') {
- increase = 5;
- }
-
- if (sensor == 'AUX_SERVO_POSITION') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_SERVO_POSITION[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_SERVO_POSITION[1];
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_SERVO_POSITION[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_SERVO_POSITION[1];
- } else if (sensor == 'AUX_IR') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1];
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1];
- } else if (sensor == 'AUX_TOUCH') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1];
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1];
- } else if (sensor == 'AUX_TEMPERATURE') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1];
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1];
- } else if (sensor == 'AUX_BRIGHTNESS') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1];
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1];
- } else if (sensor == 'AUX_HYDRO_THEMO_HUMIDITY') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_HYDRO_THEMO_HUMIDITY[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_HYDRO_THEMO_HUMIDITY[1];
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_HYDRO_THEMO_HUMIDITY[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_HYDRO_THEMO_HUMIDITY[1];
- } else if (sensor == 'AUX_HYDRO_THEMO_TEMPER') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_HYDRO_THEMO_TEMPER[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_HYDRO_THEMO_TEMPER[1];
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_HYDRO_THEMO_TEMPER[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_HYDRO_THEMO_TEMPER[1];
- } else if (sensor == 'AUX_ULTRASONIC') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1];
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1];
- } else if (sensor == 'AUX_MAGNETIC') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1];
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1];
- } else if (sensor == 'AUX_MOTION_DETECTION') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_MOTION_DETECTION[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_MOTION_DETECTION[1];
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_MOTION_DETECTION[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE
- .AUX_MOTION_DETECTION[1];
- } else if (sensor == 'AUX_COLOR') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1];
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1];
- } else if (sensor == 'AUX_CUSTOM') {
- data_default_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];
- data_default_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];
- }
-
- data_default_address =
- data_default_address + increase * data_default_length;
- data_address = data_default_address;
- // if (increase != 0) {
- // data_length = 6 * data_default_length;
- // }
-
- if (
- Entry.hw.sendQueue.prevAddress &&
- Entry.hw.sendQueue.prevAddress == data_default_address
- ) {
- if (
- Entry.hw.sendQueue.prevTime &&
- new Date() - Entry.hw.sendQueue.prevTime < 200
- ) {
- //throw new Entry.Utils.AsyncError();
- return Entry.hw.sendQueue.prevResult;
- }
- }
-
- Entry.Robotis_carCont.setRobotisData([
- [
- data_instruction,
- data_address,
- data_length,
- data_value,
- data_default_length,
- ],
- ]);
- // Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
- Entry.Robotis_carCont.update();
-
- var result = Entry.hw.portData[data_default_address];
- Entry.hw.sendQueue.prevAddress = data_default_address;
- Entry.hw.sendQueue.prevTime = new Date();
- Entry.hw.sendQueue.prevResult = result;
-
- return result;
- },
- syntax: {
- js: [],
- py: ['Robotis.opencm70_aux_sensor_value(%1, %2)'],
- },
- },
- robotis_openCM70_cm_buzzer_index: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.General.note_a + '(0)', '0'],
- [Lang.General.note_a + '#(1)', '1'],
- [Lang.General.note_b + '(2)', '2'],
- [Lang.General.note_c + '(3)', '3'],
- [Lang.General.note_c + '#(4)', '4'],
- [Lang.General.note_d + '(5)', '5'],
- [Lang.General.note_d + '#(6)', '6'],
- [Lang.General.note_e + '(7)', '7'],
- [Lang.General.note_f + '(8)', '8'],
- [Lang.General.note_f + '#(9)', '9'],
- [Lang.General.note_g + '(10)', '10'],
- [Lang.General.note_g + '#(11)', '11'],
- [Lang.General.note_a + '(12)', '12'],
- [Lang.General.note_a + '#(13)', '13'],
- [Lang.General.note_b + '(14)', '14'],
- [Lang.General.note_c + '(15)', '15'],
- [Lang.General.note_c + '#(16)', '16'],
- [Lang.General.note_d + '(17)', '17'],
- [Lang.General.note_d + '#(18)', '18'],
- [Lang.General.note_e + '(19)', '19'],
- [Lang.General.note_f + '(20)', '20'],
- [Lang.General.note_f + '#(21)', '21'],
- [Lang.General.note_g + '(22)', '22'],
- [Lang.General.note_g + '#(23)', '23'],
- [Lang.General.note_a + '(24)', '24'],
- [Lang.General.note_a + '#(25)', '25'],
- [Lang.General.note_b + '(26)', '26'],
- [Lang.General.note_c + '(27)', '27'],
- [Lang.General.note_c + '#(28)', '28'],
- [Lang.General.note_d + '(29)', '29'],
- [Lang.General.note_d + '#(30)', '30'],
- [Lang.General.note_e + '(31)', '31'],
- [Lang.General.note_f + '(32)', '32'],
- [Lang.General.note_f + '#(33)', '33'],
- [Lang.General.note_g + '(34)', '34'],
- [Lang.General.note_g + '#(35)', '35'],
- [Lang.General.note_a + '(36)', '36'],
- [Lang.General.note_a + '#(37)', '37'],
- [Lang.General.note_b + '(38)', '38'],
- [Lang.General.note_c + '(39)', '39'],
- [Lang.General.note_c + '#(40)', '40'],
- [Lang.General.note_d + '(41)', '41'],
- [Lang.General.note_d + '#(42)', '42'],
- [Lang.General.note_e + '(43)', '43'],
- [Lang.General.note_f + '(44)', '44'],
- [Lang.General.note_f + '#(45)', '45'],
- [Lang.General.note_g + '(46)', '46'],
- [Lang.General.note_g + '#(47)', '47'],
- [Lang.General.note_a + '(48)', '48'],
- [Lang.General.note_a + '#(49)', '49'],
- [Lang.General.note_b + '(50)', '50'],
- [Lang.General.note_c + '(51)', '51'],
- ],
- value: '0',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- {
- type: 'number',
- params: ['1'],
- },
- null,
- ],
- type: 'robotis_openCM70_cm_buzzer_index',
- },
- paramsKeyMap: {
- CM_BUZZER_INDEX: 0,
- CM_BUZZER_TIME: 1,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['Robotis_openCM70EDU'],
- func: function (sprite, script) {
- // instruction / address / length / value / default length
- var cmBuzzerIndex = script.getField('CM_BUZZER_INDEX', script);
- var cmBuzzerTime = script.getNumberValue(
- 'CM_BUZZER_TIME',
- script
- );
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address_1 = 0;
- var data_length_1 = 0;
- var data_value_1 = 0;
- var data_address_2 = 0;
- var data_length_2 = 0;
- var data_value_2 = 0;
- var interval = 100;
-
- data_address_1 =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];
- data_length_1 =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];
- // data_value_1 = cmBuzzerTime * 10;
- // TODO 텍스트 입력으로 바꾸고 최대는 5초 : 0.5 초 하려면 5를 입력 - console.log(parseInt(0.59 * 10)); max 는 5초
- data_value_1 = parseInt(cmBuzzerTime * 10);
- if (data_value_1 > 50) {
- data_value_1 = 50;
- }
-
- data_address_2 =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0];
- data_length_2 =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1];
- data_value_2 = cmBuzzerIndex;
-
- var data_sendqueue = [
- [
- data_instruction,
- data_address_1,
- data_length_1,
- data_value_1,
- ],
- [
- data_instruction,
- data_address_2,
- data_length_2,
- data_value_2,
- ],
- ];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- cmBuzzerTime * 1000 + interval
- );
- },
- syntax: {
- js: [],
- py: ['Robotis.opencm70_cm_buzzer_index(%1, %2)'],
- },
- },
- robotis_openCM70_cm_buzzer_melody: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- ['0', '0'],
- ['1', '1'],
- ['2', '2'],
- ['3', '3'],
- ['4', '4'],
- ['5', '5'],
- ['6', '6'],
- ['7', '7'],
- ['8', '8'],
- ['9', '9'],
- ['10', '10'],
- ['11', '11'],
- ['12', '12'],
- ['13', '13'],
- ['14', '14'],
- ['15', '15'],
- ['16', '16'],
- ['17', '17'],
- ['18', '18'],
- ['19', '19'],
- ['20', '20'],
- ['21', '21'],
- ['22', '22'],
- ['23', '23'],
- ['24', '24'],
- ],
- value: '0',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null, null],
- type: 'robotis_openCM70_cm_buzzer_melody',
- },
- paramsKeyMap: {
- CM_BUZZER_MELODY: 0,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['Robotis_openCM70EDU'],
- func: function (sprite, script) {
- // instruction / address / length / value / default length
- var cmBuzzerMelody = script.getField(
- 'CM_BUZZER_MELODY',
- script
- );
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address_1 = 0;
- var data_length_1 = 0;
- var data_value_1 = 0;
- var data_address_2 = 0;
- var data_length_2 = 0;
- var data_value_2 = 0;
- var interval = 100;
-
- data_address_1 =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];
- data_length_1 =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];
- data_value_1 = 255;
-
- data_address_2 =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0];
- data_length_2 =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1];
- data_value_2 = cmBuzzerMelody;
-
- var data_sendqueue = [
- [
- data_instruction,
- data_address_1,
- data_length_1,
- data_value_1,
- ],
- [
- data_instruction,
- data_address_2,
- data_length_2,
- data_value_2,
- ],
- ];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- 1000 + interval
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_cm_buzzer_melody(%1)'] },
- },
- robotis_openCM70_cm_sound_detected_clear: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null],
- type: 'robotis_openCM70_cm_sound_detected_clear',
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['Robotis_openCM70EDU'],
- func: function (sprite, script) {
- // instruction / address / length / value / default length
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1];
- data_value = 0;
-
- var data_sendqueue = [
- [data_instruction, data_address, data_length, data_value],
- ];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_cm_sound_clear()'] },
- },
- robotis_openCM70_cm_led: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_red_color, 'CM_LED_R'],
- [Lang.Blocks.robotis_common_green_color, 'CM_LED_G'],
- [Lang.Blocks.robotis_common_blue_color, 'CM_LED_B'],
- ],
- value: 'CM_LED_R',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_on, '1'],
- [Lang.Blocks.robotis_common_off, '0'],
- ],
- value: '1',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null, null, null],
- type: 'robotis_openCM70_cm_led',
- },
- paramsKeyMap: {
- CM_LED: 0,
- VALUE: 1,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['Robotis_openCM70EDU'],
- func: function (sprite, script) {
- // instruction / address / length / value / default length
- var cmLed = script.getField('CM_LED', script);
- var value = script.getField('VALUE', script);
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- if (cmLed == 'CM_LED_R') {
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[1];
- } else if (cmLed == 'CM_LED_G') {
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[1];
- } else if (cmLed == 'CM_LED_B') {
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[1];
- }
-
- data_value = value;
-
- var data_sendqueue = [
- [data_instruction, data_address, data_length, data_value],
- ];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_cm_led(%1, %2)'] },
- },
- robotis_openCM70_cm_motion: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- {
- type: 'number',
- params: ['1'],
- },
- null,
- ],
- type: 'robotis_openCM70_cm_motion',
- },
- paramsKeyMap: {
- VALUE: 0,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['Robotis_openCM70EDU'],
- func: function (sprite, script) {
- // instruction / address / length / value / default length
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[0];
- data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[1];
- data_value = script.getNumberValue('VALUE', script);
-
- var data_sendqueue = [
- [data_instruction, data_address, data_length, data_value],
- ];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_cm_motion(%1)'] },
- },
- robotis_openCM70_aux_motor_speed: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_port_1, '1'],
- [Lang.Blocks.robotis_common_port_2, '2'],
- ],
- value: '1',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_clockwhise, 'CW'],
- [Lang.Blocks.robotis_common_counter_clockwhise, 'CCW'],
- ],
- value: 'CW',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- null,
- {
- type: 'number',
- params: ['500'],
- },
- null,
- ],
- type: 'robotis_openCM70_aux_motor_speed',
- },
- paramsKeyMap: {
- PORT: 0,
- DIRECTION_ANGLE: 1,
- VALUE: 2,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['Robotis_openCM70EDU'],
- func: function (sprite, script) {
- // instruction / address / length / value / default length
- var port = script.getField('PORT', script);
- var directionAngle = script.getField('DIRECTION_ANGLE', script);
- var value = script.getNumberValue('VALUE');
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1];
-
- data_address = data_address + (port - 1) * data_length;
-
- if (directionAngle == 'CW') {
- value = value + 1024;
- if (value > 2047) {
- value = 2047;
- }
- } else {
- if (value > 1023) {
- value = 1023;
- }
- }
-
- data_value = value;
-
- var data_sendqueue = [
- [data_instruction, data_address, data_length, data_value],
- ];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: {
- js: [],
- py: ['Robotis.opencm70_aux_motor_speed(%1, %2, %3)'],
- },
- },
- robotis_openCM70_aux_servo_mode: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_port_3, '3'],
- [Lang.Blocks.robotis_common_port_4, '4'],
- [Lang.Blocks.robotis_common_port_5, '5'],
- [Lang.Blocks.robotis_common_port_6, '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_wheel_mode, '0'],
- [Lang.Blocks.robotis_common_joint_mode, '1'],
- ],
- value: '0',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null, null, null],
- type: 'robotis_openCM70_aux_servo_mode',
- },
- paramsKeyMap: {
- PORT: 0,
- MODE: 1,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['Robotis_openCM70EDU'],
- func: function (sprite, script) {
- // instruction / address / length / value / default length
- var port = script.getField('PORT', script);
- var mode = script.getField('MODE', script);
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[1];
-
- data_address = data_address + (port - 1) * data_length;
- data_value = mode;
-
- var data_sendqueue = [
- [data_instruction, data_address, data_length, data_value],
- ];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_aux_servo_mode(%1, %2)'] },
- },
- robotis_openCM70_aux_servo_speed: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_port_3, '3'],
- [Lang.Blocks.robotis_common_port_4, '4'],
- [Lang.Blocks.robotis_common_port_5, '5'],
- [Lang.Blocks.robotis_common_port_6, '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_clockwhise, 'CW'],
- [Lang.Blocks.robotis_common_counter_clockwhise, 'CCW'],
- ],
- value: 'CW',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- null,
- {
- type: 'number',
- params: ['500'],
- },
- null,
- ],
- type: 'robotis_openCM70_aux_servo_speed',
- },
- paramsKeyMap: {
- PORT: 0,
- DIRECTION_ANGLE: 1,
- VALUE: 2,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['Robotis_openCM70EDU'],
- func: function (sprite, script) {
- // instruction / address / length / value / default length
- var port = script.getField('PORT', script);
- var directionAngle = script.getField('DIRECTION_ANGLE', script);
- var value = script.getNumberValue('VALUE');
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[1];
-
- data_address = data_address + (port - 1) * data_length;
-
- if (directionAngle == 'CW') {
- value = value + 1024;
- if (value > 2047) {
- value = 2047;
- }
- } else {
- if (value > 1023) {
- value = 1023;
- }
- }
-
- data_value = value;
-
- var data_sendqueue = [
- [data_instruction, data_address, data_length, data_value],
- ];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: {
- js: [],
- py: ['Robotis.opencm70_aux_servo_speed(%1, %2, %3)'],
- },
- },
- robotis_openCM70_aux_servo_position: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_port_3, '3'],
- [Lang.Blocks.robotis_common_port_4, '4'],
- [Lang.Blocks.robotis_common_port_5, '5'],
- [Lang.Blocks.robotis_common_port_6, '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- {
- type: 'number',
- params: ['512'],
- },
- null,
- ],
- type: 'robotis_openCM70_aux_servo_position',
- },
- paramsKeyMap: {
- PORT: 0,
- VALUE: 1,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['Robotis_openCM70EDU'],
- func: function (sprite, script) {
- // instruction / address / length / value / default length
- var port = script.getField('PORT', script);
- var value = script.getNumberValue('VALUE');
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];
-
- data_address = data_address + (port - 1) * data_length;
-
- if (value > 1023) {
- value = 1023;
- } else if (value < 0) {
- value = 0;
- }
-
- data_value = value;
-
- var data_sendqueue = [
- [data_instruction, data_address, data_length, data_value],
- ];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: {
- js: [],
- py: ['Robotis.opencm70_aux_servo_position(%1, %2)'],
- },
- },
- robotis_openCM70_aux_led_module: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_port_3, '3'],
- [Lang.Blocks.robotis_common_port_4, '4'],
- [Lang.Blocks.robotis_common_port_5, '5'],
- [Lang.Blocks.robotis_common_port_6, '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Dropdown',
- options: [
- [
- Lang.Blocks.robotis_cm_led_both +
- Lang.Blocks.robotis_common_off,
- '0',
- ],
- [
- Lang.Blocks.robotis_cm_led_right +
- Lang.Blocks.robotis_common_on,
- '1',
- ],
- [
- Lang.Blocks.robotis_cm_led_left +
- Lang.Blocks.robotis_common_on,
- '2',
- ],
- [
- Lang.Blocks.robotis_cm_led_both +
- Lang.Blocks.robotis_common_on,
- '3',
- ],
- ],
- value: '0',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [null, null, null],
- type: 'robotis_openCM70_aux_led_module',
- },
- paramsKeyMap: {
- PORT: 0,
- LED_MODULE: 1,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['Robotis_openCM70EDU'],
- func: function (sprite, script) {
- // instruction / address / length / value / default length
- var port = script.getField('PORT', script);
- var ledModule = script.getField('LED_MODULE', script);
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];
-
- data_address = data_address + (port - 1) * data_length;
- data_value = ledModule;
-
- var data_sendqueue = [
- [data_instruction, data_address, data_length, data_value],
- ];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_aux_led_module(%1, %2)'] },
- },
- robotis_openCM70_aux_custom: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Dropdown',
- options: [
- [Lang.Blocks.robotis_common_port_3, '3'],
- [Lang.Blocks.robotis_common_port_4, '4'],
- [Lang.Blocks.robotis_common_port_5, '5'],
- [Lang.Blocks.robotis_common_port_6, '6'],
- ],
- value: '3',
- fontSize: 11,
- bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
- arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- null,
- {
- type: 'number',
- params: ['0'],
- },
- null,
- ],
- type: 'robotis_openCM70_aux_custom',
- },
- paramsKeyMap: {
- PORT: 0,
- VALUE: 1,
- },
- class: 'robotis_openCM70_cm',
- isNotFor: ['Robotis_openCM70EDU'],
- func: function (sprite, script) {
- // instruction / address / length / value / default length
- var port = script.getField('PORT', script);
- var value = script.getNumberValue('VALUE');
-
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];
- data_length =
- Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];
-
- data_address = data_address + (port - 1) * data_length;
- data_value = value;
-
- var data_sendqueue = [
- [data_instruction, data_address, data_length, data_value],
- ];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_aux_custom(%1, %2)'] },
- },
- robotis_openCM70_cm_custom: {
- color: EntryStatic.colorSet.block.default.HARDWARE,
- outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
- skeleton: 'basic',
- statements: [],
- params: [
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Block',
- accept: 'string',
- },
- {
- type: 'Indicator',
- img: 'block_icon/hardware_icon.svg',
- size: 12,
- },
- ],
- events: {},
- def: {
- params: [
- {
- type: 'number',
- params: ['0'],
- },
- {
- type: 'number',
- params: ['0'],
- },
- null,
- ],
- type: 'robotis_openCM70_cm_custom',
- },
- paramsKeyMap: {
- ADDRESS: 0,
- VALUE: 1,
- },
- class: 'robotis_openCM70_custom',
- isNotFor: ['Robotis_openCM70EDU'],
- func: function (sprite, script) {
- // instruction / address / length / value / default length
- var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
- var data_address = 0;
- var data_length = 0;
- var data_value = 0;
-
- data_address = script.getNumberValue('ADDRESS');
- data_value = script.getNumberValue('VALUE');
- if (data_value > 65535) {
- data_length = 4;
- } else if (data_value > 255) {
- data_length = 2;
- } else {
- data_length = 1;
- }
-
- var data_sendqueue = [
- [data_instruction, data_address, data_length, data_value],
- ];
- return Entry.Robotis_carCont.postCallReturn(
- script,
- data_sendqueue,
- Entry.Robotis_openCM70.delay
- );
- },
- syntax: { js: [], py: ['Robotis.opencm70_cm_custom(%1, %2)'] },
- },
- //endregion robotis 로보티즈
- };
-};*/
-
-module.exports = [Entry.Robotis_carCont, Entry.Robotis_openCM70, Entry.Robotis_openCM70EDU];
+'use strict';
+
+Entry.Robotis_carCont = {
+ INSTRUCTION: {
+ NONE: 0,
+ WRITE: 3,
+ READ: 2,
+ },
+ CONTROL_TABLE: {
+ // [default address, default length, address (when reads together), length (when reads together)]
+ CM_LED: [67, 1],
+ CM_SPRING_RIGHT: [69, 1, 69, 2],
+ CM_SPRING_LEFT: [70, 1, 69, 2],
+ CM_SWITCH: [71, 1],
+ CM_SOUND_DETECTED: [86, 1],
+ CM_SOUND_DETECTING: [87, 1],
+ CM_IR_LEFT: [91, 2, 91, 4],
+ CM_IR_RIGHT: [93, 2, 91, 4],
+ CM_CALIBRATION_LEFT: [95, 2],
+ CM_CALIBRATION_RIGHT: [97, 2],
+
+ AUX_MOTOR_SPEED_LEFT: [152, 2], // car_cont
+ AUX_MOTOR_SPEED_RIGHT: [154, 2],
+ },
+ setZero: function() {
+ // instruction / address / length / value / default length
+ Entry.hw.sendQueue['setZero'] = [1];
+ this.update();
+ this.setRobotisData(null);
+ Entry.hw.sendQueue['setZero'] = null;
+ this.update();
+ this.setRobotisData([
+ [Entry.Robotis_carCont.INSTRUCTION.WRITE, 152, 2, 0],
+ [Entry.Robotis_carCont.INSTRUCTION.WRITE, 154, 2, 0],
+ ]);
+
+ this.update();
+ },
+ id: '7.1',
+ name: 'robotis_carCont',
+ url: 'http://www.robotis.com/index/product.php?cate_code=111310',
+ imageName: 'robotis_carCont.png',
+ title: {
+ ko: '로보티즈 로봇자동차',
+ en: 'Robotis Robot car',
+ },
+ delay: 40,
+ postCallReturn: function(script, data, ms) {
+ if (ms <= 0) {
+ this.setRobotisData(data);
+ this.update();
+ return script.callReturn();
+ }
+
+ Entry.hw.portData = {};
+ setTimeout(function() {
+ Entry.hw.sendQueue = {}
+ // Entry.hw.portData = {};
+ }, ms - 100);
+
+ setTimeout(function() {
+ Entry.hw.sendQueue = {}
+ //Entry.hw.portData = {};
+ }, ms);
+
+ setTimeout(function() {
+ Entry.hw.sendQueue = {}
+ //Entry.hw.portData = {};
+ }, ms + 100);
+
+ setTimeout(function() {
+ Entry.hw.sendQueue = {}
+ // Entry.hw.portData = {};
+ }, ms + 200);
+
+ if (!script.isStart) {
+ script.isStart = true;
+ script.timeFlag = 1;
+ //data setting
+ this.setRobotisData(data);
+ this.update();
+
+ //delay xx ms
+ setTimeout(function() {
+ script.timeFlag = 0;
+
+ }, ms);
+
+ return script;
+ } else if (script.timeFlag == 1) {
+ this.setRobotisData(null);
+ this.update();
+ return script;
+ } else {
+ delete script.timeFlag;
+ delete script.isStart;
+ Entry.engine.isContinue = false;
+ this.update();
+ return script.callReturn();
+ }
+ },
+ wait: function(sq, ms) {
+ Entry.hw.socket.send(JSON.stringify(sq));
+
+ var start = new Date().getTime();
+ var end = start;
+ while (end < start + ms) {
+ //wait XX ms
+ end = new Date().getTime();
+ }
+ },
+ update: function() {
+ Entry.hw.update();
+ var ROBOTIS_DATA = Entry.hw.sendQueue['ROBOTIS_DATA'];
+ if (ROBOTIS_DATA) {
+ ROBOTIS_DATA.forEach(function(data) {
+ data['send'] = true;
+ });
+ }
+ this.setRobotisData(null);
+ },
+ filterSendData: function() {
+ var ROBOTIS_DATA = Entry.hw.sendQueue['ROBOTIS_DATA'];
+ if (ROBOTIS_DATA) {
+ return ROBOTIS_DATA.filter(function(data) {
+ return data.send !== true;
+ });
+ } else {
+ return null;
+ }
+ },
+ setRobotisData: function(data) {
+ var filterData = this.filterSendData();
+ if (data == null) {
+ Entry.hw.sendQueue['ROBOTIS_DATA'] = filterData;
+ } else {
+ Entry.hw.sendQueue['ROBOTIS_DATA'] = filterData ? filterData.concat(data) : data;
+ }
+ },
+};
+
+Entry.Robotis_openCM70 = {
+ hasPracticalCourse: true,
+ INSTRUCTION: {
+ NONE: 0,
+ WRITE: 3,
+ READ: 2,
+ },
+ CONTROL_TABLE: {
+ // [default address, default length, address (when reads together), length (when reads together)]
+ CM_LED_R: [79, 1],
+ CM_LED_G: [80, 1],
+ CM_LED_B: [81, 1],
+ CM_BUZZER_INDEX: [84, 1],
+ CM_BUZZER_TIME: [85, 1],
+ CM_SOUND_DETECTED: [86, 1],
+ CM_SOUND_DETECTING: [87, 1],
+ CM_USER_BUTTON: [26, 1],
+ CM_MOTION: [66, 1],
+ CM_AUTODRIVE: [40, 1],
+ CM_AUTODRIVE_LEFT_MOTOR_PORT: [42, 1],
+ CM_AUTODRIVE_RIGHT_MOTOR_PORT: [43, 1],
+ CM_AUTODRIVE_LEFT_IR_PORT: [44, 1],
+ CM_AUTODRIVE_RIGHT_IR_PORT: [45, 1],
+ CM_POWEROFF_TIMER: [76, 1],
+
+ AUX_SERVO_POSITION: [152, 2],
+ AUX_IR: [168, 2],
+ AUX_TOUCH: [202, 1],
+ AUX_TEMPERATURE: [234, 1],
+ AUX_ULTRASONIC: [242, 1],
+ AUX_MAGNETIC: [250, 1],
+ AUX_MOTION_DETECTION: [258, 1],
+ AUX_COLOR: [266, 1],
+ AUX_CUSTOM: [216, 2],
+ AUX_BRIGHTNESS: [288, 2],
+ AUX_HYDRO_THEMO_HUMIDITY: [274, 1],
+ AUX_HYDRO_THEMO_TEMPER: [282, 1],
+
+ AUX_SERVO_MODE: [126, 1],
+ AUX_SERVO_SPEED: [136, 2],
+ AUX_MOTOR_SPEED: [136, 2],
+ AUX_LED_MODULE: [210, 1],
+ },
+ IRS_MODULEWRITE: {
+ PORT3: false,
+ PORT4: false,
+ PORT5: false,
+ PORT6: false,
+ },
+ SERVO_MODULEWRITE: {
+ PORT3: false,
+ PORT4: false,
+ PORT5: false,
+ PORT6: false,
+ },
+ setZero: function() {
+ // instruction / address / length / value / default length
+ Entry.hw.sendQueue['setZero'] = [1];
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_carCont.setRobotisData(null);
+ Entry.hw.sendQueue['setZero'] = null;
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_carCont.setRobotisData([
+ /*[Entry.Robotis_openCM70.INSTRUCTION.WRITE, 136, 2, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 138, 2, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 140, 2, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 142, 2, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 144, 2, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 146, 2, 0],*/
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 136, 12, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 79, 2, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 81, 1, 0],
+ /*[Entry.Robotis_openCM70.INSTRUCTION.WRITE, 79, 1, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 80, 1, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 81, 1, 0],*/
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 86, 1, 0], // 최종 소리 // add by kjs start 170605
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 108, 4, 0],
+ /*[Entry.Robotis_openCM70.INSTRUCTION.WRITE, 108, 1, 0], // port 3
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 109, 1, 0], // port 4
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 110, 1, 0], // port 5
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 111, 1, 0] // port 6 // add by kjs end 170605*/
+ ]);
+
+ Entry.Robotis_carCont.update();
+
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 = false;
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 = false;
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 = false;
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 = false;
+
+ Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT3 = false;
+ Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT4 = false;
+ Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT5 = false;
+ Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT6 = false;
+ /*
+ Entry.hw.sendQueue['temp'] = [0];
+ Entry.Robotis_carCont.update();
+ Entry.hw.sendQueue['temp'] = null;*/
+ //Entry.Robotis_carCont.update();
+ },
+ id: '7.2',
+ name: 'robotis_openCM70',
+ url: 'http://www.robotis.com/index/product.php?cate_code=111310',
+ imageName: 'robotis_openCM70.png',
+ title: {
+ ko: '로보티즈 IoT',
+ en: 'Robotis Open CM70',
+ },
+ delay: 15,
+ readDelay: 30
+};
+
+Entry.Robotis_openCM70EDU = {
+ hasPracticalCourse: true,
+ INSTRUCTION: {
+ NONE: 0,
+ WRITE: 3,
+ READ: 2,
+ },
+ CONTROL_TABLE: {
+ // [default address, default length, address (when reads together), length (when reads together)]
+ CM_LED_R: [79, 1],
+ CM_LED_G: [80, 1],
+ CM_LED_B: [81, 1],
+ CM_BUZZER_INDEX: [84, 1],
+ CM_BUZZER_TIME: [85, 1],
+ CM_SOUND_DETECTED: [86, 1],
+ CM_SOUND_DETECTING: [87, 1],
+ CM_USER_BUTTON: [26, 1],
+ CM_MOTION: [66, 1],
+ CM_AUTODRIVE: [40, 1],
+ CM_AUTODRIVE_LEFT_MOTOR_PORT: [42, 1],
+ CM_AUTODRIVE_RIGHT_MOTOR_PORT: [43, 1],
+ CM_AUTODRIVE_LEFT_IR_PORT: [44, 1],
+ CM_AUTODRIVE_RIGHT_IR_PORT: [45, 1],
+ CM_POWEROFF_TIMER: [76, 1],
+
+ AUX_SERVO_POSITION: [152, 2],
+ AUX_IR: [168, 2],
+ AUX_TOUCH: [202, 1],
+ AUX_TEMPERATURE: [234, 1],
+ AUX_ULTRASONIC: [242, 1],
+ AUX_MAGNETIC: [250, 1],
+ AUX_MOTION_DETECTION: [258, 1],
+ AUX_COLOR: [266, 1],
+ AUX_CUSTOM: [216, 2],
+ AUX_BRIGHTNESS: [288, 2],
+ AUX_HYDRO_THEMO_HUMIDITY: [274, 1],
+ AUX_HYDRO_THEMO_TEMPER: [282, 1],
+
+ AUX_SERVO_MODE: [126, 1],
+ AUX_SERVO_SPEED: [136, 2],
+ AUX_MOTOR_SPEED: [136, 2],
+ AUX_LED_MODULE: [210, 1],
+ },
+ IRS_MODULEWRITE: {
+ PORT3: false,
+ PORT4: false,
+ PORT5: false,
+ PORT6: false,
+ },
+ SERVO_MODULEWRITE: {
+ PORT3: false,
+ PORT4: false,
+ PORT5: false,
+ PORT6: false,
+ },
+ setZero: function() {
+ // instruction / address / length / value / default length
+ Entry.hw.sendQueue['setZero'] = [1];
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_carCont.setRobotisData(null);
+ Entry.hw.sendQueue['setZero'] = null;
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_carCont.setRobotisData([
+ /*[Entry.Robotis_openCM70.INSTRUCTION.WRITE, 136, 2, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 138, 2, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 140, 2, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 142, 2, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 144, 2, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 146, 2, 0],*/
+ [Entry.Robotis_openCM70EDU.INSTRUCTION.WRITE, 136, 12, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 79, 2, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 81, 1, 0],
+ /*[Entry.Robotis_openCM70.INSTRUCTION.WRITE, 79, 1, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 80, 1, 0],
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 81, 1, 0],*/
+ [Entry.Robotis_openCM70EDU.INSTRUCTION.WRITE, 86, 1, 0], // 최종 소리 // add by kjs start 170605
+ [Entry.Robotis_openCM70EDU.INSTRUCTION.WRITE, 108, 4, 0],
+ /*[Entry.Robotis_openCM70.INSTRUCTION.WRITE, 108, 1, 0], // port 3
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 109, 1, 0], // port 4
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 110, 1, 0], // port 5
+ [Entry.Robotis_openCM70.INSTRUCTION.WRITE, 111, 1, 0] // port 6 // add by kjs end 170605*/
+ ]);
+
+ Entry.Robotis_carCont.update();
+
+ Entry.Robotis_openCM70EDU.IRS_MODULEWRITE.PORT3 = false;
+ Entry.Robotis_openCM70EDU.IRS_MODULEWRITE.PORT4 = false;
+ Entry.Robotis_openCM70EDU.IRS_MODULEWRITE.PORT5 = false;
+ Entry.Robotis_openCM70EDU.IRS_MODULEWRITE.PORT6 = false;
+
+ Entry.Robotis_openCM70EDU.SERVO_MODULEWRITE.PORT3 = false;
+ Entry.Robotis_openCM70EDU.SERVO_MODULEWRITE.PORT4 = false;
+ Entry.Robotis_openCM70EDU.SERVO_MODULEWRITE.PORT5 = false;
+ Entry.Robotis_openCM70EDU.SERVO_MODULEWRITE.PORT6 = false;
+
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 = false;
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 = false;
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 = false;
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 = false;
+
+ Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT3 = false;
+ Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT4 = false;
+ Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT5 = false;
+ Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT6 = false;
+ /*
+ Entry.hw.sendQueue['temp'] = [0];
+ Entry.Robotis_carCont.update();
+ Entry.hw.sendQueue['temp'] = null;*/
+ //Entry.Robotis_carCont.update();
+ },
+ monitorTemplate: {
+ imgPath: 'hw/robotis_opencm70.png',
+ width: 800,
+ height: 800,
+ listPorts: {
+ DETECTEDSOUNDE: { name: '최종소리', type: 'input', pos: { x: 0, y: 0 } },
+ DETECTINGSOUNDE1: { name: '실시간소리', type: 'input', pos: { x: 0, y: 0 } },
+ //SND: { name: Lang.Hw.buzzer, type: 'output', pos: { x: 0, y: 0 } },
+ //FND: { name: '전원', type: 'output', pos: { x: 0, y: 0 } },
+ },
+ ports: {
+ USERBUTTONSTATE: { name: 'USERBUTTON', type: 'input', pos: { x: 565, y: 335 } },
+ //'LEDR': { name: 'R', type: 'input', pos: { x: 140, y: 300 } },
+ //'LEDG': { name: 'G', type: 'input', pos: { x: 170, y: 300 } },
+ //'LEDB': { name: 'B', type: 'input', pos: { x: 200, y: 300 } },
+ //'GM1': { name: 'GEARD1', type: 'input', pos: { x: 450, y: 300 } },
+ //'GM2': { name: 'GEARD2', type: 'input', pos: { x: 450, y: 480 } },
+ MONITORPORT0: { name: 'PORT3', type: 'input', pos: { x: 320, y: 320 } },
+ MONITORPORT1: { name: 'PORT4', type: 'input', pos: { x: 330, y: 330 } },
+ MONITORPORT2: { name: 'PORT5', type: 'input', pos: { x: 320, y: 440 } },
+ MONITORPORT3: { name: 'PORT6', type: 'input', pos: { x: 330, y: 460 } },
+ },
+ mode: 'both',
+ },
+ id: '7.3',
+ name: 'robotis_openCM70EDU',
+ url: 'http://www.robotis.com/index/product.php?cate_code=111310',
+ imageName: 'robotis_openCM70EDU.png',
+ title: {
+ ko: '로보티즈 실과',
+ en: 'ROBOTIS InfoRobot',
+ },
+ delay: 15,
+};
+
+Entry.Robotis_carCont.blockMenuBlocks = [
+ 'robotis_carCont_sensor_value',
+ 'robotis_carCont_cm_led',
+ 'robotis_carCont_cm_sound_detected_clear',
+ 'robotis_carCont_aux_motor_speed',
+ 'robotis_carCont_aux_motor_speed2',
+ 'robotis_carCont_cm_calibration',
+];
+
+Entry.Robotis_carCont.setLanguage = function() {
+ return {
+ ko: {
+ template: {
+ robotis_carCont_sensor_value: '%1 값',
+ robotis_carCont_cm_led: '4번 LED %1 , 1번 LED %2 %3',
+ robotis_carCont_cm_sound_detected_clear: '최종소리감지횟수 초기화 %1',
+ robotis_carCont_aux_motor_speed:
+ '%1 감속모터 속도를 %2 , 출력값을 %3 (으)로 정하기 %4',
+ robotis_carCont_cm_calibration:
+ '%1 적외선 센서 캘리브레이션 값을 %2 (으)로 정하기 %3',
+ robotis_openCM70_cm_custom_value: '직접입력 주소 ( %1 ) %2 값',
+ robotis_openCM70_sensor_value: '제어기 %1 값',
+ robotis_openCM70_aux_sensor_value: '%1 %2 값',
+ robotis_openCM70_cm_buzzer_index: '제어기 음계값 %1 을(를) %2 초 동안 연주 %3',
+ robotis_openCM70_cm_buzzer_melody: '제어기 멜로디 %1 번 연주 %2',
+ robotis_openCM70_cm_sound_detected_clear: '최종소리감지횟수 초기화 %1',
+ robotis_openCM70_cm_led: '제어기 %1 LED %2 %3',
+ //robotis_openCM70_cm_motion: '모션 %1 번 실행 %2',
+ robotis_openCM70_cm_autodrive_motor: '🚗 자율주행 자동차 %1 모터를 %2 에 연결 %3',
+ robotis_openCM70_cm_autodrive_ir: '🚗 자율주행 자동차 %1 적외선센서를 %2 에 연결 %3',
+ robotis_openCM70_cm_autodrive_speed: '🚗 차로를 따라 %1의 속도로 자율주행 %2',
+ robotis_openCM70_aux_car_move: '로봇을 %1% 의 속도로 %2 %3',
+ robotis_openCM70_aux_motor_speed:
+ '%1 감속모터 속도를 %2 , 출력값을 %3%로 정하기 %4',
+ robotis_openCM70_aux_servo_mode: '%1 서보모터 모드를 %2 (으)로 정하기 %3',
+ robotis_openCM70_aux_servo_speed:
+ '%1 서보모터 속도를 %2 , 출력값을 %3%로 정하기 %4',
+ robotis_openCM70_aux_servo_position: '%1 서보모터 위치를 %2도로 정하기 %3',
+ robotis_openCM70_aux_led_module: '%1 LED 모듈을 %2 (으)로 정하기 %3',
+ robotis_openCM70_cm_poweroff_timer: '제어기 자동꺼짐 타이머 %1 %2',
+ robotis_openCM70_aux_custom: '%1 사용자 장치를 %2 (으)로 정하기 %3',
+ robotis_openCM70_cm_custom: '직접입력 주소 ( %1 ) (을)를 %2 (으)로 정하기 %3',
+ },
+ Helper: {
+ robotis_carCont_sensor_value:
+ '왼쪽 접속 센서 : 접촉(1), 비접촉(0) 값 입니다.
오른쪽 접촉 센서 : 접촉(1), 비접촉(0) 값 입니다.
선택 버튼 상태 : 접촉(1), 비접촉(0) 값 입니다.
최종 소리 감지 횟수 : 마지막 실시간 소리 감지 횟수 값 입니다.
실시간 소리 감지 횟수 : 약 1초 안에 다음 소리가 감지되면 1씩 증가합니다.
왼쪽 적외선 센서 : 물체와 가까울 수록 큰 값 입니다.
오른쪽 적외선 센서 : 물체와 가까울 수록 큰 값 값 입니다.
왼쪽 적외선 센서 캘리브레이션 값 : 적외선 센서의 캘리브레이션 값 입니다.
오른쪽 적외선 센서 캘리브레이션 값 : 적외선 센서의 캘리브레이션 값 입니다.
(*캘리브레이션 값 - 적외선센서 조정 값)',
+ robotis_carCont_cm_led:
+ '4개의 LED 중 1번 또는 4번 LED 를 켜거나 끕니다.
LED 2번과 3번은 동작 지원하지 않습니다.',
+ robotis_carCont_cm_sound_detected_clear:
+ '최종 소리 감지횟 수를 0 으로 초기화 합니다.',
+ robotis_carCont_aux_motor_speed: '감속모터 속도를 0 ~ 1023 의 값(으)로 정합니다.',
+ robotis_carCont_cm_calibration:
+ '적외선센서 조정 값(http://support.robotis.com/ko/: 자동차로봇> 2. B. 적외선 값 조정)을 직접 정합니다.',
+ robotis_openCM70_sensor_value:
+ '최종 소리 감지 횟수 : 마지막 실시간 소리 감지 횟수 값 입니다.
실시간 소리 감지 횟수 : 약 1초 안에 다음 소리가 감지되면 1씩 증가합니다.
사용자 버튼 상태 : 접촉(1), 비접촉(0) 값 입니다.최종 소리 감지 횟수 : 마지막 실시간 소리 감지 횟수 값 입니다.
실시간 소리 감지 횟수 : 약 1초 안에 다음 소리가 감지되면 1씩 증가합니다.
사용자 버튼 상태 : 접촉(1), 비접촉(0) 값 입니다.',
+ robotis_openCM70_aux_sensor_value:
+ '서보모터 위치 : 0 ~ 1023, 중간 위치의 값은 512 입니다.
적외선센서 : 물체와 가까울 수록 큰 값 입니다.
접촉센서 : 접촉(1), 비접촉(0) 값 입니다.
조도센서(CDS) : 0 ~ 1023, 밝을 수록 큰 값 입니다.
온습도센서(습도) : 0 ~ 100, 습할 수록 큰 값 입니다.
온습도센서(온도) : -20 ~ 100, 온도가 높을 수록 큰 값 입니다.
온도센서 : -20 ~ 100, 온도가 높을 수록 큰 값 입니다.
초음파센서 : -
자석센서 : 접촉(1), 비접촉(0) 값 입니다.
동작감지센서 : 동작 감지(1), 동작 미감지(0) 값 입니다.
컬러센서 : 알수없음(0), 흰색(1), 검은색(2), 빨간색(3), 녹색(4), 파란색(5), 노란색(6) 값 입니다.
사용자 장치 : 사용자 센서 제작에 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.',
+ robotis_openCM70_cm_buzzer_index: '음계를 0.1 ~ 5 초 동안 연주 합니다.',
+ robotis_openCM70_cm_buzzer_melody:
+ "멜로디를 연주 합니다.
멜로디를 연속으로 재생하는 경우, 다음 소리가 재생되지 않으면 '흐름 > X 초 기다리기' 블록을 사용하여 기다린 후 실행합니다.",
+ robotis_openCM70_cm_sound_detected_clear:
+ '최종 소리 감지횟 수를 0 으로 초기화 합니다.',
+ robotis_openCM70_cm_led: '제어기의 빨간색, 녹색, 파란색 LED 를 켜거나 끕니다.',
+ //robotis_openCM70_cm_motion: '제어기에 다운로드 되어있는 모션을 실행합니다.',
+ robotis_openCM70_cm_autodrive_motor: '자율주행 자동차의 모터 포트를 지정합니다.',
+ robotis_openCM70_cm_autodrive_ir: '자율주행 자동차의 적외선 센서 포트를 지정합니다.',
+ robotis_openCM70_cm_autodrive_speed: '지정한 속도로 자율주행을 수행합니다.',
+ robotis_openCM70_aux_car_move: '로봇을 지정한 속도와 방향으로 움직이도록 합니다.',
+ robotis_openCM70_aux_motor_speed: '감속모터 속도를 0 ~ 100% 의 값으로 정합니다.',
+ robotis_openCM70_aux_servo_mode:
+ '서보모터를 회전모드 또는 관절모드로 정합니다.
한번 설정된 모드는 계속 적용됩니다.
회전모드는 서보모터 속도를 지정하여 서보모터를 회전 시킵니다.
관절모드는 지정한 서보모터 속도로 서보모터 위치를 이동 시킵니다.',
+ robotis_openCM70_aux_servo_speed: '서보모터 속도를 0 ~ 100% 의 값으로 정합니다.',
+ robotis_openCM70_aux_servo_position:
+ '서보모터 위치를 -150 ~ 150도 의 값(으)로 정합니다.
서보모터 속도와 같이 사용해야 합니다.',
+ robotis_openCM70_aux_led_module: 'LED 모듈의 LED 를 켜거나 끕니다.',
+ robotis_openCM70_aux_custom:
+ '사용자 센서 제작에 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.',
+ robotis_openCM70_cm_poweroff_timer:
+ '제어기의 자동꺼짐 타이머를 설정합니다.
설정된 만큼의 시간동안 통신이 진행되지 않으면 제어기는 자동으로 꺼집니다.',
+ robotis_openCM70_cm_custom_value:
+ '컨트롤 테이블 주소를 직접 입력하여 값을 확인 합니다.
컨트롤 테이블 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.',
+ robotis_openCM70_cm_custom:
+ '컨트롤 테이블 주소를 직접 입력하여 값을 정합니다.
컨트롤 테이블 대한 설명은 ROBOTIS e-매뉴얼(http://support.robotis.com/ko/)을 참고하세요.',
+ },
+ Blocks: {
+ robotis_carCont_aux_motor_speed_1: '감속모터 속도를',
+ robotis_carCont_aux_motor_speed_2: ', 출력값을',
+ robotis_carCont_calibration_1: '적외선 센서 캘리브레이션 값을',
+ robotis_common_case_01: '(을)를',
+ robotis_common_set: '(으)로 정하기',
+ robotis_common_value: '값',
+ robotis_common_clockwhise: '시계방향',
+ robotis_common_counter_clockwhise: '반시계방향',
+ robotis_common_wheel_mode: '회전모드',
+ robotis_common_joint_mode: '관절모드',
+ robotis_common_red_color: '빨간색',
+ robotis_common_green_color: '녹색',
+ robotis_common_blue_color: '파란색',
+ robotis_common_on: '켜기',
+ robotis_common_off: '끄기',
+ robotis_common_cm: '제어기',
+ robotis_common_port_1: '포트 1',
+ robotis_common_port_2: '포트 2',
+ robotis_common_port_3: '포트 3',
+ robotis_common_port_4: '포트 4',
+ robotis_common_port_5: '포트 5',
+ robotis_common_port_6: '포트 6',
+ robotis_common_play_buzzer: '연주',
+ robotis_common_play_motion: '실행',
+ robotis_common_motion: '모션',
+ robotis_common_index_number: '번',
+ robotis_common_left: '왼쪽',
+ robotis_common_right: '오른쪽',
+ robotis_common_minute: '분',
+ robotis_common_forward: '직진',
+ robotis_common_backward: '후진',
+ robotis_common_turn_left: '좌회전',
+ robotis_common_turn_right: '우회전',
+ robotis_common_stop: '정지',
+ robotis_cm_custom: '직접입력 주소',
+ robotis_cm_spring_left: '왼쪽 접촉 센서',
+ robotis_cm_spring_right: '오른쪽 접촉 센서',
+ robotis_cm_led_left: '왼쪽 LED',
+ robotis_cm_led_right: '오른쪽 LED',
+ robotis_cm_led_both: '양 쪽 LED',
+ robotis_cm_switch: '선택 버튼 상태',
+ robotis_cm_user_button: '사용자 버튼 상태',
+ robotis_cm_sound_detected: '최종 소리 감지 횟수',
+ robotis_cm_sound_detecting: '실시간 소리 감지 횟수',
+ robotis_cm_ir_left: '왼쪽 적외선 센서',
+ robotis_cm_ir_right: '오른쪽 적외선 센서',
+ robotis_cm_calibration_left: '왼쪽 적외선 센서 캘리브레이션 값',
+ robotis_cm_calibration_right: '오른쪽 적외선 센서 캘리브레이션 값',
+ robotis_cm_clear_sound_detected: '최종소리감지횟수 초기화',
+ robotis_cm_buzzer_index: '음계값',
+ robotis_cm_buzzer_melody: '멜로디',
+ robotis_cm_led_1: '1번 LED',
+ robotis_cm_led_4: '4번 LED',
+ robotis_aux_servo_position: '서보모터 위치',
+ robotis_aux_ir: '적외선센서',
+ robotis_aux_touch: '접촉센서',
+ robotis_aux_brightness: '조도센서(CDS)',
+ robotis_aux_hydro_themo_humidity: '온습도센서(습도)',
+ robotis_aux_hydro_themo_temper: '온습도센서(온도)',
+ robotis_aux_temperature: '온도센서',
+ robotis_aux_ultrasonic: '초음파센서',
+ robotis_aux_magnetic: '자석센서',
+ robotis_aux_motion_detection: '동작감지센서',
+ robotis_aux_color: '컬러센서',
+ robotis_aux_custom: '사용자 장치',
+ },
+ },
+ en: {
+ template: {
+ robotis_carCont_sensor_value: 'Value %1',
+ robotis_carCont_cm_led: '%1 LED 4, %2 LED %3',
+ robotis_carCont_cm_sound_detected_clear:
+ 'Initialize the final number of sound detection %1',
+ robotis_carCont_aux_motor_speed:
+ 'Set the speed of decelerating motor of %1 to %2, and the output value to %3 %4',
+ robotis_carCont_cm_calibration:
+ 'Set %1 value of infrared sensor calibration to %2 %3',
+ robotis_openCM70_cm_custom_value: 'Custom address ( %1 ) value %2',
+ robotis_openCM70_sensor_value: 'Controller value %1',
+ robotis_openCM70_aux_sensor_value: 'Value %1 %2',
+ robotis_openCM70_cm_buzzer_index:
+ 'Play %1 controller scale value for %2 seconds %3 ',
+ robotis_openCM70_cm_buzzer_melody: 'Play controller melody %1 times %2',
+ robotis_openCM70_cm_sound_detected_clear:
+ 'Initialize the final number of sound detection %1',
+ robotis_openCM70_cm_led: 'Controller %1 LED %2 %3',
+ //robotis_openCM70_cm_motion: 'Play the motion %1 times',
+ robotis_openCM70_cm_autodrive_motor: 'Autonomous driving car %1 motor uses %2 %3',
+ robotis_openCM70_cm_autodrive_ir: 'Autonomous driving car %1 IR sensor uses %2 %3',
+ robotis_openCM70_cm_autodrive_speed: 'Perform autonomous driving at the speed of %1 %2',
+ robotis_openCM70_aux_car_move: 'Make the robot %2 at a speed of %1% %3',
+ robotis_openCM70_aux_motor_speed:
+ 'Set the speed of decelerating motor of %1 to %2 , and the output value to %3% %4',
+ robotis_openCM70_aux_servo_mode: 'Set the mode of %1 servo motor to %2 %3',
+ robotis_openCM70_aux_servo_speed:
+ 'Set the speed of servo motor of %1 to %2 , and the output value to %3% %4',
+ robotis_openCM70_aux_servo_position: 'Set the position of %1 servo motor to %2 degree %3',
+ robotis_openCM70_aux_led_module: 'Set the LED module of %1 as %2 %3',
+ robotis_openCM70_aux_custom: 'Set the user device of %1 as %2 %3',
+ robotis_openCM70_cm_poweroff_timer: 'Set auto-off timer as %1 %2',
+ robotis_openCM70_cm_custom: 'Set the custom address ( %1 ) as %2 %3',
+ },
+ Helper: {
+ robotis_openCM70_sensor_value:
+ 'Final number of sound detection : the value of the final detected sound times.
Number of live sound detection : increases by 1 when it detects the next sound within 1 second.
Status of user button: the value of contact (1), non-contact (0).Final number of sound detection : the value of the number of last live sound detection.
Number of live sound detection : increases by 1 when it detects the next sound within 1 second.
Status of user button : the value of contact (1), non-contact (0).',
+ robotis_openCM70_aux_sensor_value:
+ "Position of servo motor: 0-1023, the value of the middle is 512.
Infrared sensor : the value is larger when it's close to an object.
Contact sensor: the value of contact(1), non-contact(0).
CDS: 0-1023, the value is larger when it's brighter.
Temperature-humidity sensor (humidity) : 0-100, the value is larger when it's more humid.
Temperature-humidity sensor (temperature) : -20 - 100, the value is larger when it's higher in temperature.
Temperature sensor : -20 - 100, the value is larger when it's higher in temperature.
Ultrasound sensor: -
Magnetic sensor : the value of contact(1), non-contact(0).
Motion detector: the value of detected motion(1), non-detected motion(0).
Color sensor: the value of unknown(0), white(1), black(2), red(3), green(4), blue(5), yellow(6).
User device: please refer to ROBOTIS e-manual (http://support.robotis.com/ko/) for the explanation on user sensor production.",
+ robotis_openCM70_cm_buzzer_index: 'Plays the scale for 0.1 to 5 seconds.',
+ robotis_openCM70_cm_buzzer_melody:
+ "Plays melody.
If the following sound doesn't play when repeatedly playing melodies, use the block 'flow > wait for X seconds' and execute it again.",
+ robotis_openCM70_cm_sound_detected_clear: 'Final number of sound detection ',
+ robotis_openCM70_cm_led: 'Turns the red, green, blue LED of the device on or off.',
+ //robotis_openCM70_cm_motion: 'Executes the motion downloaded on the device.',
+ robotis_openCM70_cm_autodrive_motor: 'Specifies the motor port of the autonomous driving car.',
+ robotis_openCM70_cm_autodrive_ir: 'Specifies the IR sensor port of the autonomous driving car.',
+ robotis_openCM70_cm_autodrive_speed: 'Perform autonomous driving at the specified speed along the lane.',
+ robotis_openCM70_aux_car_move: 'Make the robot move at the specified speed and direction.',
+ robotis_openCM70_aux_motor_speed:
+ 'Sets the speed of decelerating motor to the value of 0 - 100%.',
+ robotis_openCM70_aux_servo_mode:
+ "Sets the servo motor as wheel mode or joint mode.
The same mode continues to apply once it's set.
Wheel mode designates the servo motor's speed, and spins the servo motor.
Joint mode moves the servo motor's position with the set servo motor speed.",
+ robotis_openCM70_aux_servo_speed:
+ "Sets servo motor's speed to the value of 0 - 1023.",
+ robotis_openCM70_aux_servo_position:
+ "Sets servo motor's position to the value of -150 ~ 150 degree.
Use as servo motor speed",
+ robotis_openCM70_aux_led_module: 'Turns the LED of LED module on or off.',
+ robotis_openCM70_aux_custom:
+ 'Please refer to the ROBOTIS e-manual (http://support.robotis.com/ko/) for the explanation of user sensor production.',
+ robotis_openCM70_cm_poweroff_timer: "Set the controllers auto-off timer.
If there is no communication for the set amount of time, the controller will automatically turn off.",
+ robotis_openCM70_cm_custom_value:
+ 'Checks the value by directly inputting the control table address.
Please refer to the ROBOTIS e-manual (http://support.robotis.com/ko/) for the explanation about control table.',
+ robotis_openCM70_cm_custom:
+ 'Checks the value by directly inputting the control table address.
Please refer to the ROBOTIS e-manual (http://support.robotis.com/ko/) for the explanation about control table.',
+ robotis_carCont_sensor_value:
+ "Left connected sensor : the value of contact (1), non-contact (0).
Right contact sensor: the value of contact (1), non-contact (0).
Final number of sound detection : the value of the number of last live sound detection.
Number of live sound detection : increases by 1 when it detects the next sound within 1 second.
Right infrared sensor: the value is larger when it's closer to an object.
Value of left infrared sensor calibration : the calibration value of the infrared sensor.
Value of right infrared sensor calibration : the calibration value of the infrared sensor.
(*Calibration value - control value of infrared sensor)",
+ robotis_carCont_cm_led:
+ 'Turns LED 1 or LED 4 among the 4 LEDs on or off.
Not applicable to LED 2 and LED 3.',
+ robotis_carCont_cm_sound_detected_clear:
+ 'Initializes the final amount of detected sound to 0.',
+ robotis_carCont_aux_motor_speed:
+ 'Sets the speed of decelerating motor to the value of 0-1023.',
+ robotis_carCont_cm_calibration:
+ 'Sets the controlling value of infrared sensor (http://support.robotis.com/ko/: automobile robot> 2. B. control infrared value).',
+ },
+ Blocks: {
+ robotis_carCont_aux_motor_speed_1: 'Speed of decelerating motor',
+ robotis_carCont_aux_motor_speed_2: ', the output value',
+ robotis_carCont_calibration_1: 'Value of the infrared sensor calibration ',
+ robotis_common_case_01: '(을)를',
+ robotis_common_set: 'the output value',
+ robotis_common_value: 'Value',
+ robotis_common_clockwhise: 'Clockwise',
+ robotis_common_counter_clockwhise: 'Counterclockwise',
+ robotis_common_wheel_mode: 'Wheel mode',
+ robotis_common_joint_mode: 'Joint mode',
+ robotis_common_red_color: 'Red',
+ robotis_common_green_color: 'Green',
+ robotis_common_blue_color: 'Blue',
+ robotis_common_on: 'Turn on',
+ robotis_common_off: 'Turn off',
+ robotis_common_cm: 'Controller',
+ robotis_common_port_1: 'Port 1',
+ robotis_common_port_2: 'Port 2',
+ robotis_common_port_3: 'Port 3',
+ robotis_common_port_4: 'Port 4',
+ robotis_common_port_5: 'Port 5',
+ robotis_common_port_6: 'Port 6',
+ robotis_common_play_buzzer: 'Play',
+ robotis_common_play_motion: 'Play',
+ robotis_common_motion: 'Motion',
+ robotis_common_index_number: 'Number',
+ robotis_common_left: 'Left',
+ robotis_common_right: 'Right',
+ robotis_common_minute: 'minute(s)',
+ robotis_common_forward: 'Forward',
+ robotis_common_backward: 'Backword',
+ robotis_common_turn_left: 'Turn left',
+ robotis_common_turn_right: 'Turn Right',
+ robotis_common_stop: 'Stop',
+ robotis_cm_custom: 'Custom address',
+ robotis_cm_spring_left: 'Left contact sensor',
+ robotis_cm_spring_right: 'Right contact sensor',
+ robotis_cm_led_left: 'Left LED',
+ robotis_cm_led_right: 'Right LED',
+ robotis_cm_led_both: 'Both LED',
+ robotis_cm_switch: 'Status of the switch',
+ robotis_cm_user_button: 'Status of user button',
+ robotis_cm_sound_detected: 'Final number of sound detection ',
+ robotis_cm_sound_detecting: 'Number of live sound detection ',
+ robotis_cm_ir_left: 'Left infrared sensor',
+ robotis_cm_ir_right: 'Right infrared sensor',
+ robotis_cm_calibration_left: 'Value of the left infrared sensor calibration ',
+ robotis_cm_calibration_right: 'Value of the right infrared sensor calibration ',
+ robotis_cm_clear_sound_detected: 'Initialize the final number of sound detection',
+ robotis_cm_buzzer_index: 'Scale index',
+ robotis_cm_buzzer_melody: 'Melody',
+ robotis_cm_led_1: 'LED 1',
+ robotis_cm_led_4: 'LED 4',
+ robotis_aux_servo_position: 'Position of servo motor',
+ robotis_aux_ir: 'Infrared sensor',
+ robotis_aux_touch: 'Contact sensor',
+ robotis_aux_brightness: 'CDS',
+ robotis_aux_hydro_themo_humidity: 'Temperature-humidity sensor (humidity)',
+ robotis_aux_hydro_themo_temper: 'Temperature-humidity sensor (temperature)',
+ robotis_aux_temperature: 'Temperature sensor',
+ robotis_aux_ultrasonic: 'Ultrasonic sensor',
+ robotis_aux_magnetic: 'Magnetic sensor',
+ robotis_aux_motion_detection: 'Motion detector',
+ robotis_aux_color: 'Color sensor',
+ robotis_aux_custom: 'User device',
+ },
+ },
+ };
+};
+
+Entry.Robotis_carCont.getBlocks = function() {
+ return {
+ //region robotis 로보티즈 carCont
+ robotis_carCont_sensor_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_string_field',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_cm_spring_left, 'CM_SPRING_LEFT'],
+ [Lang.Blocks.robotis_cm_spring_right, 'CM_SPRING_RIGHT'],
+ [Lang.Blocks.robotis_cm_switch, 'CM_SWITCH'],
+ [Lang.Blocks.robotis_cm_sound_detected, 'CM_SOUND_DETECTED'],
+ [Lang.Blocks.robotis_cm_sound_detecting, 'CM_SOUND_DETECTING'],
+ [Lang.Blocks.robotis_cm_ir_left, 'CM_IR_LEFT'],
+ [Lang.Blocks.robotis_cm_ir_right, 'CM_IR_RIGHT'],
+ [Lang.Blocks.robotis_cm_calibration_left, 'CM_CALIBRATION_LEFT'],
+ [Lang.Blocks.robotis_cm_calibration_right, 'CM_CALIBRATION_RIGHT'],
+ ],
+ value: 'CM_SPRING_LEFT',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_carCont_sensor_value',
+ },
+ paramsKeyMap: {
+ SENSOR: 0,
+ },
+ class: 'robotis_carCont_cm',
+ isNotFor: ['robotis_carCont'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var data_instruction = Entry.Robotis_carCont.INSTRUCTION.READ;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ var data_default_address = 0;
+ var data_default_length = 0;
+
+ var sensor = script.getStringField('SENSOR');
+
+ if (sensor == 'CM_SPRING_LEFT') {
+ data_default_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[0];
+ data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[1];
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[2];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[3];
+ } else if (sensor == 'CM_SPRING_RIGHT') {
+ data_default_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[0];
+ data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[1];
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[2];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[3];
+ } else if (sensor == 'CM_SWITCH') {
+ data_default_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0];
+ data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1];
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1];
+ } else if (sensor == 'CM_SOUND_DETECTED') {
+ data_default_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0];
+ data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1];
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1];
+ } else if (sensor == 'CM_SOUND_DETECTING') {
+ data_default_address =
+ Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0];
+ data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1];
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1];
+ } else if (sensor == 'CM_IR_LEFT') {
+ data_default_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[0];
+ data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[1];
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[2];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[3];
+ } else if (sensor == 'CM_IR_RIGHT') {
+ data_default_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[0];
+ data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[1];
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[2];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[3];
+ } else if (sensor == 'CM_CALIBRATION_LEFT') {
+ data_default_address =
+ Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0];
+ data_default_length =
+ Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1];
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1];
+ } else if (sensor == 'CM_CALIBRATION_RIGHT') {
+ data_default_address =
+ Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0];
+ data_default_length =
+ Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1];
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1];
+ } else if (sensor == 'CM_BUTTON_STATUS') {
+ data_default_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0];
+ data_default_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1];
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1];
+ }
+
+ //Entry.Robotis_carCont.setRobotisData([[data_instruction, data_address, data_length, data_value, data_default_length]]);
+ //// Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
+ //Entry.Robotis_carCont.update();
+ //
+ //return Entry.hw.portData[data_default_address];
+
+ if (
+ Entry.hw.sendQueue.prevAddress &&
+ Entry.hw.sendQueue.prevAddress == data_default_address
+ ) {
+ if (
+ Entry.hw.sendQueue.prevTime &&
+ new Date() - Entry.hw.sendQueue.prevTime < 300
+ ) {
+ //throw new Entry.Utils.AsyncError();
+ return Entry.hw.sendQueue.prevResult;
+ }
+ }
+
+ Entry.Robotis_carCont.setRobotisData([
+ [data_instruction, data_address, data_length, data_value, data_default_length],
+ ]);
+ // Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
+ Entry.Robotis_carCont.update();
+
+ var result = Entry.hw.portData[data_default_address];
+ Entry.hw.sendQueue.prevAddress = data_default_address;
+ Entry.hw.sendQueue.prevTime = new Date();
+ Entry.hw.sendQueue.prevResult = result;
+
+ return result;
+ },
+ syntax: { js: [], py: ['Robotis.carcont_sensor_value(%1)'] },
+ },
+ robotis_carCont_cm_led: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_on, '1'],
+ [Lang.Blocks.robotis_common_off, '0'],
+ ],
+ value: '1',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_on, '1'],
+ [Lang.Blocks.robotis_common_off, '0'],
+ ],
+ value: '1',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null, null],
+ type: 'robotis_carCont_cm_led',
+ },
+ paramsKeyMap: {
+ VALUE_LEFT: 0,
+ VALUE_RIGHT: 1,
+ },
+ class: 'robotis_carCont_cm',
+ isNotFor: ['robotis_carCont'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var value_left = script.getField('VALUE_LEFT', script);
+ var value_right = script.getField('VALUE_RIGHT', script);
+
+ var data_instruction = Entry.Robotis_carCont.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[0];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[1];
+
+ if (value_left == 1 && value_right == 1) {
+ data_value = 9;
+ } else if (value_left == 1 && value_right == 0) {
+ data_value = 8;
+ }
+ if (value_left == 0 && value_right == 1) {
+ data_value = 1;
+ }
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_carCont.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.carcont_cm_led(%1, %2)'] },
+ },
+ robotis_carCont_cm_sound_detected_clear: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_carCont_cm_sound_detected_clear',
+ },
+ class: 'robotis_carCont_cm',
+ isNotFor: ['robotis_carCont'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+
+ var data_instruction = Entry.Robotis_carCont.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1];
+ data_value = 0;
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_carCont.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.carcont_cm_sound_clear()'] },
+ },
+ robotis_carCont_aux_motor_speed: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.General.left, 'LEFT'],
+ [Lang.General.right, 'RIGHT'],
+ ],
+ value: 'LEFT',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_clockwhise, 'CW'],
+ [Lang.Blocks.robotis_common_counter_clockwhise, 'CCW'],
+ ],
+ value: 'CW',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ null,
+ {
+ type: 'number',
+ params: ['500'],
+ },
+ null,
+ ],
+ type: 'robotis_carCont_aux_motor_speed',
+ },
+ paramsKeyMap: {
+ DIRECTION: 0,
+ DIRECTION_ANGLE: 1,
+ VALUE: 2,
+ },
+ class: 'robotis_carCont_cm',
+ isNotFor: ['robotis_carCont'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var direction = script.getField('DIRECTION', script);
+ var directionAngle = script.getField('DIRECTION_ANGLE', script);
+ var value = script.getNumberValue('VALUE');
+
+ var data_instruction = Entry.Robotis_carCont.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ if (direction == 'LEFT') {
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[0];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[1];
+ } else {
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[0];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[1];
+ }
+
+ if (directionAngle == 'CW') {
+ value = value + 1024;
+ if (value > 2047) {
+ value = 2047;
+ }
+ } else {
+ if (value > 1023) {
+ value = 1023;
+ }
+ }
+
+ data_value = value;
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_carCont.delay
+ );
+ },
+ syntax: {
+ js: [],
+ py: ['Robotis.carcont_aux_motor_speed(%1, %2, %3)'],
+ },
+ },
+ robotis_carCont_aux_motor_speed2: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ template:
+ '왼쪽 감속모터 속도를 %1, 출력값을 %2 (으)로 오른쪽 감속모터 속도를 %3, 출력값을 %4 (으)로 정하기 %5',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_clockwhise, 'CW'],
+ [Lang.Blocks.robotis_common_counter_clockwhise, 'CCW'],
+ ],
+ value: 'CW',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_clockwhise, 'CW'],
+ [Lang.Blocks.robotis_common_counter_clockwhise, 'CCW'],
+ ],
+ value: 'CW',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ {
+ type: 'number',
+ params: ['500'],
+ },
+ null,
+ {
+ type: 'number',
+ params: ['500'],
+ },
+ null,
+ ],
+ type: 'robotis_carCont_aux_motor_speed2',
+ },
+ paramsKeyMap: {
+ LEFT_ANGLE: 0,
+ LEFT_VALUE: 1,
+ RIGHT_ANGLE: 2,
+ RIGHT_VALUE: 3,
+ },
+ class: 'robotis_carCont_cm',
+ isNotFor: ['robotis_carCont'],
+ func: function(sprite, script) {
+ var data_instruction = Entry.Robotis_carCont.INSTRUCTION.WRITE,
+ address = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[0];
+
+ var leftAngle = script.getField('LEFT_ANGLE', script);
+ var leftValue = script.getNumberValue('LEFT_VALUE');
+ var rightAngle = script.getField('RIGHT_ANGLE', script);
+ var rightValue = script.getNumberValue('RIGHT_VALUE');
+
+ leftValue = Math.min(leftValue, 1023);
+ leftValue = Math.max(leftValue, 0);
+ rightValue = Math.min(rightValue, 1023);
+ rightValue = Math.max(rightValue, 0);
+
+ if (leftAngle === 'CW') {
+ leftValue += 1024;
+ }
+ if (rightAngle === 'CW') {
+ rightValue += 1024;
+ }
+
+ var value = leftValue + (rightValue << 16);
+ var data_sendqueue = [[data_instruction, address, 4, value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_carCont.delay
+ );
+ },
+ },
+ robotis_carCont_cm_calibration: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.General.left, 'LEFT'],
+ [Lang.General.right, 'RIGHT'],
+ ],
+ value: 'LEFT',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ {
+ type: 'number',
+ params: ['0'],
+ },
+ null,
+ ],
+ type: 'robotis_carCont_cm_calibration',
+ },
+ paramsKeyMap: {
+ DIRECTION: 0,
+ VALUE: 1,
+ },
+ class: 'robotis_carCont_cm',
+ isNotFor: ['robotis_carCont'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var direction = script.getField('DIRECTION', script);
+ var value = script.getNumberValue('VALUE');
+
+ var data_instruction = Entry.Robotis_carCont.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ if (direction == 'LEFT') {
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1];
+ } else {
+ data_address = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0];
+ data_length = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1];
+ }
+
+ data_value = value;
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_carCont.delay
+ );
+
+ // Entry.hw.sendQueue['ROBOTIS_DATA'] = [[data_instruction, data_address, data_length, data_value]];
+ // update();
+ // return script.callReturn();
+ },
+ syntax: { js: [], py: ['Robotis.carcont_cm_calibration(%1, %2)'] },
+ },
+ //endregion robotis 로보티즈
+ };
+};
+
+Entry.Robotis_openCM70.blockMenuBlocks = [
+ //robotis_openCM70
+ 'robotis_irs_value',
+ 'robotis_irs_value_boolean',
+ 'robotis_color_value',
+ 'robotis_color_value_boolean',
+ 'robotis_openCM70_sensor_value',
+ 'robotis_openCM70_aux_sensor_value',
+ 'robotis_openCM70_cm_buzzer_index',
+ 'robotis_openCM70_cm_buzzer_melody',
+ 'robotis_openCM70_cm_sound_detected_clear',
+ 'robotis_openCM70_cm_led',
+ //'robotis_openCM70_cm_motion',
+ 'robotis_openCM70_cm_autodrive_motor',
+ 'robotis_openCM70_cm_autodrive_ir',
+ 'robotis_openCM70_cm_autodrive_speed',
+ 'robotis_openCM70_aux_car_move',
+ 'robotis_openCM70_aux_motor_speed',
+ 'robotis_openCM70_aux_servo_mode',
+ 'robotis_openCM70_aux_servo_speed',
+ 'robotis_openCM70_aux_servo_position',
+ 'robotis_openCM70_aux_led_module',
+ 'robotis_openCM70_aux_custom',
+ 'robotis_openCM70_cm_poweroff_timer',
+ 'robotis_openCM70_cm_custom_value',
+ 'robotis_openCM70_cm_custom',
+];
+
+let opencm70_last_valid_value = [];
+
+Entry.Robotis_openCM70.getBlocks = function() {
+ return {
+ //region robotis 로보티즈 openCM70
+ robotis_openCM70_cm_custom_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_string_field',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['BYTE', 'BYTE'],
+ ['WORD', 'WORD'],
+ ['DWORD', 'DWORD'],
+ ],
+ value: 'BYTE',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'number',
+ params: ['0'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_cm_custom_value',
+ },
+ paramsKeyMap: {
+ VALUE: 0,
+ SIZE: 1,
+ },
+ class: 'robotis_openCM70_custom',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ var scope = script.executor.scope;
+
+ // instruction / address / length / value / default length
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.READ;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ var data_default_address = 0;
+ var data_default_length = 0;
+
+ var size = script.getStringField('SIZE');
+
+ if (size == 'BYTE') {
+ data_length = 1;
+ } else if (size == 'WORD') {
+ data_length = 2;
+ } else if (size == 'DWORD') {
+ data_length = 4;
+ }
+
+ data_address = script.getNumberValue('VALUE');
+
+ data_default_address = data_address;
+ data_default_length = data_length;
+
+ if (
+ Entry.hw.sendQueue.prevAddress &&
+ Entry.hw.sendQueue.prevAddress == data_default_address
+ ) {
+ if (
+ Entry.hw.sendQueue.prevTime &&
+ new Date() - Entry.hw.sendQueue.prevTime < 200
+ ) {
+ //throw new Entry.Utils.AsyncError();
+ return Entry.hw.sendQueue.prevResult;
+ }
+ }
+
+ Entry.Robotis_carCont.setRobotisData([
+ [data_instruction, data_address, data_length, data_value, data_default_length],
+ ]);
+ // Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
+ Entry.Robotis_carCont.update();
+
+ var result = Entry.hw.portData[data_default_address];
+ Entry.hw.sendQueue.prevAddress = data_default_address;
+ Entry.hw.sendQueue.prevTime = new Date();
+ Entry.hw.sendQueue.prevResult = result;
+
+ return result;
+ },
+ syntax: {
+ js: [],
+ py: ['Robotis.opencm70_cm_custom_value(%1, %2)'],
+ },
+ },
+ robotis_openCM70_sensor_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_string_field',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_cm_sound_detected, 'CM_SOUND_DETECTED'],
+ [Lang.Blocks.robotis_cm_sound_detecting, 'CM_SOUND_DETECTING'],
+ [Lang.Blocks.robotis_cm_user_button, 'CM_USER_BUTTON'],
+ ],
+ value: 'CM_SOUND_DETECTED',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_openCM70_sensor_value',
+ },
+ paramsKeyMap: {
+ SENSOR: 0,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ var scope = script.executor.scope;
+
+ scope.isStart = true;
+ scope.count = 0;
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.READ;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ var data_default_address = 0;
+ var data_default_length = 0;
+
+ var sensor = script.getStringField('SENSOR');
+
+ var increase = 0;
+ var sensor_name = '';
+
+ if (sensor == 'CM_SOUND_DETECTED') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0];
+ data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1];
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1];
+ sensor_name = 'DETECTEDSOUNDE';
+ } else if (sensor == 'CM_SOUND_DETECTING') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1];
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1];
+ sensor_name = 'DETECTINGSOUNDE1';
+ } else if (sensor == 'CM_USER_BUTTON') {
+ data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0];
+ data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1];
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1];
+ sensor_name = 'USERBUTTONSTATE';
+ }
+
+ data_default_address = data_default_address + increase * data_default_length;
+
+ if (
+ Entry.hw.sendQueue.prevAddress &&
+ Entry.hw.sendQueue.prevAddress == data_default_address
+ ) {
+ if (
+ Entry.hw.sendQueue.prevTime &&
+ new Date() - Entry.hw.sendQueue.prevTime < 200
+ ) {
+ //throw new Entry.Utils.AsyncError();
+ return Entry.hw.sendQueue.prevResult;
+ }
+ }
+
+ Entry.Robotis_carCont.setRobotisData([
+ [data_instruction, data_address, data_length, data_value, data_default_length],
+ ]);
+ // Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
+ Entry.Robotis_carCont.update();
+
+ var result = Entry.hw.portData[sensor_name];
+ Entry.hw.sendQueue.prevAddress = data_default_address;
+ Entry.hw.sendQueue.prevTime = new Date();
+ Entry.hw.sendQueue.prevResult = result;
+
+ return result;
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_sensor_value(%1)'] },
+ },
+ robotis_openCM70_aux_sensor_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_string_field',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_aux_servo_position, 'AUX_SERVO_POSITION'],
+ [Lang.Blocks.robotis_aux_ir, 'AUX_IR'],
+ [Lang.Blocks.robotis_aux_touch, 'AUX_TOUCH'],
+ [Lang.Blocks.robotis_aux_brightness, 'AUX_BRIGHTNESS'],
+ [Lang.Blocks.robotis_aux_hydro_themo_humidity, 'AUX_HYDRO_THEMO_HUMIDITY'],
+ [Lang.Blocks.robotis_aux_hydro_themo_temper, 'AUX_HYDRO_THEMO_TEMPER'],
+ [Lang.Blocks.robotis_aux_temperature, 'AUX_TEMPERATURE'],
+ [Lang.Blocks.robotis_aux_ultrasonic, 'AUX_ULTRASONIC'],
+ [Lang.Blocks.robotis_aux_magnetic, 'AUX_MAGNETIC'],
+ [Lang.Blocks.robotis_aux_motion_detection, 'AUX_MOTION_DETECTION'],
+ [Lang.Blocks.robotis_aux_color, 'AUX_COLOR'],
+ [Lang.Blocks.robotis_aux_custom, 'AUX_CUSTOM'],
+ ],
+ value: 'AUX_SERVO_POSITION',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null],
+ type: 'robotis_openCM70_aux_sensor_value',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ SENSOR: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ var scope = script.executor.scope;
+
+ // instruction / address / length / value / default length
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.READ;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ var data_default_address = 0;
+ var data_default_length = 0;
+
+ var port = script.getStringField('PORT');
+ var sensor = script.getStringField('SENSOR');
+
+ var aux_name = '';
+
+ var increase = 0;
+ if (port == '3') {
+ increase = 2;
+ } else if (port == '4') {
+ increase = 3;
+ } else if (port == '5') {
+ increase = 4;
+ } else if (port == '6') {
+ increase = 5;
+ }
+
+ if (sensor == 'AUX_SERVO_POSITION') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];
+ aux_name = 'LIGHT' + (increase-2);
+ } else if (sensor == 'AUX_IR') {
+ data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0];
+ data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1];
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1];
+ aux_name = 'IR' + (increase-2);
+ } else if (sensor == 'AUX_TOUCH') {
+ data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0];
+ data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1];
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1];
+ aux_name = 'TOUCH' + (increase-2);
+ } else if (sensor == 'AUX_TEMPERATURE') {
+ data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0];
+ data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1];
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1];
+ aux_name = 'TEMPERATURE' + (increase-2);
+ } else if (sensor == 'AUX_BRIGHTNESS') {
+ data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0];
+ data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1];
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1];
+ aux_name = 'LIGHT' + (increase-2);
+ } else if (sensor == 'AUX_HYDRO_THEMO_HUMIDITY') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1];
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1];
+ aux_name = 'HUMIDTY' + (increase-2);
+ } else if (sensor == 'AUX_HYDRO_THEMO_TEMPER') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1];
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1];
+ aux_name = 'HT_TEMPERATURE' + (increase-2);
+ } else if (sensor == 'AUX_ULTRASONIC') {
+ data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0];
+ data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1];
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1];
+ aux_name = 'ULTRASONIC' + (increase-2);
+ } else if (sensor == 'AUX_MAGNETIC') {
+ data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0];
+ data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1];
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1];
+ aux_name = 'MAGNETIC' + (increase-2);
+ } else if (sensor == 'AUX_MOTION_DETECTION') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1];
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1];
+ aux_name = 'MOTION' + (increase-2);
+ } else if (sensor == 'AUX_COLOR') {
+ data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0];
+ data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1];
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1];
+ aux_name = 'COLOR' + (increase-2);
+ } else if (sensor == 'AUX_CUSTOM') {
+ data_default_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];
+ data_default_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];
+ aux_name = 'LIGHT' + (increase-2);
+ }
+
+ data_default_address = data_default_address + increase * data_default_length;
+ data_address = data_default_address;
+ // if (increase != 0) {
+ // data_length = 6 * data_default_length;
+ // }
+
+ if (
+ Entry.hw.sendQueue.prevAddress &&
+ Entry.hw.sendQueue.prevAddress == data_default_address
+ ) {
+ if (
+ Entry.hw.sendQueue.prevTime &&
+ new Date() - Entry.hw.sendQueue.prevTime < 200
+ ) {
+ //throw new Entry.Utils.AsyncError();
+ return Entry.hw.sendQueue.prevResult;
+ }
+ }
+
+ Entry.Robotis_carCont.setRobotisData([
+ [data_instruction, data_address, data_length, data_value, data_default_length],
+ ]);
+ // Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
+ Entry.Robotis_carCont.update();
+
+ var result = Entry.hw.portData[aux_name];
+ if (result == undefined)
+ {
+ result = opencm70_last_valid_value[data_default_address];
+ }
+ else
+ {
+ if (sensor == 'AUX_SERVO_POSITION') {
+ if (result < 0) result = 0;
+ else if (result > 1023) result = 1023;
+
+ result = (512 - result) * 300 / 1023;
+
+ result = Math.floor(result * 9 / 8);
+
+ if (result > 150) result = 150;
+ else if (result < -150) result = -150;
+ }
+ opencm70_last_valid_value[data_default_address] = result;
+ }
+ Entry.hw.sendQueue.prevAddress = data_default_address;
+ Entry.hw.sendQueue.prevTime = new Date();
+ Entry.hw.sendQueue.prevResult = result;
+
+ return result;
+ },
+ syntax: {
+ js: [],
+ py: ['Robotis.opencm70_aux_sensor_value(%1, %2)'],
+ },
+ },
+ robotis_openCM70_cm_buzzer_index: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.General.note_a + '(0)', '0'],
+ [Lang.General.note_a + '#(1)', '1'],
+ [Lang.General.note_b + '(2)', '2'],
+ [Lang.General.note_c + '(3)', '3'],
+ [Lang.General.note_c + '#(4)', '4'],
+ [Lang.General.note_d + '(5)', '5'],
+ [Lang.General.note_d + '#(6)', '6'],
+ [Lang.General.note_e + '(7)', '7'],
+ [Lang.General.note_f + '(8)', '8'],
+ [Lang.General.note_f + '#(9)', '9'],
+ [Lang.General.note_g + '(10)', '10'],
+ [Lang.General.note_g + '#(11)', '11'],
+ [Lang.General.note_a + '(12)', '12'],
+ [Lang.General.note_a + '#(13)', '13'],
+ [Lang.General.note_b + '(14)', '14'],
+ [Lang.General.note_c + '(15)', '15'],
+ [Lang.General.note_c + '#(16)', '16'],
+ [Lang.General.note_d + '(17)', '17'],
+ [Lang.General.note_d + '#(18)', '18'],
+ [Lang.General.note_e + '(19)', '19'],
+ [Lang.General.note_f + '(20)', '20'],
+ [Lang.General.note_f + '#(21)', '21'],
+ [Lang.General.note_g + '(22)', '22'],
+ [Lang.General.note_g + '#(23)', '23'],
+ [Lang.General.note_a + '(24)', '24'],
+ [Lang.General.note_a + '#(25)', '25'],
+ [Lang.General.note_b + '(26)', '26'],
+ [Lang.General.note_c + '(27)', '27'],
+ [Lang.General.note_c + '#(28)', '28'],
+ [Lang.General.note_d + '(29)', '29'],
+ [Lang.General.note_d + '#(30)', '30'],
+ [Lang.General.note_e + '(31)', '31'],
+ [Lang.General.note_f + '(32)', '32'],
+ [Lang.General.note_f + '#(33)', '33'],
+ [Lang.General.note_g + '(34)', '34'],
+ [Lang.General.note_g + '#(35)', '35'],
+ [Lang.General.note_a + '(36)', '36'],
+ [Lang.General.note_a + '#(37)', '37'],
+ [Lang.General.note_b + '(38)', '38'],
+ [Lang.General.note_c + '(39)', '39'],
+ [Lang.General.note_c + '#(40)', '40'],
+ [Lang.General.note_d + '(41)', '41'],
+ [Lang.General.note_d + '#(42)', '42'],
+ [Lang.General.note_e + '(43)', '43'],
+ [Lang.General.note_f + '(44)', '44'],
+ [Lang.General.note_f + '#(45)', '45'],
+ [Lang.General.note_g + '(46)', '46'],
+ [Lang.General.note_g + '#(47)', '47'],
+ [Lang.General.note_a + '(48)', '48'],
+ [Lang.General.note_a + '#(49)', '49'],
+ [Lang.General.note_b + '(50)', '50'],
+ [Lang.General.note_c + '(51)', '51'],
+ ],
+ value: '0',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ {
+ type: 'number',
+ params: ['1'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_cm_buzzer_index',
+ },
+ paramsKeyMap: {
+ CM_BUZZER_INDEX: 0,
+ CM_BUZZER_TIME: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var cmBuzzerIndex = script.getField('CM_BUZZER_INDEX', script);
+ var cmBuzzerTime = script.getNumberValue('CM_BUZZER_TIME', script);
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address_1 = 0;
+ var data_length_1 = 0;
+ var data_value_1 = 0;
+ var data_address_2 = 0;
+ var data_length_2 = 0;
+ var data_value_2 = 0;
+ var interval = 100;
+
+ data_address_1 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];
+ data_length_1 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];
+ // data_value_1 = cmBuzzerTime * 10;
+ // TODO 텍스트 입력으로 바꾸고 최대는 5초 : 0.5 초 하려면 5를 입력 - console.log(parseInt(0.59 * 10)); max 는 5초
+ data_value_1 = parseInt(cmBuzzerTime * 10);
+ if (data_value_1 > 50) {
+ data_value_1 = 50;
+ }
+
+ data_address_2 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0];
+ data_length_2 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1];
+ data_value_2 = cmBuzzerIndex;
+
+ var data_sendqueue = [
+ [data_instruction, data_address_1, data_length_1, data_value_1],
+ [data_instruction, data_address_2, data_length_2, data_value_2],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ cmBuzzerTime * 1000 + interval
+ );
+ },
+ syntax: {
+ js: [],
+ py: ['Robotis.opencm70_cm_buzzer_index(%1, %2)'],
+ },
+ },
+ robotis_openCM70_cm_buzzer_melody: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['0', '0'],
+ ['1', '1'],
+ ['2', '2'],
+ ['3', '3'],
+ ['4', '4'],
+ ['5', '5'],
+ ['6', '6'],
+ ['7', '7'],
+ ['8', '8'],
+ ['9', '9'],
+ ['10', '10'],
+ ['11', '11'],
+ ['12', '12'],
+ ['13', '13'],
+ ['14', '14'],
+ ['15', '15'],
+ ['16', '16'],
+ ['17', '17'],
+ ['18', '18'],
+ ['19', '19'],
+ ['20', '20'],
+ ['21', '21'],
+ ['22', '22'],
+ ['23', '23'],
+ ['24', '24'],
+ ],
+ value: '0',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null],
+ type: 'robotis_openCM70_cm_buzzer_melody',
+ },
+ paramsKeyMap: {
+ CM_BUZZER_MELODY: 0,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var cmBuzzerMelody = script.getField('CM_BUZZER_MELODY', script);
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address_1 = 0;
+ var data_length_1 = 0;
+ var data_value_1 = 0;
+ var data_address_2 = 0;
+ var data_length_2 = 0;
+ var data_value_2 = 0;
+ var interval = 100;
+
+ data_address_1 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];
+ data_length_1 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];
+ data_value_1 = 255;
+
+ data_address_2 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0];
+ data_length_2 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1];
+ data_value_2 = cmBuzzerMelody;
+
+ var data_sendqueue = [
+ [data_instruction, data_address_1, data_length_1, data_value_1],
+ [data_instruction, data_address_2, data_length_2, data_value_2],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ 1000 + interval
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_buzzer_melody(%1)'] },
+ },
+ robotis_openCM70_cm_sound_detected_clear: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_openCM70_cm_sound_detected_clear',
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1];
+ data_value = 0;
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_sound_clear()'] },
+ },
+ robotis_openCM70_cm_led: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_red_color, 'CM_LED_R'],
+ [Lang.Blocks.robotis_common_green_color, 'CM_LED_G'],
+ [Lang.Blocks.robotis_common_blue_color, 'CM_LED_B'],
+ ],
+ value: 'CM_LED_R',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_on, '1'],
+ [Lang.Blocks.robotis_common_off, '0'],
+ ],
+ value: '1',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null, null],
+ type: 'robotis_openCM70_cm_led',
+ },
+ paramsKeyMap: {
+ CM_LED: 0,
+ VALUE: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var cmLed = script.getField('CM_LED', script);
+ var value = script.getField('VALUE', script);
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ if (cmLed == 'CM_LED_R') {
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[1];
+ } else if (cmLed == 'CM_LED_G') {
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[1];
+ } else if (cmLed == 'CM_LED_B') {
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[1];
+ }
+
+ data_value = value;
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_led(%1, %2)'] },
+ },
+ /*
+ robotis_openCM70_cm_motion: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'number',
+ params: ['1'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_cm_motion',
+ },
+ paramsKeyMap: {
+ VALUE: 0,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[1];
+ data_value = script.getNumberValue('VALUE', script);
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_motion(%1)'] },
+ },
+ */
+ robotis_openCM70_cm_autodrive_motor: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_left, 'CM_LEFT'],
+ [Lang.Blocks.robotis_common_right, 'CM_RIGHT'],
+ ],
+ value: 'CM_LEFT',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 1', '1'],
+ ['PORT 2', '2'],
+ ],
+ value: '1',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null, null],
+ type: 'robotis_openCM70_cm_autodrive_motor',
+ },
+ paramsKeyMap: {
+ CM_MOTOR_POSITION: 0,
+ PORT_NUM: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var motor_position = script.getField('CM_MOTOR_POSITION', script);
+ var port_num = script.getField('PORT_NUM', script);
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ if (motor_position == 'CM_LEFT') {
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_AUTODRIVE_LEFT_MOTOR_PORT[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_AUTODRIVE_LEFT_MOTOR_PORT[1];
+ } else if (motor_position == 'CM_RIGHT') {
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_AUTODRIVE_RIGHT_MOTOR_PORT[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_AUTODRIVE_RIGHT_MOTOR_PORT[1];
+ }
+
+ data_value = port_num;
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_autodrive_motor_port(%1, %2)'] },
+ },
+ robotis_openCM70_cm_autodrive_ir: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_left, 'CM_LEFT'],
+ [Lang.Blocks.robotis_common_right, 'CM_RIGHT'],
+ ],
+ value: 'CM_LEFT',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null, null],
+ type: 'robotis_openCM70_cm_autodrive_ir',
+ },
+ paramsKeyMap: {
+ CM_IR_POSITION: 0,
+ PORT_NUM: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var ir_position = script.getField('CM_IR_POSITION', script);
+ var port_num = script.getField('PORT_NUM', script);
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ if (ir_position == 'CM_LEFT') {
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_AUTODRIVE_LEFT_IR_PORT[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_AUTODRIVE_LEFT_IR_PORT[1];
+ } else if (ir_position == 'CM_RIGHT') {
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_AUTODRIVE_RIGHT_IR_PORT[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_AUTODRIVE_RIGHT_IR_PORT[1];
+ }
+
+ data_value = port_num;
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_autodrive_ir_port(%1, %2)'] },
+ },
+ robotis_openCM70_cm_autodrive_speed: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['100%', '100'],
+ ['90%', '90'],
+ ['80%', '80'],
+ ['70%', '70'],
+ ['60%', '60'],
+ ['50%', '50'],
+ ['40%', '40'],
+ ['30%', '30'],
+ ['20%', '20'],
+ ['10%', '10'],
+ ['0%', '0'],
+ ],
+ value: '80',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_openCM70_cm_autodrive_speed',
+ },
+ paramsKeyMap: {
+ CM_AUTODRIVE_SPEED: 0,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var autodrive_speed = script.getField('CM_AUTODRIVE_SPEED', script);
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_AUTODRIVE[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_AUTODRIVE[1];
+ data_value = autodrive_speed;
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_autodrive_speed(%1)'] },
+ },
+ robotis_openCM70_aux_car_move: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_forward, 'F'],
+ [Lang.Blocks.robotis_common_backward, 'B'],
+ [Lang.Blocks.robotis_common_turn_left, 'L'],
+ [Lang.Blocks.robotis_common_turn_right, 'R'],
+ [Lang.Blocks.robotis_common_stop, 'S'],
+ ],
+ value: 'F',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'number',
+ params: ['50'],
+ },
+ null,
+ null,
+ ],
+ type: 'robotis_openCM70_aux_car_move',
+ },
+ paramsKeyMap: {
+ SPEED: 0,
+ MOVE_DIRECTION: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var speed = script.getNumberValue('SPEED');
+ var direction = script.getField('MOVE_DIRECTION', script);
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1] * 2;
+
+ if (speed < 0) speed = 0;
+ else if (speed > 100) speed = 100;
+
+ speed = Math.floor(speed * 1023 /100);
+
+ if (direction == 'F') {
+ data_value = speed + (speed + 1024) * 65536;
+ } else if (direction == 'B'){
+ data_value = (speed + 1024) + speed * 65536;
+ } else if (direction == 'L'){
+ data_value = (speed + 1024) + (speed + 1024) * 65536;
+ } else if (direction == 'R'){
+ data_value = speed + speed * 65536;
+ } else if (direction == 'S'){
+ data_value = 0;
+ }
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: {
+ js: [],
+ py: ['Robotis.opencm70_aux_car_move(%1, %2)'],
+ },
+ },
+ robotis_irs_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1 적외선 센서 값',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_irs_value',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'robotis_irs',
+ //'isNotFor': ['mini'],
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getStringField('PORT');
+ let value = 0;
+ let data_address = 0;
+ switch (port) {
+ case '3':
+ value = Entry.hw.portData.IR0;
+ data_address = 108;
+ break;
+ case '4':
+ value = Entry.hw.portData.IR1;
+ data_address = 109;
+ break;
+ case '5':
+ value = Entry.hw.portData.IR2;
+ data_address = 110;
+ break;
+ case '6':
+ value = Entry.hw.portData.IR3;
+ data_address = 111;
+ break;
+ }
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ const data_length = 1;
+ const data_value = 2;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ //Entry.Robotis_carCont.update();
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 && port == '3') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 = true;
+ }
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 && port == '4') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 = true;
+ }
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 && port == '5') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 = true;
+ }
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 && port == '6') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 = true;
+ }
+ //var value = (Entry.hw.portData['IN' + port] > 125) ? 1 : 0;
+ return value;
+ },
+ },
+ robotis_irs_value_boolean: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_boolean_field',
+ fontColor: '#fff',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1 적외선 센서 값 %2 %3',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['=', 'EQUAL'],
+ ['>', 'GREATER'],
+ ['<', 'LESS'],
+ ['≥', 'GREATER_OR_EQUAL'],
+ ['≤', 'LESS_OR_EQUAL'],
+ ],
+ value: 'GREATER',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ noaRrow: true,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ def: {
+ params: [
+ null,
+ null,
+ {
+ type: 'number',
+ params: ['100'],
+ },
+ ],
+ type: 'robotis_irs_value_boolean',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ OPERATOR: 1,
+ RIGHTVALUE: 2,
+ },
+ class: 'robotis_irs',
+ //'isNotFor': ['mini'],
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getStringField('PORT', script);
+ const operator = script.getField('OPERATOR', script);
+ const rightValue = script.getNumberValue('RIGHTVALUE', script);
+ let leftValue = 0;
+ let isCheck = false;
+ let data_address = 0;
+
+ switch (port) {
+ case '3':
+ leftValue = Entry.hw.portData.IR0;
+ data_address = 108;
+ break;
+ case '4':
+ leftValue = Entry.hw.portData.IR1;
+ data_address = 109;
+ break;
+ case '5':
+ leftValue = Entry.hw.portData.IR2;
+ data_address = 110;
+ break;
+ case '6':
+ leftValue = Entry.hw.portData.IR3;
+ data_address = 111;
+ break;
+ }
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ const data_length = 1;
+ const data_value = 2;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ //Entry.Robotis_carCont.update();
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 && port == '3') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 = true;
+ }
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 && port == '4') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 = true;
+ }
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 && port == '5') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 = true;
+ }
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 && port == '6') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 = true;
+ }
+
+ switch (operator) {
+ case 'EQUAL':
+ isCheck = leftValue == rightValue;
+ break;
+ case 'GREATER':
+ isCheck = Number(leftValue) > Number(rightValue);
+ break;
+ case 'LESS':
+ isCheck = Number(leftValue) < Number(rightValue);
+ break;
+ case 'GREATER_OR_EQUAL':
+ isCheck = Number(leftValue) >= Number(rightValue);
+ break;
+ case 'LESS_OR_EQUAL':
+ isCheck = Number(leftValue) <= Number(rightValue);
+ break;
+ }
+
+ return isCheck;
+ },
+ },
+ robotis_color_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_string_field',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1 컬러 센서 값',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_color_value',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'robotis_color',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getStringField('PORT');
+ let value = 0;
+ let data_address = 0;
+ switch (port) {
+ case '3':
+ value = Entry.hw.portData.COLOR0;
+ data_address = 108;
+ break;
+ case '4':
+ value = Entry.hw.portData.COLOR1;
+ data_address = 109;
+ break;
+ case '5':
+ value = Entry.hw.portData.COLOR2;
+ data_address = 110;
+ break;
+ case '6':
+ value = Entry.hw.portData.COLOR3;
+ data_address = 111;
+ break;
+ }
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ const data_length = 1;
+ const data_value = 4;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+
+ switch (value) {
+ case 0:
+ value = '알 수 없음';
+ break;
+ case 1:
+ value = '흰색';
+ break;
+ case 2:
+ value = '검은색';
+ break;
+ case 3:
+ value = '빨강색';
+ break;
+ case 4:
+ value = '초록색';
+ break;
+ case 5:
+ value = '파랑색';
+ break;
+ case 6:
+ value = '노랑색';
+ break;
+ }
+
+ return value;
+ },
+ },
+ robotis_color_value_boolean: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic_boolean_field',
+ fontColor: '#fff',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1 컬러 센서 값 %2 %3',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['=', 'EQUAL'],
+ ['!=', 'NOT_EQUAL'],
+ ],
+ value: 'EQUAL',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ noaRrow: true,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['알 수 없음 : 0', '0'],
+ ['흰색 : 1', '1'],
+ ['검은색 : 2', '2'],
+ ['빨강색 : 3', '3'],
+ ['초록색 : 4', '4'],
+ ['파랑색 : 5', '5'],
+ ['노랑색 : 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ ],
+ def: {
+ params: [null, null, null],
+ type: 'robotis_color_value_boolean',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ OPERATOR: 1,
+ RIGHTVALUE: 2,
+ },
+ class: 'robotis_color',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getField('PORT', script);
+ const operator = script.getField('OPERATOR', script);
+ const rightValue = script.getNumberField('RIGHTVALUE', script);
+ let leftValue = 0;
+ let data_address = 0;
+ let isCheck = false;
+
+ switch (port) {
+ case '3':
+ leftValue = Entry.hw.portData.COLOR0;
+ data_address = 108;
+ break;
+ case '4':
+ leftValue = Entry.hw.portData.COLOR1;
+ data_address = 109;
+ break;
+ case '5':
+ leftValue = Entry.hw.portData.COLOR2;
+ data_address = 110;
+ break;
+ case '6':
+ leftValue = Entry.hw.portData.COLOR3;
+ data_address = 111;
+ break;
+ }
+
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ const data_length = 1;
+ const data_value = 4;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+
+ switch (operator) {
+ case 'EQUAL':
+ isCheck = leftValue == rightValue;
+ break;
+ case 'NOT_EQUAL':
+ isCheck = Number(leftValue) != Number(rightValue);
+ break;
+ }
+
+ return isCheck;
+ },
+ },
+ robotis_openCM70_aux_motor_speed: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 1', '1'],
+ ['PORT 2', '2'],
+ ],
+ value: '1',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_clockwhise, 'CW'],
+ [Lang.Blocks.robotis_common_counter_clockwhise, 'CCW'],
+ ],
+ value: 'CW',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ null,
+ {
+ type: 'number',
+ params: ['50'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_aux_motor_speed',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ DIRECTION_ANGLE: 1,
+ VALUE: 2,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var port = script.getField('PORT', script);
+ var directionAngle = script.getField('DIRECTION_ANGLE', script);
+ var value = script.getNumberValue('VALUE');
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1];
+
+ data_address = data_address + (port - 1) * data_length;
+
+ if (value < 0) value = 0;
+ else if (value > 100) value = 100;
+
+ value = Math.floor(value * 1023 / 100);
+
+ if (directionAngle == 'CW') {
+ value = value + 1024;
+ if (value > 2047) {
+ value = 2047;
+ }
+ } else {
+ if (value > 1023) {
+ value = 1023;
+ }
+ }
+
+ data_value = value;
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: {
+ js: [],
+ py: ['Robotis.opencm70_aux_motor_speed(%1, %2, %3)'],
+ },
+ },
+ robotis_openCM70_aux_servo_mode: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_wheel_mode, '0'],
+ [Lang.Blocks.robotis_common_joint_mode, '1'],
+ ],
+ value: '0',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null, null],
+ type: 'robotis_openCM70_aux_servo_mode',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ MODE: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var port = script.getField('PORT', script);
+ var mode = script.getField('MODE', script);
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[1];
+
+ data_address = data_address + (port - 1) * data_length;
+ data_value = mode;
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_aux_servo_mode(%1, %2)'] },
+ },
+ robotis_openCM70_aux_servo_speed: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_clockwhise, 'CW'],
+ [Lang.Blocks.robotis_common_counter_clockwhise, 'CCW'],
+ ],
+ value: 'CW',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ null,
+ {
+ type: 'number',
+ params: ['50'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_aux_servo_speed',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ DIRECTION_ANGLE: 1,
+ VALUE: 2,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var port = script.getField('PORT', script);
+ var directionAngle = script.getField('DIRECTION_ANGLE', script);
+ var value = script.getNumberValue('VALUE');
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[1];
+
+ data_address = data_address + (port - 1) * data_length;
+
+ if (value < 0) value = 0;
+ else if (value > 100) value = 100;
+
+ value = Math.floor(value * 1023 / 100);
+
+ if (directionAngle == 'CW') {
+ value = value + 1024;
+ if (value > 2047) {
+ value = 2047;
+ }
+ } else {
+ if (value > 1023) {
+ value = 1023;
+ }
+ }
+
+ data_value = value;
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: {
+ js: [],
+ py: ['Robotis.opencm70_aux_servo_speed(%1, %2, %3)'],
+ },
+ },
+ robotis_openCM70_aux_servo_position: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ {
+ type: 'number',
+ params: ['0'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_aux_servo_position',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ VALUE: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var port = script.getField('PORT', script);
+ var value = script.getNumberValue('VALUE');
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];
+
+ data_address = data_address + (port - 1) * data_length;
+
+ if (value > 150) {
+ value = 150;
+ } else if (value < -150) {
+ value = -150;
+ }
+
+ value = value * 8 / 9;
+
+ data_value = 512 - Math.floor(value * 1023 / 300);
+
+ if (data_value < 0) data_value = 0;
+ else if (data_value > 1023) data_value = 1023;
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: {
+ js: [],
+ py: ['Robotis.opencm70_aux_servo_position(%1, %2)'],
+ },
+ },
+ robotis_openCM70_aux_led_module: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_cm_led_both + Lang.Blocks.robotis_common_off, '0'],
+ [Lang.Blocks.robotis_cm_led_right + Lang.Blocks.robotis_common_on, '1'],
+ [Lang.Blocks.robotis_cm_led_left + Lang.Blocks.robotis_common_on, '2'],
+ [Lang.Blocks.robotis_cm_led_both + Lang.Blocks.robotis_common_on, '3'],
+ ],
+ value: '0',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null, null],
+ type: 'robotis_openCM70_aux_led_module',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ LED_MODULE: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var port = script.getField('PORT', script);
+ var ledModule = script.getField('LED_MODULE', script);
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];
+
+ data_address = data_address + (port - 1) * data_length;
+ data_value = ledModule;
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_aux_led_module(%1, %2)'] },
+ },
+ robotis_openCM70_aux_custom: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ {
+ type: 'number',
+ params: ['0'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_aux_custom',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ VALUE: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var port = script.getField('PORT', script);
+ var value = script.getNumberValue('VALUE');
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];
+
+ data_address = data_address + (port - 1) * data_length;
+ data_value = value;
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_aux_custom(%1, %2)'] },
+ },
+ robotis_openCM70_cm_poweroff_timer: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_off, '0'],
+ ['1' + Lang.Blocks.robotis_common_minute, '1'],
+ ['2' + Lang.Blocks.robotis_common_minute, '2'],
+ ['3' + Lang.Blocks.robotis_common_minute, '3'],
+ ['4' + Lang.Blocks.robotis_common_minute, '4'],
+ ['5' + Lang.Blocks.robotis_common_minute, '5'],
+ ['6' + Lang.Blocks.robotis_common_minute, '6'],
+ ['7' + Lang.Blocks.robotis_common_minute, '7'],
+ ['8' + Lang.Blocks.robotis_common_minute, '8'],
+ ['9' + Lang.Blocks.robotis_common_minute, '9'],
+ ['10' + Lang.Blocks.robotis_common_minute, '10'],
+ ['11' + Lang.Blocks.robotis_common_minute, '11'],
+ ['12' + Lang.Blocks.robotis_common_minute, '12'],
+ ['13' + Lang.Blocks.robotis_common_minute, '13'],
+ ['14' + Lang.Blocks.robotis_common_minute, '14'],
+ ['15' + Lang.Blocks.robotis_common_minute, '15'],
+ ['16' + Lang.Blocks.robotis_common_minute, '16'],
+ ['17' + Lang.Blocks.robotis_common_minute, '17'],
+ ['18' + Lang.Blocks.robotis_common_minute, '18'],
+ ['19' + Lang.Blocks.robotis_common_minute, '19'],
+ ['20' + Lang.Blocks.robotis_common_minute, '20'],
+ ],
+ value: '0',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null],
+ type: 'robotis_openCM70_cm_poweroff_timer',
+ },
+ paramsKeyMap: {
+ CM_POWEROFF_TIMER: 0,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var cm_poweroff_timer = script.getField('CM_POWEROFF_TIMER', script);
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_POWEROFF_TIMER[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_POWEROFF_TIMER[1];
+ data_value = cm_poweroff_timer;
+
+ var data_sendqueue = [
+ [data_instruction, data_address, data_length, data_value],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_poweroff_timer(%1)'] },
+ },
+ robotis_openCM70_cm_custom: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'number',
+ params: ['0'],
+ },
+ {
+ type: 'number',
+ params: ['0'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_cm_custom',
+ },
+ paramsKeyMap: {
+ ADDRESS: 0,
+ VALUE: 1,
+ },
+ class: 'robotis_openCM70_custom',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ func: function(sprite, script) {
+ // instruction / address / length / value / default length
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address = script.getNumberValue('ADDRESS');
+ data_value = script.getNumberValue('VALUE');
+ if (data_value > 65535) {
+ data_length = 4;
+ } else if (data_value > 255) {
+ data_length = 2;
+ } else {
+ data_length = 1;
+ }
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_custom(%1, %2)'] },
+ },
+ //endregion robotis 로보티즈
+ };
+};
+
+Entry.Robotis_openCM70.practicalBlockMenuBlocks = {
+ hw_motor: [
+ 'robotis_aux_move_for',
+ 'robotis_aux_stop_for',
+ 'robotis_set_servo_joint',
+ 'robotis_set_servo_wheel',
+ 'robotis_move_for_secs',
+ ],
+ hw_melody: [
+ 'robotis_melody_note_for',
+ ],
+ hw_sensor: [
+ 'robotis_touch_value',
+ 'robotis_touch_value_boolean',
+ 'robotis_irs_value',
+ 'robotis_irs_value_boolean',
+ 'robotis_light_value',
+ 'robotis_light_value_boolean',
+ 'robotis_detectedsound_value',
+ 'robotis_detectingsound_value',
+ 'robotis_detectedsound_value_boolean',
+ 'robotis_detectingsound_value_boolean',
+ 'robotis_detectedsound_value_init',
+ 'robotis_color_value',
+ 'robotis_color_value_boolean',
+ 'robotis_humidity_value',
+ 'robotis_humidity_value_boolean',
+ 'robotis_temperature_value',
+ 'robotis_temperature_value_boolean',
+ 'robotis_userbutton_value',
+ 'robotis_userbutton_value_boolean',
+ ],
+ hw_led: [
+ 'robotis_set_led',
+ ],
+}
+
+Entry.Robotis_openCM70.getPracticalBlocks = function() {
+ return{
+ robotis_set_led: {
+ color: '#2AB4D3',
+ outerLine: '#0e93b1',
+ skeleton: 'basic',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1번 포트 LED를 %2 %3',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: '#0e93b1',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['모두 끄기', '0'],
+ ['노랑색 켜기', '1'],
+ ['파랑색 켜기', '2'],
+ ['모두 켜기', '3'],
+ ],
+ value: '0',
+ fontSize: 11,
+ bgColor: '#0e93b1',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/practical_course/light.png',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_set_led',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ COLOR: 1,
+ },
+ class: 'robotis_led',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+
+ const port = script.getStringField('PORT');
+ const value = 0;
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ let data_address = 0;
+ const data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];
+ const data_value = script.getNumberField('COLOR');
+ switch (port) {
+ case '3':
+ data_address = 212;
+ break;
+ case '4':
+ data_address = 213;
+ break;
+ case '5':
+ data_address = 214;
+ break;
+ case '6':
+ data_address = 215;
+ break;
+ }
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ //Entry.Robotis_carCont.update();
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ },
+ robotis_touch_value: {
+ color: '#2AB4D3',
+ outerLine: '#0e93b1',
+ skeleton: 'basic_string_field',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1번 포트 접촉 센서 값',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: '#0e93b1',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_touch_value',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'robotis_touch',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getStringField('PORT');
+ let value = 0;
+
+ switch (port) {
+ case '3':
+ value = Entry.hw.portData.TOUCH0;
+ break;
+ case '4':
+ value = Entry.hw.portData.TOUCH1;
+ break;
+ case '5':
+ value = Entry.hw.portData.TOUCH2;
+ break;
+ case '6':
+ value = Entry.hw.portData.TOUCH3;
+ break;
+ }
+ return value;
+ },
+ },
+ robotis_touch_value_boolean: {
+ color: '#2AB4D3',
+ outerLine: '#0e93b1',
+ skeleton: 'basic_boolean_field',
+ fontColor: '#fff',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1번 포트 접촉 센서가 %2',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: '#0e93b1',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['접촉 되면', '1'],
+ ['접촉 안되면', '0'],
+ ],
+ value: '1',
+ fontSize: 11,
+ bgColor: '#0e93b1',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ ],
+ def: {
+ params: [null, null, null],
+ type: 'robotis_touch_value_boolean',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ TOUCH: 1,
+ },
+ class: 'robotis_touch',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getStringField('PORT');
+ const touch = script.getNumberField('TOUCH', script);
+ let value = 0;
+ switch (port) {
+ case '3':
+ value = Entry.hw.portData.TOUCH0;
+ break;
+ case '4':
+ value = Entry.hw.portData.TOUCH1;
+ break;
+ case '5':
+ value = Entry.hw.portData.TOUCH2;
+ break;
+ case '6':
+ value = Entry.hw.portData.TOUCH3;
+ break;
+ }
+ const isTouch = !((value == 1) ^ touch);
+
+ return isTouch;
+ },
+ },
+ robotis_irs_value: {
+ color: '#C4065C',
+ outerLine: '#9a0045',
+ skeleton: 'basic_string_field',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1번 포트 적외선 센서 값',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: '#9a0045',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_irs_value',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'robotis_irs',
+ //'isNotFor': ['mini'],
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getStringField('PORT');
+ let value = 0;
+ let data_address = 0;
+ switch (port) {
+ case '3':
+ value = Entry.hw.portData.IR0;
+ data_address = 108;
+ break;
+ case '4':
+ value = Entry.hw.portData.IR1;
+ data_address = 109;
+ break;
+ case '5':
+ value = Entry.hw.portData.IR2;
+ data_address = 110;
+ break;
+ case '6':
+ value = Entry.hw.portData.IR3;
+ data_address = 111;
+ break;
+ }
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ const data_length = 1;
+ const data_value = 2;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ //Entry.Robotis_carCont.update();
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 && port == '3') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 = true;
+ }
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 && port == '4') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 = true;
+ }
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 && port == '5') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 = true;
+ }
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 && port == '6') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 = true;
+ }
+ //var value = (Entry.hw.portData['IN' + port] > 125) ? 1 : 0;
+ return value;
+ },
+ },
+ robotis_irs_value_boolean: {
+ color: '#C4065C',
+ outerLine: '#9a0045',
+ skeleton: 'basic_boolean_field',
+ fontColor: '#fff',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1번 포트 적외선 센서 값 %2 %3',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: '#9a0045',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['=', 'EQUAL'],
+ ['>', 'GREATER'],
+ ['<', 'LESS'],
+ ['≥', 'GREATER_OR_EQUAL'],
+ ['≤', 'LESS_OR_EQUAL'],
+ ],
+ value: 'LESS',
+ fontSize: 11,
+ bgColor: '#9a0045',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ noaRrow: true,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ def: {
+ params: [
+ null,
+ null,
+ {
+ type: 'number',
+ params: ['100'],
+ },
+ ],
+ type: 'robotis_irs_value_boolean',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ OPERATOR: 1,
+ RIGHTVALUE: 2,
+ },
+ class: 'robotis_irs',
+ //'isNotFor': ['mini'],
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getStringField('PORT', script);
+ const operator = script.getField('OPERATOR', script);
+ const rightValue = script.getNumberValue('RIGHTVALUE', script);
+ let leftValue = 0;
+ let isCheck = false;
+ let data_address = 0;
+
+ switch (port) {
+ case '3':
+ leftValue = Entry.hw.portData.IR0;
+ data_address = 108;
+ break;
+ case '4':
+ leftValue = Entry.hw.portData.IR1;
+ data_address = 109;
+ break;
+ case '5':
+ leftValue = Entry.hw.portData.IR2;
+ data_address = 110;
+ break;
+ case '6':
+ leftValue = Entry.hw.portData.IR3;
+ data_address = 111;
+ break;
+ }
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ const data_length = 1;
+ const data_value = 2;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ //Entry.Robotis_carCont.update();
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 && port == '3') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT3 = true;
+ }
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 && port == '4') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT4 = true;
+ }
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 && port == '5') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT5 = true;
+ }
+ if (!Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 && port == '6') {
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ Entry.Robotis_openCM70.IRS_MODULEWRITE.PORT6 = true;
+ }
+
+ switch (operator) {
+ case 'EQUAL':
+ isCheck = leftValue == rightValue;
+ break;
+ case 'GREATER':
+ isCheck = Number(leftValue) > Number(rightValue);
+ break;
+ case 'LESS':
+ isCheck = Number(leftValue) < Number(rightValue);
+ break;
+ case 'GREATER_OR_EQUAL':
+ isCheck = Number(leftValue) >= Number(rightValue);
+ break;
+ case 'LESS_OR_EQUAL':
+ isCheck = Number(leftValue) <= Number(rightValue);
+ break;
+ }
+
+ return isCheck;
+ },
+ },
+ robotis_light_value: {
+ color: '#ff8d0f',
+ outerLine: '#e37100',
+ skeleton: 'basic_string_field',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1번 포트 빛 감지 센서 값',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '0'],
+ ['PORT 4', '1'],
+ ['PORT 5', '2'],
+ ['PORT 6', '3'],
+ ],
+ value: '0',
+ outerLine: '#e37100',
+ fontSize: 11,
+ bgColor: '#e37100',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_light_value',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'robotis_light',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getStringField('PORT');
+ return Entry.hw.portData[`LIGHT${port}`];
+ },
+ },
+ robotis_light_value_boolean: {
+ color: '#ff8d0f',
+ outerLine: '#e37100',
+ skeleton: 'basic_boolean_field',
+ fontColor: '#fff',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1번 포트 빛 감지 센서 값 %2 %3',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '0'],
+ ['PORT 4', '1'],
+ ['PORT 5', '2'],
+ ['PORT 6', '3'],
+ ],
+ value: '0',
+ fontSize: 11,
+ bgColor: '#e37100',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['=', 'EQUAL'],
+ ['>', 'GREATER'],
+ ['<', 'LESS'],
+ ['≥', 'GREATER_OR_EQUAL'],
+ ['≤', 'LESS_OR_EQUAL'],
+ ],
+ value: 'LESS',
+ fontSize: 11,
+ bgColor: '#e37100',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ noaRrow: true,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ def: {
+ params: [
+ null,
+ null,
+ {
+ type: 'number',
+ params: ['100'],
+ },
+ ],
+ type: 'robotis_light_value_boolean',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ OPERATOR: 1,
+ RIGHTVALUE: 2,
+ },
+ class: 'robotis_light',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getNumberField('PORT', script);
+ const operator = script.getField('OPERATOR', script);
+ const rightValue = script.getNumberValue('RIGHTVALUE', script);
+ const leftValue = Entry.hw.portData[`LIGHT${port}`];
+ let isCheck = false;
+
+ switch (operator) {
+ case 'EQUAL':
+ isCheck = leftValue == rightValue;
+ break;
+ case 'GREATER':
+ isCheck = Number(leftValue) > Number(rightValue);
+ break;
+ case 'LESS':
+ isCheck = Number(leftValue) < Number(rightValue);
+ break;
+ case 'GREATER_OR_EQUAL':
+ isCheck = Number(leftValue) >= Number(rightValue);
+ break;
+ case 'LESS_OR_EQUAL':
+ isCheck = Number(leftValue) <= Number(rightValue);
+ break;
+ }
+
+ return isCheck;
+ },
+ },
+ robotis_userbutton_value: {
+ color: '#2AB4D3',
+ outerLine: '#0e93b1',
+ skeleton: 'basic_string_field',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '사용자 버튼',
+ events: {},
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ def: {
+ params: [null],
+ type: 'robotis_userbutton_value',
+ },
+ paramsKeyMap: {},
+ class: 'robotis_userbutton',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ return Entry.hw.portData.USERBUTTONSTATE;
+ },
+ },
+ robotis_userbutton_value_boolean: {
+ color: '#2AB4D3',
+ skeleton: 'basic_boolean_field',
+ fontColor: '#fff',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '사용자 버튼이 %1',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['접촉 되면', '1'],
+ ['접촉 안되면', '0'],
+ ],
+ value: '1',
+ fontsIze: 11,
+ },
+ ],
+ def: {
+ params: [null],
+ type: 'robotis_userbutton_value_boolean',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'robotis_userbutton',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getStringField('PORT');
+ const value = Entry.hw.portData.USERBUTTONSTATE;
+ var isTouch = false;
+
+ var isTouch = port == value;
+
+ return isTouch;
+ },
+ },
+ robotis_detectedsound_value: {
+ color: '#01d67f',
+ outerLine: '#00b36a',
+ skeleton: 'basic_string_field',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '소리 센서 최종 소리 횟수',
+ events: {},
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ def: {
+ params: [null],
+ type: 'robotis_detectedsound_value',
+ },
+ paramsKeyMap: {},
+ class: 'robotis_sound',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ return Entry.hw.portData.DETECTEDSOUNDE;
+ },
+ },
+ robotis_detectedsound_value_boolean: {
+ color: '#01d67f',
+ outerLine: '#00b36a',
+ skeleton: 'basic_boolean_field',
+ fontColor: '#fff',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '소리 센서 최종 소리 횟수 %1 %2',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['=', 'EQUAL'],
+ ['>', 'GREATER'],
+ ['<', 'LESS'],
+ ['≥', 'GREATER_OR_EQUAL'],
+ ['≤', 'LESS_OR_EQUAL'],
+ ],
+ value: 'LESS',
+ fontSize: 11,
+ bgColor: '#00b36a',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ noaRrow: true,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ def: {
+ params: [
+ null,
+ {
+ type: 'number',
+ params: ['100'],
+ },
+ ],
+ type: 'robotis_detectedsound_value_boolean',
+ },
+ paramsKeyMap: {
+ OPERATOR: 0,
+ RIGHTVALUE: 1,
+ },
+ class: 'robotis_sound',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const operator = script.getField('OPERATOR', script);
+ const rightValue = script.getNumberValue('RIGHTVALUE', script);
+ const leftValue = Entry.hw.portData.DETECTEDSOUNDE;
+ let isCheck = false;
+
+ switch (operator) {
+ case 'EQUAL':
+ isCheck = leftValue == rightValue;
+ break;
+ case 'GREATER':
+ isCheck = Number(leftValue) > Number(rightValue);
+ break;
+ case 'LESS':
+ isCheck = Number(leftValue) < Number(rightValue);
+ break;
+ case 'GREATER_OR_EQUAL':
+ isCheck = Number(leftValue) >= Number(rightValue);
+ break;
+ case 'LESS_OR_EQUAL':
+ isCheck = Number(leftValue) <= Number(rightValue);
+ break;
+ }
+
+ return isCheck;
+ },
+ },
+ robotis_detectedsound_value_init: {
+ color: '#00D67F',
+ outerLine: '#00b36a',
+ skeleton: 'basic',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '소리 센서 최종 소리 횟수 초기화 %1',
+ params: [
+ {
+ type: 'Indicator',
+ img: 'block_icon/practical_course/sound.png',
+ size: 12,
+ },
+ ],
+ def: {
+ params: [null],
+ type: 'robotis_detectedsound_value_init',
+ },
+ paramsKeyMap: {},
+ class: 'robotis_sound',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ const data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0];
+ const data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1];
+ const data_value = 0;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ //Entry.Robotis_carCont.update();
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ },
+ robotis_detectingsound_value: {
+ color: '#01d67f',
+ outerLine: '#00b36a',
+ skeleton: 'basic_string_field',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '소리 센서 실시간 소리 횟수',
+ events: {},
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ def: {
+ params: [null],
+ type: 'robotis_detectingsound_value',
+ },
+ paramsKeyMap: {},
+ class: 'robotis_sound',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ return Entry.hw.portData.DETECTINGSOUNDE1;
+ },
+ },
+ robotis_detectedsound_value_boolean: {
+ color: '#01d67f',
+ outerLine: '#00b36a',
+ skeleton: 'basic_boolean_field',
+ fontColor: '#fff',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '소리 센서 최종 소리 횟수 %1 %2',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['=', 'EQUAL'],
+ ['>', 'GREATER'],
+ ['<', 'LESS'],
+ ['≥', 'GREATER_OR_EQUAL'],
+ ['≤', 'LESS_OR_EQUAL'],
+ ],
+ value: 'LESS',
+ fontSize: 11,
+ bgColor: '#00b36a',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ noaRrow: true,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ def: {
+ params: [
+ null,
+ {
+ type: 'number',
+ params: ['100'],
+ },
+ ],
+ type: 'robotis_detectedsound_value_boolean',
+ },
+ paramsKeyMap: {
+ OPERATOR: 0,
+ RIGHTVALUE: 1,
+ },
+ class: 'robotis_sound',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const operator = script.getField('OPERATOR', script);
+ const rightValue = script.getNumberValue('RIGHTVALUE', script);
+ const leftValue = Entry.hw.portData.DETECTEDSOUNDE;
+ let isCheck = false;
+
+ switch (operator) {
+ case 'EQUAL':
+ isCheck = leftValue == rightValue;
+ break;
+ case 'GREATER':
+ isCheck = Number(leftValue) > Number(rightValue);
+ break;
+ case 'LESS':
+ isCheck = Number(leftValue) < Number(rightValue);
+ break;
+ case 'GREATER_OR_EQUAL':
+ isCheck = Number(leftValue) >= Number(rightValue);
+ break;
+ case 'LESS_OR_EQUAL':
+ isCheck = Number(leftValue) <= Number(rightValue);
+ break;
+ }
+
+ return isCheck;
+ },
+ },
+ robotis_detectedsound_value_init: {
+ color: '#00D67F',
+ outerLine: '#00b36a',
+ skeleton: 'basic',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '소리 센서 최종 소리 횟수 초기화 %1',
+ params: [
+ {
+ type: 'Indicator',
+ img: 'block_icon/practical_course/sound.png',
+ size: 12,
+ },
+ ],
+ def: {
+ params: [null],
+ type: 'robotis_detectedsound_value_init',
+ },
+ paramsKeyMap: {},
+ class: 'robotis_sound',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ const data_address = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0];
+ const data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1];
+ const data_value = 0;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ //Entry.Robotis_carCont.update();
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ },
+ robotis_detectingsound_value: {
+ color: '#01d67f',
+ outerLine: '#00b36a',
+ skeleton: 'basic_string_field',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '소리 센서 실시간 소리 횟수',
+ events: {},
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ def: {
+ params: [null],
+ type: 'robotis_detectingsound_value',
+ },
+ paramsKeyMap: {},
+ class: 'robotis_sound',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ return Entry.hw.portData.DETECTINGSOUNDE1;
+ },
+ },
+ robotis_detectingsound_value_boolean: {
+ color: '#01d67f',
+ outerLine: '#00b36a',
+ skeleton: 'basic_boolean_field',
+ fontColor: '#fff',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '소리 센서 실시간 소리 횟수 %1 %2',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['=', 'EQUAL'],
+ ['>', 'GREATER'],
+ ['<', 'LESS'],
+ ['≥', 'GREATER_OR_EQUAL'],
+ ['≤', 'LESS_OR_EQUAL'],
+ ],
+ value: 'LESS',
+ fontSize: 11,
+ bgColor: '#00b36a',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ noaRrow: true,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ def: {
+ params: [
+ null,
+ {
+ type: 'number',
+ params: ['100'],
+ },
+ ],
+ type: 'robotis_detectingsound_value_boolean',
+ },
+ paramsKeyMap: {
+ OPERATOR: 0,
+ RIGHTVALUE: 1,
+ },
+ class: 'robotis_sound',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const operator = script.getField('OPERATOR', script);
+ const rightValue = script.getNumberValue('RIGHTVALUE', script);
+ const leftValue = Entry.hw.portData.DETECTINGSOUNDE1;
+ let isCheck = false;
+
+ switch (operator) {
+ case 'EQUAL':
+ isCheck = leftValue == rightValue;
+ break;
+ case 'GREATER':
+ isCheck = Number(leftValue) > Number(rightValue);
+ break;
+ case 'LESS':
+ isCheck = Number(leftValue) < Number(rightValue);
+ break;
+ case 'GREATER_OR_EQUAL':
+ isCheck = Number(leftValue) >= Number(rightValue);
+ break;
+ case 'LESS_OR_EQUAL':
+ isCheck = Number(leftValue) <= Number(rightValue);
+ break;
+ }
+
+ return isCheck;
+ },
+ },
+ robotis_color_value: {
+ color: '#2AB4D3',
+ outerLine: '#0e93b1',
+ skeleton: 'basic_string_field',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1번 포트 컬러 센서 값',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: '#0e93b1',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_color_value',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'robotis_color',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getStringField('PORT');
+ let value = 0;
+ let data_address = 0;
+ switch (port) {
+ case '3':
+ value = Entry.hw.portData.COLOR0;
+ data_address = 108;
+ break;
+ case '4':
+ value = Entry.hw.portData.COLOR1;
+ data_address = 109;
+ break;
+ case '5':
+ value = Entry.hw.portData.COLOR2;
+ data_address = 110;
+ break;
+ case '6':
+ value = Entry.hw.portData.COLOR3;
+ data_address = 111;
+ break;
+ }
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ const data_length = 1;
+ const data_value = 4;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+
+ switch (value) {
+ case 0:
+ value = '알 수 없음';
+ break;
+ case 1:
+ value = '흰색';
+ break;
+ case 2:
+ value = '검은색';
+ break;
+ case 3:
+ value = '빨강색';
+ break;
+ case 4:
+ value = '초록색';
+ break;
+ case 5:
+ value = '파랑색';
+ break;
+ case 6:
+ value = '노랑색';
+ break;
+ }
+
+ return value;
+ },
+ },
+ robotis_color_value_boolean: {
+ color: '#C4065C',
+ outerLine: '#9a0045',
+ skeleton: 'basic_boolean_field',
+ fontColor: '#fff',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1번 포트 컬러 센서 값 %2 %3',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: '#9a0045',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['=', 'EQUAL'],
+ ['>', 'GREATER'],
+ ['<', 'LESS'],
+ ['≥', 'GREATER_OR_EQUAL'],
+ ['≤', 'LESS_OR_EQUAL'],
+ ],
+ value: 'LESS',
+ fontSize: 11,
+ bgColor: '#9a0045',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ noaRrow: true,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['알 수 없음 : 0', '0'],
+ ['흰색 : 1', '1'],
+ ['검은색 : 2', '2'],
+ ['빨강색 : 3', '3'],
+ ['초록색 : 4', '4'],
+ ['파랑색 : 5', '5'],
+ ['노랑색 : 6', '6'],
+ ],
+ value: '0',
+ fontSize: 11,
+ bgColor: '#9a0045',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ ],
+ def: {
+ params: [null, null, null],
+ type: 'robotis_color_value_boolean',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ OPERATOR: 1,
+ RIGHTVALUE: 2,
+ },
+ class: 'robotis_color',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getField('PORT', script);
+ const operator = script.getField('OPERATOR', script);
+ const rightValue = script.getNumberField('RIGHTVALUE', script);
+ let leftValue = 0;
+ let data_address = 0;
+ let isCheck = false;
+
+ switch (port) {
+ case '3':
+ leftValue = Entry.hw.portData.COLOR0;
+ data_address = 108;
+ break;
+ case '4':
+ leftValue = Entry.hw.portData.COLOR1;
+ data_address = 109;
+ break;
+ case '5':
+ leftValue = Entry.hw.portData.COLOR2;
+ data_address = 110;
+ break;
+ case '6':
+ leftValue = Entry.hw.portData.COLOR3;
+ data_address = 111;
+ break;
+ }
+
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ const data_length = 1;
+ const data_value = 4;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+
+ switch (operator) {
+ case 'EQUAL':
+ isCheck = leftValue == rightValue;
+ break;
+ case 'GREATER':
+ isCheck = Number(leftValue) > Number(rightValue);
+ break;
+ case 'LESS':
+ isCheck = Number(leftValue) < Number(rightValue);
+ break;
+ case 'GREATER_OR_EQUAL':
+ isCheck = Number(leftValue) >= Number(rightValue);
+ break;
+ case 'LESS_OR_EQUAL':
+ isCheck = Number(leftValue) <= Number(rightValue);
+ break;
+ }
+
+ return isCheck;
+ },
+ },
+ robotis_humidity_value: {
+ color: '#2AB4D3',
+ outerLine: '#0e93b1',
+ skeleton: 'basic_string_field',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1번 포트 습도 센서 값',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: '#0e93b1',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_humidity_value',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'robotis_humidity',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getStringField('PORT');
+ let value = 0;
+ let data_address = 0;
+ switch (port) {
+ case '3':
+ value = Entry.hw.portData.HUMIDTY0;
+ data_address = 108;
+ break;
+ case '4':
+ value = Entry.hw.portData.HUMIDTY1;
+ data_address = 109;
+ break;
+ case '5':
+ value = Entry.hw.portData.HUMIDTY2;
+ data_address = 110;
+ break;
+ case '6':
+ value = Entry.hw.portData.HUMIDTY3;
+ data_address = 111;
+ break;
+ }
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ const data_length = 1;
+ const data_value = 5;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+
+ return value;
+ },
+ },
+ robotis_humidity_value_boolean: {
+ color: '#C4065C',
+ outerLine: '#9a0045',
+ skeleton: 'basic_boolean_field',
+ fontColor: '#fff',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1번 포트 습도 센서 값 %2 %3',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: '#9a0045',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['=', 'EQUAL'],
+ ['>', 'GREATER'],
+ ['<', 'LESS'],
+ ['≥', 'GREATER_OR_EQUAL'],
+ ['≤', 'LESS_OR_EQUAL'],
+ ],
+ value: 'LESS',
+ fontSize: 11,
+ bgColor: '#9a0045',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ noaRrow: true,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ def: {
+ params: [
+ null,
+ null,
+ {
+ type: 'number',
+ params: ['50'],
+ },
+ ],
+ type: 'robotis_humidity_value_boolean',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ OPERATOR: 1,
+ RIGHTVALUE: 2,
+ },
+ class: 'robotis_humidity',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getNumberField('PORT', script);
+ const operator = script.getField('OPERATOR', script);
+ const rightValue = script.getNumberValue('RIGHTVALUE', script);
+ let leftValue = 0;
+ let data_address = 0;
+ let isCheck = true;
+
+ switch (port) {
+ case 3:
+ leftValue = Entry.hw.portData.HUMIDTY0;
+ data_address = 108;
+ break;
+ case 4:
+ leftValue = Entry.hw.portData.HUMIDTY1;
+ data_address = 109;
+ break;
+ case 5:
+ leftValue = Entry.hw.portData.HUMIDTY2;
+ data_address = 110;
+ break;
+ case 6:
+ leftValue = Entry.hw.portData.HUMIDTY3;
+ data_address = 111;
+ break;
+ }
+
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ const data_length = 1;
+ const data_value = 5;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ switch (operator) {
+ case 'EQUAL':
+ isCheck = leftValue == rightValue;
+ break;
+ case 'GREATER':
+ isCheck = Number(leftValue) > Number(rightValue);
+ break;
+ case 'LESS':
+ isCheck = Number(leftValue) < Number(rightValue);
+ break;
+ case 'GREATER_OR_EQUAL':
+ isCheck = Number(leftValue) >= Number(rightValue);
+ break;
+ case 'LESS_OR_EQUAL':
+ isCheck = Number(leftValue) <= Number(rightValue);
+ break;
+ }
+ return isCheck;
+ },
+ },
+ robotis_temperature_value: {
+ color: '#2AB4D3',
+ outerLine: '#0e93b1',
+ skeleton: 'basic_string_field',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1번 포트 온도 센서 값',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: '#0e93b1',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_temperature_value',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ },
+ class: 'robotis_temperature',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getStringField('PORT');
+ let value = 0;
+ let data_address = 0;
+ switch (port) {
+ case '3':
+ value = Entry.hw.portData.TEMPERATURE0;
+ data_address = 108;
+ break;
+ case '4':
+ value = Entry.hw.portData.TEMPERATURE1;
+ data_address = 109;
+ break;
+ case '5':
+ value = Entry.hw.portData.TEMPERATURE2;
+ data_address = 110;
+ break;
+ case '6':
+ value = Entry.hw.portData.TEMPERATURE3;
+ data_address = 111;
+ break;
+ }
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ const data_length = 1;
+ const data_value = 5;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+
+ return value;
+ },
+ },
+ robotis_temperature_value_boolean: {
+ color: '#C4065C',
+ outerLine: '#9a0045',
+ skeleton: 'basic_boolean_field',
+ fontColor: '#fff',
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1번 포트 온도 센서 값 %2 %3',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: '#9a0045',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['=', 'EQUAL'],
+ ['>', 'GREATER'],
+ ['<', 'LESS'],
+ ['≥', 'GREATER_OR_EQUAL'],
+ ['≤', 'LESS_OR_EQUAL'],
+ ],
+ value: 'LESS',
+ fontSize: 11,
+ bgColor: '#9a0045',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ noaRrow: true,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ ],
+ def: {
+ params: [
+ null,
+ null,
+ {
+ type: 'number',
+ params: ['50'],
+ },
+ ],
+ type: 'robotis_temperature_value_boolean',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ OPERATOR: 1,
+ RIGHTVALUE: 2,
+ },
+ class: 'robotis_temperature',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const port = script.getNumberField('PORT', script);
+ const operator = script.getField('OPERATOR', script);
+ const rightValue = script.getNumberValue('RIGHTVALUE', script);
+ let leftValue = 0;
+ let data_address = 0;
+ let isCheck = true;
+
+ switch (port) {
+ case 3:
+ leftValue = Entry.hw.portData.TEMPERATURE0;
+ data_address = 108;
+ break;
+ case 4:
+ leftValue = Entry.hw.portData.TEMPERATURE1;
+ data_address = 109;
+ break;
+ case 5:
+ leftValue = Entry.hw.portData.TEMPERATURE2;
+ data_address = 110;
+ break;
+ case 6:
+ leftValue = Entry.hw.portData.TEMPERATURE3;
+ data_address = 111;
+ break;
+ }
+
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ const data_length = 1;
+ const data_value = 5;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ switch (operator) {
+ case 'EQUAL':
+ isCheck = leftValue == rightValue;
+ break;
+ case 'GREATER':
+ isCheck = Number(leftValue) > Number(rightValue);
+ break;
+ case 'LESS':
+ isCheck = Number(leftValue) < Number(rightValue);
+ break;
+ case 'GREATER_OR_EQUAL':
+ isCheck = Number(leftValue) >= Number(rightValue);
+ break;
+ case 'LESS_OR_EQUAL':
+ isCheck = Number(leftValue) <= Number(rightValue);
+ break;
+ }
+ return isCheck;
+ },
+ },
+ robotis_move_for_secs: {
+ color: '#00B200',
+ outerLine: '#019101',
+ skeleton: 'basic',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1모터를 %2 %3의 속도로 %4초 동안 회전 %5',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['왼쪽', '1'],
+ ['오른쪽', '2'],
+ ['양쪽', '3'],
+ ],
+ value: '1',
+ fontSize: 11,
+ bgColor: '#019101',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['앞으로', 'CW'],
+ ['뒤로', 'CCW'],
+ ],
+ value: 'CW',
+ fontSize: 11,
+ bgColor: '#019101',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/practical_course/dcmotor.png',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ null,
+ {
+ type: 'practical_course_motor_speed',
+ },
+ {
+ type: 'number',
+ params: ['2'],
+ },
+ null,
+ ],
+ type: 'robotis_move_for_secs',
+ },
+ paramsKeyMap: {
+ WHEEL: 0,
+ DIRECTION: 1,
+ SPEED: 2,
+ DURATION: 3,
+ },
+ class: 'robotis_motor',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const duration = script.getNumberValue('DURATION');
+ const wheel = script.getNumberField('WHEEL');
+ let value = script.getNumberValue('SPEED');
+ const direction = script.getStringField('DIRECTION');
+
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ let data_address = 0;
+ let data_length = 0;
+ let data_value = 0;
+
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0];
+
+ if (wheel == '3') {
+ data_length = 4;
+ data_address = 136;
+ } else {
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1];
+ data_address = data_address + (wheel - 1) * data_length;
+ }
+
+ if (!script.isStart) {
+ value = value * 68;
+ if (wheel == '3' || wheel == '1') {
+ if (direction == 'CCW') {
+ value = value + 1024;
+ if (value > 2047) {
+ value = 2047;
+ }
+ } else {
+ if (value > 1023) {
+ value = 1023;
+ }
+ }
+ } else {
+ if (direction == 'CW') {
+ value = value + 1024;
+ if (value > 2047) {
+ value = 2047;
+ }
+ } else {
+ if (value > 1023) {
+ value = 1023;
+ }
+ }
+ }
+
+ if ( value < 1024) {
+ value = value + (value + 1024) * 0x10000;
+ }
+ else {
+ value = value + (value - 1024) * 0x10000;
+ }
+
+ data_value = value;
+
+ var data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+
+ script.wheelMode = wheel;
+
+ script.isStart = true;
+ script.timeFlag = 1;
+ setTimeout(() => {
+ script.timeFlag = 0;
+ }, duration * 1000);
+
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ //return Entry.Robotis_carCont.postCallReturn(script, data_sendqueue, 2000);
+ return script;
+ } else if (script.timeFlag == 1) {
+ //data_sendqueue = [[data_instruction, data_address, data_length, 0]];
+ //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ return script;
+ } else {
+ delete script.timeFlag;
+ delete script.isStart;
+ delete script.wheelMode;
+ Entry.engine.isContinue = false;
+
+ data_sendqueue = [[data_instruction, data_address, data_length, 0]];
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.engine.isContinue = false;
+ Entry.Robotis_carCont.update();
+ return script.callReturn();
+ }
+ //return Entry.Robotis_carCont.postCallReturn(script, data_sendqueue, 2000);
+ },
+ },
+ robotis_aux_move_for: {
+ color: '#00B200',
+ outerLine: '#019101',
+ skeleton: 'basic',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1모터를 %2 %3의 속도로 계속 회전 %4',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['왼쪽', '1'],
+ ['오른쪽', '2'],
+ ['양쪽', '3'],
+ ],
+ value: '1',
+ fontSize: 11,
+ bgColor: '#019101',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['앞으로', 'CW'],
+ ['뒤로', 'CCW'],
+ ],
+ value: 'CW',
+ fontSize: 11,
+ bgColor: '#019101',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/practical_course/dcmotor.png',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ null,
+ {
+ type: 'practical_course_motor_speed',
+ },
+ null,
+ ],
+ type: 'robotis_aux_move_for',
+ },
+ paramsKeyMap: {
+ WHEEL: 0,
+ DIRECTION: 1,
+ SPEED: 2,
+ },
+ class: 'robotis_motor',
+ //'isNotFor': ['mini'],
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const wheel = script.getNumberField('WHEEL');
+ let value = script.getNumberValue('SPEED');
+ const direction = script.getStringField('DIRECTION');
+
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ let data_address = 0;
+ let data_length = 0;
+ let data_value = 0;
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0];
+
+ if (wheel == '3') {
+ data_length = 4;
+ data_address = 136;
+ } else {
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1];
+ data_address = data_address + (wheel - 1) * data_length;
+ }
+ value = value * 68;
+
+ if (wheel == '3' || wheel == '1') {
+ if (direction == 'CCW') {
+ value = value + 1024;
+ if (value > 2047) {
+ value = 2047;
+ }
+ } else {
+ if (value > 1023) {
+ value = 1023;
+ }
+ }
+ } else {
+ if (direction == 'CW') {
+ value = value + 1024;
+ if (value > 2047) {
+ value = 2047;
+ }
+ } else {
+ if (value > 1023) {
+ value = 1023;
+ }
+ }
+ }
+
+ if ( value < 1024) {
+ value = value + (value + 1024) * 0x10000;
+ }
+ else {
+ value = value + (value - 1024) * 0x10000;
+ }
+
+ data_value = value;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ },
+ robotis_aux_stop_for: {
+ color: '#00B200',
+ outerLine: '#019101',
+ skeleton: 'basic',
+ fontColor: '#fff',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1모터를 정지 %2',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['왼쪽', '1'],
+ ['오른쪽', '2'],
+ ['양쪽', '3'],
+ ],
+ value: '1',
+ fontSize: 11,
+ bgColor: '#019101',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/practical_course/dcmotor.png',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null],
+ type: 'robotis_aux_stop_for',
+ },
+ paramsKeyMap: {
+ WHEEL: 0,
+ },
+ class: 'robotis_motor',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const wheel = script.getNumberField('WHEEL');
+ const value = 0;
+
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ let data_address = 0;
+ let data_length = 0;
+ let data_value = 0;
+
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0];
+ if (wheel == '3') {
+ data_length = 4;
+ data_address = 136;
+ } else {
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1];
+ data_address = data_address + (wheel - 1) * data_length;
+ }
+
+ data_value = value;
+
+ const data_sendqueue = [[data_instruction, data_address, data_length, data_value]];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ },
+ robotis_set_servo_wheel: {
+ color: '#D128BD',
+ outerLine: '#a2049e',
+ skeleton: 'basic',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1 포트의 서보모터를 %2 %3속도로 회전 %4',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: '#A2049E',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['시계방향', 'CW'],
+ ['반시계방향', 'CCW'],
+ ],
+ value: 'CW',
+ fontSize: 11,
+ bgColor: '#A2049E',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['1', 1],
+ ['2', 2],
+ ['3', 3],
+ ['4', 4],
+ ['5', 5],
+ ['6', 6],
+ ['7', 7],
+ ['8', 8],
+ ['9', 9],
+ ['10', 10],
+ ['11', 11],
+ ['12', 12],
+ ['13', 13],
+ ['14', 14],
+ ['15', 15],
+ ],
+ value: 7,
+ fontSize: 11,
+ bgColor: '#A2049E',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/practical_course/servo.png',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null, null, null],
+ type: 'robotis_set_servo_wheel',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ DIRECTION: 1,
+ SPEED: 2,
+ },
+ class: 'robotis_servo_motor',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ // instruction / address / length / value / default length
+ const port = script.getField('PORT', script);
+ const direction = script.getStringField('DIRECTION');
+ const speed = script.getNumberField('SPEED');
+ const value = 0;
+
+ let data_address3 = 0;
+ let data_length3 = 0;
+ let data_value3 = 0;
+
+ let data_address2 = 0;
+ const data_length2 = 1;
+ const data_value2 = 7;
+
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ let data_address = 0;
+ let data_length = 0;
+ let data_value = 0;
+
+ let data_address4 = 0; // servo speed
+ let data_length4 = 2;
+ let data_value4 = 0;
+
+ data_value4 = speed * 68;
+ if (data_value4 > 1023) {
+ data_value4 = 1023;
+ }
+ switch (port) {
+ case '3':
+ data_address2 = 108;
+ Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT3 = true;
+ break;
+ case '4':
+ data_address2 = 109;
+ Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT4 = true;
+ break;
+ case '5':
+ data_address2 = 110;
+ Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT5 = true;
+ break;
+ case '6':
+ data_address2 = 111;
+ Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT6 = true;
+ break;
+ }
+
+ data_address3 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];
+ data_length3 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];
+
+ data_address3 = data_address3 + (port - 1) * data_length3;
+
+ data_address4 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[0];
+ data_length4 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[1];
+
+ data_address4 = data_address4 + (port - 1) * data_length4;
+
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[1];
+
+ data_address = data_address + (port - 1) * data_length;
+ data_value = 0;
+
+ if (direction == 'CW') {
+ data_value4 = data_value4 + 1024;
+ if (data_value4 > 2047) {
+ data_value4 = 2047;
+ }
+ } else {
+ if (data_value4 > 1023) {
+ data_value4 = 1023;
+ }
+ }
+
+ data_value3 = direction;
+
+ //var data_sendqueue = [[data_instruction, data_address2, data_length2, data_value2], [data_instruction, data_address, data_length, data_value], [data_instruction, data_address4, data_length4, data_value4]];
+ //return Entry.Robotis_carCont.postCallReturn(script, data_sendqueue, Entry.Robotis_openCM70.delay);
+ //
+ if (!script.isStart) {
+ if (
+ (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT3 && port == '3') ||
+ (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT4 && port == '4') ||
+ (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT5 && port == '5') ||
+ (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT6 && port == '6')
+ ) {
+ var data_sendqueue = [
+ [data_instruction, data_address2, data_length2, data_value2],
+ ];
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ script.isStart = true;
+ script.timeFlag = 1;
+ setTimeout(() => {
+ script.timeFlag = 0;
+ }, 1 * 650);
+ } else {
+ script.isStart = true;
+ script.timeFlag = 0;
+ }
+
+ /*
+ var data_sendqueue = [[data_instruction, data_address2, data_length2, data_value2]];
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.Robotis_carCont.update();
+ script.isStart = true;
+ script.timeFlag = 1;
+ setTimeout(function () {
+ script.timeFlag = 0;
+ }, 1 * 650);
+ */
+
+ return script;
+ } else if (script.timeFlag == 1) {
+ //data_sendqueue = [[data_instruction, data_address, data_length, 0]];
+ //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ return script;
+ } else {
+ delete script.timeFlag;
+ delete script.isStart;
+ delete script.wheelMode;
+ Entry.engine.isContinue = false;
+
+ data_sendqueue = [
+ [data_instruction, data_address, data_length, data_value],
+ [data_instruction, data_address4, data_length4, data_value4],
+ ];
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.engine.isContinue = false;
+ Entry.Robotis_carCont.update();
+ return script.callReturn();
+ }
+ //
+ },
+ },
+ robotis_set_servo_joint: {
+ color: '#D128BD',
+ outerLine: '#a2049e',
+ skeleton: 'basic',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '%1 포트의 서보모터를 %2 도 %3속도로 이동 %4',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['PORT 3', '3'],
+ ['PORT 4', '4'],
+ ['PORT 5', '5'],
+ ['PORT 6', '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: '#A2049E',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['1', 1],
+ ['2', 2],
+ ['3', 3],
+ ['4', 4],
+ ['5', 5],
+ ['6', 6],
+ ['7', 7],
+ ['8', 8],
+ ['9', 9],
+ ['10', 10],
+ ['11', 11],
+ ['12', 12],
+ ['13', 13],
+ ['14', 14],
+ ['15', 15],
+ ],
+ value: 7,
+ fontSize: 11,
+ bgColor: '#A2049E',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/practical_course/servo.png',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ {
+ type: 'number',
+ params: ['512'],
+ },
+ null,
+ null,
+ ],
+ type: 'robotis_set_servo_joint',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ VALUE: 1,
+ SPEED: 2,
+ },
+ class: 'robotis_servo_motor',
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ // instruction / address / length / value / default length
+ const port = script.getField('PORT', script);
+ let value = script.getNumberValue('VALUE');
+ const speed = script.getNumberField('SPEED');
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ let data_address3 = 0;
+ let data_length3 = 0;
+ let data_value3 = 0;
+
+ let data_address2 = 0;
+ const data_length2 = 1;
+ const data_value2 = 7;
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ let data_address = 0;
+ let data_length = 0;
+ let data_value = 0;
+
+ let data_address4 = 0; // servo speed
+ let data_length4 = 2;
+ let data_value4 = 0;
+
+ data_value4 = speed * 68;
+ if (data_value4 > 1023) {
+ data_value4 = 1023;
+ }
+ switch (port) {
+ case '3':
+ data_address2 = 108;
+ break;
+ case '4':
+ data_address2 = 109;
+ break;
+ case '5':
+ data_address2 = 110;
+ break;
+ case '6':
+ data_address2 = 111;
+ break;
+ }
+
+ data_address3 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];
+ data_length3 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];
+
+ data_address3 = data_address3 + (port - 1) * data_length3;
+
+ data_address4 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[0];
+ data_length4 = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[1];
+
+ data_address4 = data_address4 + (port - 1) * data_length4;
+
+ data_address = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[1];
+
+ data_address = data_address + (port - 1) * data_length;
+ data_value = 1;
+
+ if (value > 1023) {
+ value = 1023;
+ } else if (value < 0) {
+ value = 0;
+ }
+
+ data_value3 = value;
+
+ if (!script.isStart) {
+ var data_sendqueue = [[data_instruction, data_address2, data_length2, data_value2]];
+ //Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ //Entry.Robotis_carCont.update();
+ if (
+ (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT3 && port == '3') ||
+ (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT4 && port == '4') ||
+ (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT5 && port == '5') ||
+ (!Entry.Robotis_openCM70.SERVO_MODULEWRITE.PORT6 && port == '6')
+ ) {
+ script.isStart = true;
+ script.timeFlag = 1;
+ setTimeout(() => {
+ script.timeFlag = 0;
+ }, 1 * 650);
+ } else {
+ script.isStart = true;
+ script.timeFlag = 0;
+ }
+
+ return script;
+ } else if (script.timeFlag == 1) {
+ return script;
+ } else {
+ delete script.timeFlag;
+ delete script.isStart;
+ delete script.wheelMode;
+ Entry.engine.isContinue = false;
+
+ setTimeout(() => {
+ script.timeFlag = 0;
+ }, 1 * 70);
+
+ data_sendqueue = [
+ [data_instruction, data_address, data_length, data_value],
+ [data_instruction, data_address4, data_length4, data_value4],
+ [data_instruction, data_address3, data_length3, data_value3],
+ ];
+ Entry.Robotis_carCont.setRobotisData(data_sendqueue);
+ Entry.engine.isContinue = false;
+ Entry.Robotis_carCont.update();
+ return script.callReturn();
+ }
+ //
+ },
+ },
+ robotis_melody_note_for: {
+ color: '#FC327F',
+ skeleton: 'basic',
+ statements: [],
+ isNotFor: ['robotis_openCM70', 'robotis_openCM70EDU'],
+ template: '멜로디 %1 을(를) %2 옥타브로 %3 만큼 소리내기 %4',
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ //['무음', '12'],
+ ['도', '0'],
+ ['도#(레♭)', '1'],
+ ['레', '2'],
+ ['레#(미♭)', '3'],
+ ['미', '4'],
+ ['파', '5'],
+ ['파#(솔♭)', '6'],
+ ['솔', '7'],
+ ['솔#(라♭)', '8'],
+ ['라', '9'],
+ ['라#(시♭)', '10'],
+ ['시', '11'],
+ ],
+ value: '0',
+ fontSize: 11,
+ bgColor: '#ce105e',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['1', '0'],
+ ['2', '1'],
+ ['3', '2'],
+ ['4', '3'],
+ ['5', '4'],
+ ['6', '5'],
+ ],
+ value: '2',
+ fontSize: 11,
+ bgColor: '#ce105e',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['온음표', '4'],
+ ['2분음표', '2'],
+ ['4분음표', '1'],
+ ['8분음표', '0.5'],
+ ['16분음표', '0.25'],
+ /*['4분음표', '4'],
+ ['8분음표', '8'],
+ ['16분음표', '16'],*/
+ ],
+ value: '4',
+ fontSize: 11,
+ bgColor: '#ce105e',
+ arrowColor: EntryStatic.colorSet.common.WHITE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/practical_course/melody.png',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null, null, null],
+ type: 'robotis_melody_note_for',
+ },
+ paramsKeyMap: {
+ NOTE: 0,
+ OCTAVE: 1,
+ DURATION: 2,
+ },
+ class: 'robotis_melody',
+ //'isNotFor': ['mini'],
+ func(sprite, script) {
+ Entry.hw.sendQueue.IS_EDU = true;
+ const note = script.getNumberField('NOTE', script);
+ const octave = script.getNumberField('OCTAVE', script);
+ const cmBuzzerTime = script.getNumberField('DURATION', script);
+
+ let cmBuzzerIndex = note + octave * 12;
+ if (cmBuzzerIndex > 51) {
+ cmBuzzerIndex = 51;
+ }
+ if (cmBuzzerIndex < 0) {
+ cmBuzzerIndex = 0;
+ }
+
+ const data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ let data_address_1 = 0;
+ let data_length_1 = 0;
+ let data_value_1 = 0;
+ let data_address_2 = 0;
+ let data_length_2 = 0;
+ let data_value_2 = 0;
+
+ data_address_1 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];
+ data_length_1 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];
+
+ // TODO 텍스트 입력으로 바꾸고 최대는 5초 : 0.5 초 하려면 5를 입력 - console.log(parseInt(0.59 * 10)); max 는 5초
+
+ data_value_1 = parseInt(cmBuzzerTime * 10);
+ if (data_value_1 > 50) {
+ data_value_1 = 50;
+ }
+ //data_value_1
+ data_address_2 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0];
+ data_length_2 = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1];
+ data_value_2 = cmBuzzerIndex;
+
+ const data_sendqueue = [
+ [data_instruction, data_address_1, data_length_1, data_value_1],
+ [data_instruction, data_address_2, data_length_2, data_value_2],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ cmBuzzerTime * 1000
+ );
+ },
+ },
+ }
+}
+/*Entry.Robotis_openCM70EDU.blockMenuBlocks = [
+ //Robotis_openCM70EDU
+ 'robotis_openCM70_sensor_value',
+ 'robotis_openCM70_aux_sensor_value',
+ 'robotis_openCM70_cm_buzzer_index',
+ 'robotis_openCM70_cm_buzzer_melody',
+ 'robotis_openCM70_cm_sound_detected_clear',
+ 'robotis_openCM70_cm_led',
+ 'robotis_openCM70_cm_motion',
+ 'robotis_openCM70_aux_motor_speed',
+ 'robotis_openCM70_aux_servo_mode',
+ 'robotis_openCM70_aux_servo_speed',
+ 'robotis_openCM70_aux_servo_position',
+ 'robotis_openCM70_aux_led_module',
+ 'robotis_openCM70_aux_custom',
+ 'robotis_openCM70_cm_custom_value',
+ 'robotis_openCM70_cm_custom',
+];
+Entry.Robotis_openCM70EDU.getBlocks = function () {
+ return {
+ //region robotis 로보티즈 openCM70
+ robotis_openCM70_cm_custom_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_string_field',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ ['BYTE', 'BYTE'],
+ ['WORD', 'WORD'],
+ ['DWORD', 'DWORD'],
+ ],
+ value: 'BYTE',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'number',
+ params: ['0'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_cm_custom_value',
+ },
+ paramsKeyMap: {
+ VALUE: 0,
+ SIZE: 1,
+ },
+ class: 'robotis_openCM70_custom',
+ isNotFor: ['Robotis_openCM70EDU'],
+ func: function (sprite, script) {
+ var scope = script.executor.scope;
+
+ // instruction / address / length / value / default length
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.READ;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ var data_default_address = 0;
+ var data_default_length = 0;
+
+ var size = script.getStringField('SIZE');
+
+ if (size == 'BYTE') {
+ data_length = 1;
+ } else if (size == 'WORD') {
+ data_length = 2;
+ } else if (size == 'DWORD') {
+ data_length = 4;
+ }
+
+ data_address = script.getNumberValue('VALUE');
+
+ data_default_address = data_address;
+ data_default_length = data_length;
+
+ if (
+ Entry.hw.sendQueue.prevAddress &&
+ Entry.hw.sendQueue.prevAddress == data_default_address
+ ) {
+ if (
+ Entry.hw.sendQueue.prevTime &&
+ new Date() - Entry.hw.sendQueue.prevTime < 200
+ ) {
+ //throw new Entry.Utils.AsyncError();
+ return Entry.hw.sendQueue.prevResult;
+ }
+ }
+
+ Entry.Robotis_carCont.setRobotisData([
+ [
+ data_instruction,
+ data_address,
+ data_length,
+ data_value,
+ data_default_length,
+ ],
+ ]);
+ // Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
+ Entry.Robotis_carCont.update();
+
+ var result = Entry.hw.portData[data_default_address];
+ Entry.hw.sendQueue.prevAddress = data_default_address;
+ Entry.hw.sendQueue.prevTime = new Date();
+ Entry.hw.sendQueue.prevResult = result;
+
+ return result;
+ },
+ syntax: {
+ js: [],
+ py: ['Robotis.opencm70_cm_custom_value(%1, %2)'],
+ },
+ },
+ robotis_openCM70_sensor_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_string_field',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [
+ Lang.Blocks.robotis_cm_sound_detected,
+ 'CM_SOUND_DETECTED',
+ ],
+ [
+ Lang.Blocks.robotis_cm_sound_detecting,
+ 'CM_SOUND_DETECTING',
+ ],
+ [Lang.Blocks.robotis_cm_user_button, 'CM_USER_BUTTON'],
+ ],
+ value: 'CM_SOUND_DETECTED',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_openCM70_sensor_value',
+ },
+ paramsKeyMap: {
+ SENSOR: 0,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['Robotis_openCM70EDU'],
+ func: function (sprite, script) {
+ var scope = script.executor.scope;
+
+ scope.isStart = true;
+ scope.count = 0;
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.READ;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ var data_default_address = 0;
+ var data_default_length = 0;
+
+ var sensor = script.getStringField('SENSOR');
+
+ var increase = 0;
+
+ if (sensor == 'CM_SOUND_DETECTED') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .CM_SOUND_DETECTED[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .CM_SOUND_DETECTED[1];
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .CM_SOUND_DETECTED[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .CM_SOUND_DETECTED[1];
+ } else if (sensor == 'CM_SOUND_DETECTING') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .CM_SOUND_DETECTING[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .CM_SOUND_DETECTING[1];
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .CM_SOUND_DETECTING[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .CM_SOUND_DETECTING[1];
+ } else if (sensor == 'CM_USER_BUTTON') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1];
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1];
+ }
+
+ data_default_address =
+ data_default_address + increase * data_default_length;
+
+ if (
+ Entry.hw.sendQueue.prevAddress &&
+ Entry.hw.sendQueue.prevAddress == data_default_address
+ ) {
+ if (
+ Entry.hw.sendQueue.prevTime &&
+ new Date() - Entry.hw.sendQueue.prevTime < 200
+ ) {
+ //throw new Entry.Utils.AsyncError();
+ return Entry.hw.sendQueue.prevResult;
+ }
+ }
+
+ Entry.Robotis_carCont.setRobotisData([
+ [
+ data_instruction,
+ data_address,
+ data_length,
+ data_value,
+ data_default_length,
+ ],
+ ]);
+ // Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
+ Entry.Robotis_carCont.update();
+
+ var result = Entry.hw.portData[data_default_address];
+ Entry.hw.sendQueue.prevAddress = data_default_address;
+ Entry.hw.sendQueue.prevTime = new Date();
+ Entry.hw.sendQueue.prevResult = result;
+
+ return result;
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_sensor_value(%1)'] },
+ },
+ robotis_openCM70_aux_sensor_value: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ fontColor: '#fff',
+ skeleton: 'basic_string_field',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['3', 'PORT_3'],
+ ['4', 'PORT_4'],
+ ['5', 'PORT_5'],
+ ['6', 'PORT_6'],
+ ],
+ value: 'PORT_3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [
+ Lang.Blocks.robotis_aux_servo_position,
+ 'AUX_SERVO_POSITION',
+ ],
+ [Lang.Blocks.robotis_aux_ir, 'AUX_IR'],
+ [Lang.Blocks.robotis_aux_touch, 'AUX_TOUCH'],
+ [Lang.Blocks.robotis_aux_brightness, 'AUX_BRIGHTNESS'],
+ [
+ Lang.Blocks.robotis_aux_hydro_themo_humidity,
+ 'AUX_HYDRO_THEMO_HUMIDITY',
+ ],
+ [
+ Lang.Blocks.robotis_aux_hydro_themo_temper,
+ 'AUX_HYDRO_THEMO_TEMPER',
+ ],
+ [
+ Lang.Blocks.robotis_aux_temperature,
+ 'AUX_TEMPERATURE',
+ ],
+ [Lang.Blocks.robotis_aux_ultrasonic, 'AUX_ULTRASONIC'],
+ [Lang.Blocks.robotis_aux_magnetic, 'AUX_MAGNETIC'],
+ [
+ Lang.Blocks.robotis_aux_motion_detection,
+ 'AUX_MOTION_DETECTION',
+ ],
+ [Lang.Blocks.robotis_aux_color, 'AUX_COLOR'],
+ [Lang.Blocks.robotis_aux_custom, 'AUX_CUSTOM'],
+ ],
+ value: 'AUX_SERVO_POSITION',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null],
+ type: 'robotis_openCM70_aux_sensor_value',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ SENSOR: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['Robotis_openCM70EDU'],
+ func: function (sprite, script) {
+ var scope = script.executor.scope;
+
+ // instruction / address / length / value / default length
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.READ;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ var data_default_address = 0;
+ var data_default_length = 0;
+
+ var port = script.getStringField('PORT');
+ var sensor = script.getStringField('SENSOR');
+
+ var increase = 0;
+ if (port == 'PORT_3') {
+ increase = 2;
+ } else if (port == 'PORT_4') {
+ increase = 3;
+ } else if (port == 'PORT_5') {
+ increase = 4;
+ } else if (port == 'PORT_6') {
+ increase = 5;
+ }
+
+ if (sensor == 'AUX_SERVO_POSITION') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_SERVO_POSITION[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_SERVO_POSITION[1];
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_SERVO_POSITION[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_SERVO_POSITION[1];
+ } else if (sensor == 'AUX_IR') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1];
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1];
+ } else if (sensor == 'AUX_TOUCH') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1];
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1];
+ } else if (sensor == 'AUX_TEMPERATURE') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1];
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1];
+ } else if (sensor == 'AUX_BRIGHTNESS') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1];
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1];
+ } else if (sensor == 'AUX_HYDRO_THEMO_HUMIDITY') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_HYDRO_THEMO_HUMIDITY[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_HYDRO_THEMO_HUMIDITY[1];
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_HYDRO_THEMO_HUMIDITY[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_HYDRO_THEMO_HUMIDITY[1];
+ } else if (sensor == 'AUX_HYDRO_THEMO_TEMPER') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_HYDRO_THEMO_TEMPER[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_HYDRO_THEMO_TEMPER[1];
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_HYDRO_THEMO_TEMPER[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_HYDRO_THEMO_TEMPER[1];
+ } else if (sensor == 'AUX_ULTRASONIC') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1];
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1];
+ } else if (sensor == 'AUX_MAGNETIC') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1];
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1];
+ } else if (sensor == 'AUX_MOTION_DETECTION') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_MOTION_DETECTION[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_MOTION_DETECTION[1];
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_MOTION_DETECTION[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE
+ .AUX_MOTION_DETECTION[1];
+ } else if (sensor == 'AUX_COLOR') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1];
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1];
+ } else if (sensor == 'AUX_CUSTOM') {
+ data_default_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];
+ data_default_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];
+ }
+
+ data_default_address =
+ data_default_address + increase * data_default_length;
+ data_address = data_default_address;
+ // if (increase != 0) {
+ // data_length = 6 * data_default_length;
+ // }
+
+ if (
+ Entry.hw.sendQueue.prevAddress &&
+ Entry.hw.sendQueue.prevAddress == data_default_address
+ ) {
+ if (
+ Entry.hw.sendQueue.prevTime &&
+ new Date() - Entry.hw.sendQueue.prevTime < 200
+ ) {
+ //throw new Entry.Utils.AsyncError();
+ return Entry.hw.sendQueue.prevResult;
+ }
+ }
+
+ Entry.Robotis_carCont.setRobotisData([
+ [
+ data_instruction,
+ data_address,
+ data_length,
+ data_value,
+ data_default_length,
+ ],
+ ]);
+ // Entry.hw.socket.send(JSON.stringify(Entry.hw.sendQueue));
+ Entry.Robotis_carCont.update();
+
+ var result = Entry.hw.portData[data_default_address];
+ Entry.hw.sendQueue.prevAddress = data_default_address;
+ Entry.hw.sendQueue.prevTime = new Date();
+ Entry.hw.sendQueue.prevResult = result;
+
+ return result;
+ },
+ syntax: {
+ js: [],
+ py: ['Robotis.opencm70_aux_sensor_value(%1, %2)'],
+ },
+ },
+ robotis_openCM70_cm_buzzer_index: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.General.note_a + '(0)', '0'],
+ [Lang.General.note_a + '#(1)', '1'],
+ [Lang.General.note_b + '(2)', '2'],
+ [Lang.General.note_c + '(3)', '3'],
+ [Lang.General.note_c + '#(4)', '4'],
+ [Lang.General.note_d + '(5)', '5'],
+ [Lang.General.note_d + '#(6)', '6'],
+ [Lang.General.note_e + '(7)', '7'],
+ [Lang.General.note_f + '(8)', '8'],
+ [Lang.General.note_f + '#(9)', '9'],
+ [Lang.General.note_g + '(10)', '10'],
+ [Lang.General.note_g + '#(11)', '11'],
+ [Lang.General.note_a + '(12)', '12'],
+ [Lang.General.note_a + '#(13)', '13'],
+ [Lang.General.note_b + '(14)', '14'],
+ [Lang.General.note_c + '(15)', '15'],
+ [Lang.General.note_c + '#(16)', '16'],
+ [Lang.General.note_d + '(17)', '17'],
+ [Lang.General.note_d + '#(18)', '18'],
+ [Lang.General.note_e + '(19)', '19'],
+ [Lang.General.note_f + '(20)', '20'],
+ [Lang.General.note_f + '#(21)', '21'],
+ [Lang.General.note_g + '(22)', '22'],
+ [Lang.General.note_g + '#(23)', '23'],
+ [Lang.General.note_a + '(24)', '24'],
+ [Lang.General.note_a + '#(25)', '25'],
+ [Lang.General.note_b + '(26)', '26'],
+ [Lang.General.note_c + '(27)', '27'],
+ [Lang.General.note_c + '#(28)', '28'],
+ [Lang.General.note_d + '(29)', '29'],
+ [Lang.General.note_d + '#(30)', '30'],
+ [Lang.General.note_e + '(31)', '31'],
+ [Lang.General.note_f + '(32)', '32'],
+ [Lang.General.note_f + '#(33)', '33'],
+ [Lang.General.note_g + '(34)', '34'],
+ [Lang.General.note_g + '#(35)', '35'],
+ [Lang.General.note_a + '(36)', '36'],
+ [Lang.General.note_a + '#(37)', '37'],
+ [Lang.General.note_b + '(38)', '38'],
+ [Lang.General.note_c + '(39)', '39'],
+ [Lang.General.note_c + '#(40)', '40'],
+ [Lang.General.note_d + '(41)', '41'],
+ [Lang.General.note_d + '#(42)', '42'],
+ [Lang.General.note_e + '(43)', '43'],
+ [Lang.General.note_f + '(44)', '44'],
+ [Lang.General.note_f + '#(45)', '45'],
+ [Lang.General.note_g + '(46)', '46'],
+ [Lang.General.note_g + '#(47)', '47'],
+ [Lang.General.note_a + '(48)', '48'],
+ [Lang.General.note_a + '#(49)', '49'],
+ [Lang.General.note_b + '(50)', '50'],
+ [Lang.General.note_c + '(51)', '51'],
+ ],
+ value: '0',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ {
+ type: 'number',
+ params: ['1'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_cm_buzzer_index',
+ },
+ paramsKeyMap: {
+ CM_BUZZER_INDEX: 0,
+ CM_BUZZER_TIME: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['Robotis_openCM70EDU'],
+ func: function (sprite, script) {
+ // instruction / address / length / value / default length
+ var cmBuzzerIndex = script.getField('CM_BUZZER_INDEX', script);
+ var cmBuzzerTime = script.getNumberValue(
+ 'CM_BUZZER_TIME',
+ script
+ );
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address_1 = 0;
+ var data_length_1 = 0;
+ var data_value_1 = 0;
+ var data_address_2 = 0;
+ var data_length_2 = 0;
+ var data_value_2 = 0;
+ var interval = 100;
+
+ data_address_1 =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];
+ data_length_1 =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];
+ // data_value_1 = cmBuzzerTime * 10;
+ // TODO 텍스트 입력으로 바꾸고 최대는 5초 : 0.5 초 하려면 5를 입력 - console.log(parseInt(0.59 * 10)); max 는 5초
+ data_value_1 = parseInt(cmBuzzerTime * 10);
+ if (data_value_1 > 50) {
+ data_value_1 = 50;
+ }
+
+ data_address_2 =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0];
+ data_length_2 =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1];
+ data_value_2 = cmBuzzerIndex;
+
+ var data_sendqueue = [
+ [
+ data_instruction,
+ data_address_1,
+ data_length_1,
+ data_value_1,
+ ],
+ [
+ data_instruction,
+ data_address_2,
+ data_length_2,
+ data_value_2,
+ ],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ cmBuzzerTime * 1000 + interval
+ );
+ },
+ syntax: {
+ js: [],
+ py: ['Robotis.opencm70_cm_buzzer_index(%1, %2)'],
+ },
+ },
+ robotis_openCM70_cm_buzzer_melody: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ ['0', '0'],
+ ['1', '1'],
+ ['2', '2'],
+ ['3', '3'],
+ ['4', '4'],
+ ['5', '5'],
+ ['6', '6'],
+ ['7', '7'],
+ ['8', '8'],
+ ['9', '9'],
+ ['10', '10'],
+ ['11', '11'],
+ ['12', '12'],
+ ['13', '13'],
+ ['14', '14'],
+ ['15', '15'],
+ ['16', '16'],
+ ['17', '17'],
+ ['18', '18'],
+ ['19', '19'],
+ ['20', '20'],
+ ['21', '21'],
+ ['22', '22'],
+ ['23', '23'],
+ ['24', '24'],
+ ],
+ value: '0',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null],
+ type: 'robotis_openCM70_cm_buzzer_melody',
+ },
+ paramsKeyMap: {
+ CM_BUZZER_MELODY: 0,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['Robotis_openCM70EDU'],
+ func: function (sprite, script) {
+ // instruction / address / length / value / default length
+ var cmBuzzerMelody = script.getField(
+ 'CM_BUZZER_MELODY',
+ script
+ );
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address_1 = 0;
+ var data_length_1 = 0;
+ var data_value_1 = 0;
+ var data_address_2 = 0;
+ var data_length_2 = 0;
+ var data_value_2 = 0;
+ var interval = 100;
+
+ data_address_1 =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];
+ data_length_1 =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];
+ data_value_1 = 255;
+
+ data_address_2 =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0];
+ data_length_2 =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1];
+ data_value_2 = cmBuzzerMelody;
+
+ var data_sendqueue = [
+ [
+ data_instruction,
+ data_address_1,
+ data_length_1,
+ data_value_1,
+ ],
+ [
+ data_instruction,
+ data_address_2,
+ data_length_2,
+ data_value_2,
+ ],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ 1000 + interval
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_buzzer_melody(%1)'] },
+ },
+ robotis_openCM70_cm_sound_detected_clear: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_openCM70_cm_sound_detected_clear',
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['Robotis_openCM70EDU'],
+ func: function (sprite, script) {
+ // instruction / address / length / value / default length
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1];
+ data_value = 0;
+
+ var data_sendqueue = [
+ [data_instruction, data_address, data_length, data_value],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_sound_clear()'] },
+ },
+ robotis_openCM70_cm_led: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_red_color, 'CM_LED_R'],
+ [Lang.Blocks.robotis_common_green_color, 'CM_LED_G'],
+ [Lang.Blocks.robotis_common_blue_color, 'CM_LED_B'],
+ ],
+ value: 'CM_LED_R',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_on, '1'],
+ [Lang.Blocks.robotis_common_off, '0'],
+ ],
+ value: '1',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null, null],
+ type: 'robotis_openCM70_cm_led',
+ },
+ paramsKeyMap: {
+ CM_LED: 0,
+ VALUE: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['Robotis_openCM70EDU'],
+ func: function (sprite, script) {
+ // instruction / address / length / value / default length
+ var cmLed = script.getField('CM_LED', script);
+ var value = script.getField('VALUE', script);
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ if (cmLed == 'CM_LED_R') {
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[1];
+ } else if (cmLed == 'CM_LED_G') {
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[1];
+ } else if (cmLed == 'CM_LED_B') {
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[1];
+ }
+
+ data_value = value;
+
+ var data_sendqueue = [
+ [data_instruction, data_address, data_length, data_value],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_led(%1, %2)'] },
+ },
+ robotis_openCM70_cm_motion: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'number',
+ params: ['1'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_cm_motion',
+ },
+ paramsKeyMap: {
+ VALUE: 0,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['Robotis_openCM70EDU'],
+ func: function (sprite, script) {
+ // instruction / address / length / value / default length
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[0];
+ data_length = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[1];
+ data_value = script.getNumberValue('VALUE', script);
+
+ var data_sendqueue = [
+ [data_instruction, data_address, data_length, data_value],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_motion(%1)'] },
+ },
+ robotis_openCM70_aux_motor_speed: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_port_1, '1'],
+ [Lang.Blocks.robotis_common_port_2, '2'],
+ ],
+ value: '1',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_clockwhise, 'CW'],
+ [Lang.Blocks.robotis_common_counter_clockwhise, 'CCW'],
+ ],
+ value: 'CW',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ null,
+ {
+ type: 'number',
+ params: ['500'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_aux_motor_speed',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ DIRECTION_ANGLE: 1,
+ VALUE: 2,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['Robotis_openCM70EDU'],
+ func: function (sprite, script) {
+ // instruction / address / length / value / default length
+ var port = script.getField('PORT', script);
+ var directionAngle = script.getField('DIRECTION_ANGLE', script);
+ var value = script.getNumberValue('VALUE');
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1];
+
+ data_address = data_address + (port - 1) * data_length;
+
+ if (directionAngle == 'CW') {
+ value = value + 1024;
+ if (value > 2047) {
+ value = 2047;
+ }
+ } else {
+ if (value > 1023) {
+ value = 1023;
+ }
+ }
+
+ data_value = value;
+
+ var data_sendqueue = [
+ [data_instruction, data_address, data_length, data_value],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: {
+ js: [],
+ py: ['Robotis.opencm70_aux_motor_speed(%1, %2, %3)'],
+ },
+ },
+ robotis_openCM70_aux_servo_mode: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_port_3, '3'],
+ [Lang.Blocks.robotis_common_port_4, '4'],
+ [Lang.Blocks.robotis_common_port_5, '5'],
+ [Lang.Blocks.robotis_common_port_6, '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_wheel_mode, '0'],
+ [Lang.Blocks.robotis_common_joint_mode, '1'],
+ ],
+ value: '0',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null, null],
+ type: 'robotis_openCM70_aux_servo_mode',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ MODE: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['Robotis_openCM70EDU'],
+ func: function (sprite, script) {
+ // instruction / address / length / value / default length
+ var port = script.getField('PORT', script);
+ var mode = script.getField('MODE', script);
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[1];
+
+ data_address = data_address + (port - 1) * data_length;
+ data_value = mode;
+
+ var data_sendqueue = [
+ [data_instruction, data_address, data_length, data_value],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_aux_servo_mode(%1, %2)'] },
+ },
+ robotis_openCM70_aux_servo_speed: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_port_3, '3'],
+ [Lang.Blocks.robotis_common_port_4, '4'],
+ [Lang.Blocks.robotis_common_port_5, '5'],
+ [Lang.Blocks.robotis_common_port_6, '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_clockwhise, 'CW'],
+ [Lang.Blocks.robotis_common_counter_clockwhise, 'CCW'],
+ ],
+ value: 'CW',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ null,
+ {
+ type: 'number',
+ params: ['500'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_aux_servo_speed',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ DIRECTION_ANGLE: 1,
+ VALUE: 2,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['Robotis_openCM70EDU'],
+ func: function (sprite, script) {
+ // instruction / address / length / value / default length
+ var port = script.getField('PORT', script);
+ var directionAngle = script.getField('DIRECTION_ANGLE', script);
+ var value = script.getNumberValue('VALUE');
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[1];
+
+ data_address = data_address + (port - 1) * data_length;
+
+ if (directionAngle == 'CW') {
+ value = value + 1024;
+ if (value > 2047) {
+ value = 2047;
+ }
+ } else {
+ if (value > 1023) {
+ value = 1023;
+ }
+ }
+
+ data_value = value;
+
+ var data_sendqueue = [
+ [data_instruction, data_address, data_length, data_value],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: {
+ js: [],
+ py: ['Robotis.opencm70_aux_servo_speed(%1, %2, %3)'],
+ },
+ },
+ robotis_openCM70_aux_servo_position: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_port_3, '3'],
+ [Lang.Blocks.robotis_common_port_4, '4'],
+ [Lang.Blocks.robotis_common_port_5, '5'],
+ [Lang.Blocks.robotis_common_port_6, '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ {
+ type: 'number',
+ params: ['512'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_aux_servo_position',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ VALUE: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['Robotis_openCM70EDU'],
+ func: function (sprite, script) {
+ // instruction / address / length / value / default length
+ var port = script.getField('PORT', script);
+ var value = script.getNumberValue('VALUE');
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];
+
+ data_address = data_address + (port - 1) * data_length;
+
+ if (value > 1023) {
+ value = 1023;
+ } else if (value < 0) {
+ value = 0;
+ }
+
+ data_value = value;
+
+ var data_sendqueue = [
+ [data_instruction, data_address, data_length, data_value],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: {
+ js: [],
+ py: ['Robotis.opencm70_aux_servo_position(%1, %2)'],
+ },
+ },
+ robotis_openCM70_aux_led_module: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_port_3, '3'],
+ [Lang.Blocks.robotis_common_port_4, '4'],
+ [Lang.Blocks.robotis_common_port_5, '5'],
+ [Lang.Blocks.robotis_common_port_6, '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Dropdown',
+ options: [
+ [
+ Lang.Blocks.robotis_cm_led_both +
+ Lang.Blocks.robotis_common_off,
+ '0',
+ ],
+ [
+ Lang.Blocks.robotis_cm_led_right +
+ Lang.Blocks.robotis_common_on,
+ '1',
+ ],
+ [
+ Lang.Blocks.robotis_cm_led_left +
+ Lang.Blocks.robotis_common_on,
+ '2',
+ ],
+ [
+ Lang.Blocks.robotis_cm_led_both +
+ Lang.Blocks.robotis_common_on,
+ '3',
+ ],
+ ],
+ value: '0',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null, null, null],
+ type: 'robotis_openCM70_aux_led_module',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ LED_MODULE: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['Robotis_openCM70EDU'],
+ func: function (sprite, script) {
+ // instruction / address / length / value / default length
+ var port = script.getField('PORT', script);
+ var ledModule = script.getField('LED_MODULE', script);
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];
+
+ data_address = data_address + (port - 1) * data_length;
+ data_value = ledModule;
+
+ var data_sendqueue = [
+ [data_instruction, data_address, data_length, data_value],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_aux_led_module(%1, %2)'] },
+ },
+ robotis_openCM70_aux_custom: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_common_port_3, '3'],
+ [Lang.Blocks.robotis_common_port_4, '4'],
+ [Lang.Blocks.robotis_common_port_5, '5'],
+ [Lang.Blocks.robotis_common_port_6, '6'],
+ ],
+ value: '3',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ null,
+ {
+ type: 'number',
+ params: ['0'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_aux_custom',
+ },
+ paramsKeyMap: {
+ PORT: 0,
+ VALUE: 1,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['Robotis_openCM70EDU'],
+ func: function (sprite, script) {
+ // instruction / address / length / value / default length
+ var port = script.getField('PORT', script);
+ var value = script.getNumberValue('VALUE');
+
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];
+ data_length =
+ Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];
+
+ data_address = data_address + (port - 1) * data_length;
+ data_value = value;
+
+ var data_sendqueue = [
+ [data_instruction, data_address, data_length, data_value],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_aux_custom(%1, %2)'] },
+ },
+ robotis_openCM70_cm_custom: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Block',
+ accept: 'string',
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [
+ {
+ type: 'number',
+ params: ['0'],
+ },
+ {
+ type: 'number',
+ params: ['0'],
+ },
+ null,
+ ],
+ type: 'robotis_openCM70_cm_custom',
+ },
+ paramsKeyMap: {
+ ADDRESS: 0,
+ VALUE: 1,
+ },
+ class: 'robotis_openCM70_custom',
+ isNotFor: ['Robotis_openCM70EDU'],
+ func: function (sprite, script) {
+ // instruction / address / length / value / default length
+ var data_instruction = Entry.Robotis_openCM70.INSTRUCTION.WRITE;
+ var data_address = 0;
+ var data_length = 0;
+ var data_value = 0;
+
+ data_address = script.getNumberValue('ADDRESS');
+ data_value = script.getNumberValue('VALUE');
+ if (data_value > 65535) {
+ data_length = 4;
+ } else if (data_value > 255) {
+ data_length = 2;
+ } else {
+ data_length = 1;
+ }
+
+ var data_sendqueue = [
+ [data_instruction, data_address, data_length, data_value],
+ ];
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_custom(%1, %2)'] },
+ },
+ //endregion robotis 로보티즈
+ };
+};*/
+
+module.exports = [Entry.Robotis_carCont, Entry.Robotis_openCM70, Entry.Robotis_openCM70EDU];
diff --git a/src/playground/blocks/hardware/block_robotisRB.js b/src/playground/blocks/hardware/block_robotisRB.js
index b71bd5c4fc..b4d2fb3f6f 100644
--- a/src/playground/blocks/hardware/block_robotisRB.js
+++ b/src/playground/blocks/hardware/block_robotisRB.js
@@ -80,10 +80,6 @@ Entry.Robotis_rb.blockMenuBlocks = [
'robotis_RB_cm_buzzer_index',
- 'robotis_RB_car_screen',
- 'robotis_RB_car_anim_screen',
-
-
'robotis_RB_cm_screen',
'robotis_RB_cm_anim_screen',
'robotis_RB_rsp_screen',
@@ -93,11 +89,15 @@ Entry.Robotis_rb.blockMenuBlocks = [
'robotis_RB_LEDBright',
'robotis_RB_cm_led',
-
'robotis_RB_Hello',
'robotis_RB_effectSound',
'robotis_RB_record',
'robotis_RB_playRecord',
+
+ 'robotis_RB_car_screen',
+ 'robotis_RB_car_anim_screen',
+ 'robotis_RB_kkokdu_screen',
+ 'robotis_RB_kkokdu_anim_screen',
'robotis_openCM70_RGee_go',
'robotis_openCM70_RGee_stop',
@@ -105,7 +105,7 @@ Entry.Robotis_rb.blockMenuBlocks = [
'robotis_dxl_control',
'robotis_dxl_each_control',
-
+
// 'robotis_RB_cm_custom_value',
// 'robotis_RB_cm_custom',
];
@@ -126,8 +126,10 @@ Entry.Robotis_rb.setLanguage = function() {
robotis_RB_detectPose: "로봇이 %1 넘어지면",
robotis_RB_cm_buzzer_index: "제어기 음계값 %1 을(를) %2 옥타브로 %3 초 동안 %4 %5",
- robotis_RB_cm_screen: "제어기 화면 배경을 알쥐 %1 로 선택 %2",
- robotis_RB_cm_anim_screen: "제어기 화면 애니메이션을 알쥐 %1 로 선택 %2",
+
+ robotis_RB_kkokdu_screen: "제어기 화면 배경을 꼭두 %1 로 선택 %2",
+ robotis_RB_kkokdu_anim_screen: "제어기 화면 애니메이션을 꼭두 %1 로 선택 %2",
+
robotis_RB_rsp_screen: "제어기 화면에 %1 출력하기 %2",
robotis_RB_LCDBright: "제어기 화면 밝기를 %1로 정하기 %2",
@@ -144,8 +146,11 @@ Entry.Robotis_rb.setLanguage = function() {
robotis_openCM70_RGee_stop: "알쥐 정지하기 %1",
robotis_openCM70_RGee_motion: "알쥐 %1 %2",
+ robotis_RB_cm_screen: "제어기 화면 배경을 알쥐 %1 로 선택 %2",
+ robotis_RB_cm_anim_screen: "제어기 화면 애니메이션을 알쥐 %1 로 선택 %2",
+
robotis_RB_car_screen: "제어기 화면 배경을 알라 %1 로 선택 %2",
- robotis_RB_car_anim_screen: "제어기 화면 애니메이션을 알라 %1 로 선택 %2"
+ robotis_RB_car_anim_screen: "제어기 화면 애니메이션을 알라 %1 로 선택 %2",
},
Blocks: {
robotis_red: "빨강",
@@ -350,8 +355,10 @@ Entry.Robotis_rb.setLanguage = function() {
robotis_RB_detectPose:"If robot falls %1",
robotis_RB_cm_buzzer_index:"%1 at %2 octaves for %3 second(s) -> %4 %5",
- robotis_RB_cm_screen:"Choose %1 as a screen background %2",
- robotis_RB_cm_anim_screen: "Choose %1 as a screen animation %2",
+
+ robotis_RB_kkokdu_screen: "Choose %1 Tiger as a screen background %2",
+ robotis_RB_kkokdu_anim_screen: "Choose %1 Tiger as a screen animation %2",
+
robotis_RB_rsp_screen:"Print %1 on the screen %2",
robotis_RB_LCDBright:"Adjust screen brightness to %1 %2",
@@ -368,8 +375,11 @@ Entry.Robotis_rb.setLanguage = function() {
robotis_openCM70_RGee_stop:"R-G STOP",
robotis_openCM70_RGee_motion:"Do %1",
- robotis_RB_car_screen: "Choose %1 as a screen Rla background %2",
- robotis_RB_car_anim_screen: "Choose %1 as a screen Rla animation %2"
+ robotis_RB_cm_screen:"Choose %1 R-Gee as a screen background %2",
+ robotis_RB_cm_anim_screen: "Choose %1 R-Gee as a screen animation %2",
+
+ robotis_RB_car_screen: "Choose %1 R-La as a screen background %2",
+ robotis_RB_car_anim_screen: "Choose %1 R-La as a screen animation %2",
},
Blocks: {
robotis_red: "Red",
@@ -564,6 +574,7 @@ Entry.Robotis_rb.setLanguage = function() {
}
};
+let rb100_last_valid_value = [];
Entry.Robotis_rb.getBlocks = function () {
return {
@@ -759,6 +770,14 @@ Entry.Robotis_rb.getBlocks = function () {
Entry.Robotis_carCont.update();
var result = Entry.hw.portData[data_default_address];
+ if (result == undefined)
+ {
+ result = rb100_last_valid_value[data_default_address];
+ }
+ else
+ {
+ rb100_last_valid_value[data_default_address] = result;
+ }
Entry.hw.sendQueue.prevAddress = data_default_address;
Entry.hw.sendQueue.prevTime = new Date();
Entry.hw.sendQueue.prevResult = result;
@@ -870,6 +889,15 @@ Entry.Robotis_rb.getBlocks = function () {
Entry.Robotis_carCont.update();
var result = Entry.hw.portData[data_default_address];
+ if (result == undefined)
+ {
+ result = rb100_last_valid_value[data_default_address];
+ }
+ else
+ {
+ rb100_last_valid_value[data_default_address] = result;
+ }
+
Entry.hw.sendQueue.prevAddress = data_default_address;
Entry.hw.sendQueue.prevTime = new Date();
Entry.hw.sendQueue.prevResult = result;
@@ -967,6 +995,14 @@ Entry.Robotis_rb.getBlocks = function () {
Entry.Robotis_carCont.update();
var result = Entry.hw.portData[data_default_address];
+ if (result == undefined)
+ {
+ result = rb100_last_valid_value[data_default_address];
+ }
+ else
+ {
+ rb100_last_valid_value[data_default_address] = result;
+ }
Entry.hw.sendQueue.prevAddress = data_default_address;
Entry.hw.sendQueue.prevTime = new Date();
Entry.hw.sendQueue.prevResult = result;
@@ -1095,12 +1131,19 @@ Entry.Robotis_rb.getBlocks = function () {
var result = Entry.hw.portData[data_default_address];
+ if (result == undefined)
+ {
+ result = rb100_last_valid_value[data_default_address];
+ }
+ else
+ {
+ rb100_last_valid_value[data_default_address] = result;
+ }
Entry.hw.sendQueue.prevAddress = data_default_address;
Entry.hw.sendQueue.prevTime = new Date();
Entry.hw.sendQueue.prevResult = result;
if(result == undefined) {
- console.log('언디파인')
return false;
}
@@ -1331,6 +1374,14 @@ Entry.Robotis_rb.getBlocks = function () {
Entry.Robotis_carCont.update();
var result = Entry.hw.portData[data_default_address];
+ if (result == undefined)
+ {
+ result = rb100_last_valid_value[data_default_address];
+ }
+ else
+ {
+ rb100_last_valid_value[data_default_address] = result;
+ }
Entry.hw.sendQueue.prevAddress = data_default_address;
Entry.hw.sendQueue.prevTime = new Date();
Entry.hw.sendQueue.prevResult = result;
@@ -1889,6 +1940,14 @@ Entry.Robotis_rb.getBlocks = function () {
Entry.Robotis_carCont.update();
var result = Entry.hw.portData[data_default_address];
+ if (result == undefined)
+ {
+ result = rb100_last_valid_value[data_default_address];
+ }
+ else
+ {
+ rb100_last_valid_value[data_default_address] = result;
+ }
Entry.hw.sendQueue.prevAddress = data_default_address;
Entry.hw.sendQueue.prevTime = new Date();
Entry.hw.sendQueue.prevResult = result;
@@ -1989,6 +2048,14 @@ Entry.Robotis_rb.getBlocks = function () {
Entry.Robotis_carCont.update();
var result = Entry.hw.portData[data_default_address];
+ if (result == undefined)
+ {
+ result = rb100_last_valid_value[data_default_address];
+ }
+ else
+ {
+ rb100_last_valid_value[data_default_address] = result;
+ }
Entry.hw.sendQueue.prevAddress = data_default_address;
Entry.hw.sendQueue.prevTime = new Date();
Entry.hw.sendQueue.prevResult = result;
@@ -2071,6 +2138,14 @@ Entry.Robotis_rb.getBlocks = function () {
Entry.Robotis_carCont.update();
var result = Entry.hw.portData[data_default_address];
+ if (result == undefined)
+ {
+ result = rb100_last_valid_value[data_default_address];
+ }
+ else
+ {
+ rb100_last_valid_value[data_default_address] = result;
+ }
Entry.hw.sendQueue.prevAddress = data_default_address;
Entry.hw.sendQueue.prevTime = new Date();
Entry.hw.sendQueue.prevResult = result;
@@ -2178,6 +2253,14 @@ Entry.Robotis_rb.getBlocks = function () {
Entry.Robotis_carCont.update();
var result = Entry.hw.portData[data_default_address];
+ if (result == undefined)
+ {
+ result = rb100_last_valid_value[data_default_address];
+ }
+ else
+ {
+ rb100_last_valid_value[data_default_address] = result;
+ }
Entry.hw.sendQueue.prevAddress = data_default_address;
Entry.hw.sendQueue.prevTime = new Date();
Entry.hw.sendQueue.prevResult = result;
@@ -2271,6 +2354,14 @@ Entry.Robotis_rb.getBlocks = function () {
Entry.Robotis_carCont.update();
var result = Entry.hw.portData[data_default_address];
+ if (result == undefined)
+ {
+ result = rb100_last_valid_value[data_default_address];
+ }
+ else
+ {
+ rb100_last_valid_value[data_default_address] = result;
+ }
Entry.hw.sendQueue.prevAddress = data_default_address;
Entry.hw.sendQueue.prevTime = new Date();
Entry.hw.sendQueue.prevResult = result;
@@ -2371,6 +2462,14 @@ Entry.Robotis_rb.getBlocks = function () {
Entry.Robotis_carCont.update();
var result = Entry.hw.portData[data_default_address];
+ if (result == undefined)
+ {
+ result = rb100_last_valid_value[data_default_address];
+ }
+ else
+ {
+ rb100_last_valid_value[data_default_address] = result;
+ }
Entry.hw.sendQueue.prevAddress = data_default_address;
Entry.hw.sendQueue.prevTime = new Date();
Entry.hw.sendQueue.prevResult = result;
@@ -2477,6 +2576,14 @@ Entry.Robotis_rb.getBlocks = function () {
Entry.Robotis_carCont.update();
var result = Entry.hw.portData[data_default_address];
+ if (result == undefined)
+ {
+ result = rb100_last_valid_value[data_default_address];
+ }
+ else
+ {
+ rb100_last_valid_value[data_default_address] = result;
+ }
Entry.hw.sendQueue.prevAddress = data_default_address;
Entry.hw.sendQueue.prevTime = new Date();
Entry.hw.sendQueue.prevResult = result;
@@ -2636,6 +2743,163 @@ Entry.Robotis_rb.getBlocks = function () {
py: ['Robotis.opencm70_cm_buzzer_index(%1, %2)'],
},
},
+
+
+ robotis_RB_kkokdu_screen: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_car_anim01, '3585'],
+ [Lang.Blocks.robotis_car_anim02, '3586'],
+ [Lang.Blocks.robotis_car_anim03, '3587'],
+ [Lang.Blocks.robotis_car_anim04, '3588'],
+ [Lang.Blocks.robotis_car_anim05, '3589'],
+
+ [Lang.Blocks.robotis_car_anim06, '3590'],
+ [Lang.Blocks.robotis_car_anim07, '3591'],
+ [Lang.Blocks.robotis_car_anim08, '3592'],
+ [Lang.Blocks.robotis_car_anim09, '3593'],
+ [Lang.Blocks.robotis_car_anim10, '3594'],
+
+ [Lang.Blocks.robotis_car_anim11, '3595'],
+ [Lang.Blocks.robotis_car_anim12, '3596'],
+ [Lang.Blocks.robotis_car_anim13, '3597'],
+ [Lang.Blocks.robotis_car_anim14, '3598'],
+ [Lang.Blocks.robotis_car_anim15, '3599'],
+
+ [Lang.Blocks.robotis_car_anim16, '3600'],
+ [Lang.Blocks.robotis_car_anim17, '3601'],
+ [Lang.Blocks.robotis_car_anim18, '3602'],
+ [Lang.Blocks.robotis_car_anim19, '3603'],
+ ],
+ value: '3585',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_RB_kkokdu_screen',
+ },
+ paramsKeyMap: {
+ BACKGROUND: 0,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['Robotis_rb', 'Robotis_rb_H', 'Robotis_rb_car'],
+ func: function (sprite, script) {
+ // instruction / address / length / value / default length
+ var screenValue = script.getNumberValue('BACKGROUND', script);
+
+ var data_instruction = Entry.Robotis_rb.INSTRUCTION.WRITE;
+ var data_address = 163;
+ var data_length = 2;
+ var data_value = screenValue;
+
+ var data_sendqueue = [
+ [data_instruction, data_address, data_length, data_value],
+ [3, 162, 1, 1]
+ ];
+
+
+
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay + 1000
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_screen(%1)'] },
+ },
+
+ robotis_RB_kkokdu_anim_screen: {
+ color: EntryStatic.colorSet.block.default.HARDWARE,
+ outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
+ skeleton: 'basic',
+ statements: [],
+ params: [
+ {
+ type: 'Dropdown',
+ options: [
+ [Lang.Blocks.robotis_car_anim01, '31234'],
+ [Lang.Blocks.robotis_car_anim02, '31237'],
+ [Lang.Blocks.robotis_car_anim03, '31238'],
+ [Lang.Blocks.robotis_car_anim04, '31239'],
+ [Lang.Blocks.robotis_car_anim05, '31240'],
+
+ [Lang.Blocks.robotis_car_anim06, '31241'],
+ [Lang.Blocks.robotis_car_anim07, '31242'],
+ [Lang.Blocks.robotis_car_anim08, '31243'],
+ [Lang.Blocks.robotis_car_anim09, '31244'],
+ [Lang.Blocks.robotis_car_anim10, '31245'],
+
+ [Lang.Blocks.robotis_car_anim11, '31246'],
+ [Lang.Blocks.robotis_car_anim12, '31247'],
+ [Lang.Blocks.robotis_car_anim13, '31248'],
+ [Lang.Blocks.robotis_car_anim14, '31249'],
+ [Lang.Blocks.robotis_car_anim15, '31250'],
+
+ [Lang.Blocks.robotis_car_anim16, '31251'],
+ [Lang.Blocks.robotis_car_anim17, '31252'],
+ [Lang.Blocks.robotis_car_anim18, '31253'],
+ [Lang.Blocks.robotis_car_anim19, '31254'],
+ ],
+ value: '31234',
+ fontSize: 11,
+ bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
+ arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
+ },
+ {
+ type: 'Indicator',
+ img: 'block_icon/hardware_icon.svg',
+ size: 12,
+ },
+ ],
+ events: {},
+ def: {
+ params: [null],
+ type: 'robotis_RB_kkokdu_anim_screen',
+ },
+ paramsKeyMap: {
+ BACKGROUND: 0,
+ },
+ class: 'robotis_openCM70_cm',
+ isNotFor: ['Robotis_rb', 'Robotis_rb_H', 'Robotis_rb_car'],
+ func: function (sprite, script) {
+ // instruction / address / length / value / default length
+ var screenValue = script.getNumberValue('BACKGROUND', script);
+
+ var data_instruction = Entry.Robotis_rb.INSTRUCTION.WRITE;
+ var data_address = 163;
+ var data_length = 2;
+ var data_value = screenValue;
+
+ var data_sendqueue = [
+ [data_instruction, data_address, data_length, data_value],
+ [3, 162, 1, 1]
+ ];
+
+
+
+ return Entry.Robotis_carCont.postCallReturn(
+ script,
+ data_sendqueue,
+ Entry.Robotis_openCM70.delay //+ 1000
+ );
+ },
+ syntax: { js: [], py: ['Robotis.opencm70_cm_screen(%1)'] },
+ },
robotis_RB_cm_screen: {
color: EntryStatic.colorSet.block.default.HARDWARE,
outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
@@ -2814,30 +3078,30 @@ Entry.Robotis_rb.getBlocks = function () {
{
type: 'Dropdown',
options: [
- [Lang.Blocks.robotis_car_anim01, '2840'],
- [Lang.Blocks.robotis_car_anim02, '2841'],
- [Lang.Blocks.robotis_car_anim03, '2842'],
- [Lang.Blocks.robotis_car_anim04, '2843'],
- [Lang.Blocks.robotis_car_anim05, '2844'],
-
- [Lang.Blocks.robotis_car_anim06, '2845'],
- [Lang.Blocks.robotis_car_anim07, '2846'],
- [Lang.Blocks.robotis_car_anim08, '2847'],
- [Lang.Blocks.robotis_car_anim09, '2848'],
- [Lang.Blocks.robotis_car_anim10, '2849'],
-
- [Lang.Blocks.robotis_car_anim11, '2850'],
- [Lang.Blocks.robotis_car_anim12, '2851'],
- [Lang.Blocks.robotis_car_anim13, '2852'],
- [Lang.Blocks.robotis_car_anim14, '2853'],
- [Lang.Blocks.robotis_car_anim15, '2854'],
-
- [Lang.Blocks.robotis_car_anim16, '2855'],
- [Lang.Blocks.robotis_car_anim17, '2856'],
- [Lang.Blocks.robotis_car_anim18, '2857'],
- [Lang.Blocks.robotis_car_anim19, '2858'],
+ [Lang.Blocks.robotis_car_anim01, '3329'],
+ [Lang.Blocks.robotis_car_anim02, '3330'],
+ [Lang.Blocks.robotis_car_anim03, '3331'],
+ [Lang.Blocks.robotis_car_anim04, '3332'],
+ [Lang.Blocks.robotis_car_anim05, '3333'],
+
+ [Lang.Blocks.robotis_car_anim06, '3334'],
+ [Lang.Blocks.robotis_car_anim07, '3335'],
+ [Lang.Blocks.robotis_car_anim08, '3336'],
+ [Lang.Blocks.robotis_car_anim09, '3337'],
+ [Lang.Blocks.robotis_car_anim10, '3338'],
+
+ [Lang.Blocks.robotis_car_anim11, '3339'],
+ [Lang.Blocks.robotis_car_anim12, '3340'],
+ [Lang.Blocks.robotis_car_anim13, '3341'],
+ [Lang.Blocks.robotis_car_anim14, '3342'],
+ [Lang.Blocks.robotis_car_anim15, '3343'],
+
+ [Lang.Blocks.robotis_car_anim16, '3344'],
+ [Lang.Blocks.robotis_car_anim17, '3345'],
+ [Lang.Blocks.robotis_car_anim18, '3346'],
+ [Lang.Blocks.robotis_car_anim19, '3347'],
],
- value: '2840',
+ value: '3329',
fontSize: 11,
bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
diff --git a/src/playground/blocks/hardware/block_robotisRBCar.js b/src/playground/blocks/hardware/block_robotisRBCar.js
index 476549b15e..4a07624c22 100644
--- a/src/playground/blocks/hardware/block_robotisRBCar.js
+++ b/src/playground/blocks/hardware/block_robotisRBCar.js
@@ -82,9 +82,6 @@ Entry.Robotis_rb_car.blockMenuBlocks = [
//알라표정
//화면 애니메이션
- 'robotis_RB_car_screen',
- 'robotis_RB_car_anim_screen',
-
'robotis_RB_cm_screen',
'robotis_RB_cm_anim_screen',
'robotis_RB_rsp_screen',
@@ -99,6 +96,11 @@ Entry.Robotis_rb_car.blockMenuBlocks = [
'robotis_RB_effectSound',
'robotis_RB_record',
'robotis_RB_playRecord',
+
+ 'robotis_RB_car_screen',
+ 'robotis_RB_car_anim_screen',
+ 'robotis_RB_kkokdu_screen',
+ 'robotis_RB_kkokdu_anim_screen',
'robotis_openCM70_RLa_go',
'robotis_openCM70_RLa_stop',
diff --git a/src/playground/blocks/hardware/block_robotisRBHumanoid.js b/src/playground/blocks/hardware/block_robotisRBHumanoid.js
index fb289009ca..5a38d78398 100644
--- a/src/playground/blocks/hardware/block_robotisRBHumanoid.js
+++ b/src/playground/blocks/hardware/block_robotisRBHumanoid.js
@@ -85,6 +85,7 @@ Entry.Robotis_rb_H.blockMenuBlocks = [
'robotis_RB_detectPose',
'robotis_RB_cm_buzzer_index',
+
'robotis_RB_cm_screen',
'robotis_RB_cm_anim_screen',
'robotis_RB_rsp_screen',
@@ -100,6 +101,11 @@ Entry.Robotis_rb_H.blockMenuBlocks = [
'robotis_RB_record',
'robotis_RB_playRecord',
+ 'robotis_RB_car_screen',
+ 'robotis_RB_car_anim_screen',
+ 'robotis_RB_kkokdu_screen',
+ 'robotis_RB_kkokdu_anim_screen',
+
'robotis_RB_cm_motion',
'robotis_RB_cm_motion2',
'robotis_RB_cm_motion_custom',