Copyright and Disclaimer
Copyright © ShenZhen Yuejiang Technology Co., Ltd. 2019. All rights reserved. No part of this document may be reproduced or transmitted in any form or by any means without prior written consent of Yuejiang Technology Co., Ltd.
Disclaimer
To the maximum extent permitted by applicable law, the products described (including its hardware, software and firmware, etc.) in this document are provided AS IS, which may have flaws, errors or faults. Yuejiang makes no warranties of any kind, express or implied, including but not limited to, merchantability, satisfaction of quality, fitness for a particular purpose and non-infringement of third party rights. In no event will Yuejiang be liable for any special, incidental, consequential or indirect damages resulting from the use of our products and documents. Before using our product, please thoroughly read and understand the contents of this document and related technical documents that are published online, to ensure that the robotic arm is used on the premise of fully understanding the robotic arm and related knowledge. Please use this document with technical guidance from professionals. Even if follow this document or any other related instructions, Damages or losses will be happen in the using process, Dobot shall not be considered as a guarantee regarding to all security information contained in this document. The user has the responsibility to make sure following the relevant practical laws and regulations of the country, in order that there is no significant danger in the use of the robotic arm.
ShenZhen Yuejiang Technology Co., Ltd.
Address: Floor 9-10, Building 2, Chongwen Garden, Nanshan iPark, Liuxian Blvd, Nanshan District, Shenzhen, Guangdong Province, China
Website: www.dobot.cc
Preface
Purpose
This manual describes how to use the blockly modules of Dobot M1, which will make users use program blockly skillfully.
Intended Audience
- Customer Engineer
- Sales Engineer
- Installation and Commissioning Engineer
- Technical Support Engineer
Change History
Date | Change Description |
---|---|
2019/10/30 | The first release |
Symbol Conventions
Symbol | Description |
---|---|
DANGER | Indicates a hazard with a high level of risk which, if not avoided, could result in death or serious injury |
WARNING | Indicates a hazard with a medium level or low level of risk which, if not avoided, could result in minor or moderate injury, robotic arm damage |
NOTICE | Indicates a potentially hazardous situation which, if not avoided, can result in robotic arm damage, data loss, or unanticipated result |
NOTE | Provides additional information to emphasize or supplement important points in the main text |
1. Overview
Blockly is a programming platform based on Google Blockly. You can program through the puzzle format, which is straightforward and easy to understand.
2. Dobot Blockly Description
2.1 Logic
Blockly | Description | Parameter | Return |
---|---|---|---|
The block behind do will be executed, if the block behind If is true | None | None | |
Judge the relationship between two values Judgement condition: =, >, < |
Return 1: true Return 0: false |
||
Get a value 0 or 1 by calculating two conditions and: When the two conditions are true, the calculated result is true, or else the result is false or: When the two conditions are false, the calculated result is false, or else the result is true |
Return 1: true Return 0: false |
||
NOT operator is a Boolean operator that returns TRUE or 1 when the operand is FALSE or 0, and returns FALSE or 0 when the operand is TRUE or 1 | None | Return 1: true Return 0: false |
|
Return true or false Value type: True or False |
Value type: True or False | Return 1: true Return 0: false |
|
Return NULL | None | Return NULL | |
If the condition is true, this module will return the result behind if true, otherwise return the result behind if false | None | Return a result according to the condition |
2.2 Loops
Blockly | Description | Parameter | Return |
---|---|---|---|
Repeat for many times | Time: Set time for repetition | None | |
Execute while or until loop instruction While: In while loop, if condition is true, execute loop, otherwise break out of the loop Until: In until loop, the loop will be executed one time first, and then judge the condition, if the condition is true, continue loop, otherwise break out of the loop |
None | ||
Traverse a list by interval The starting number: Set a starting number The end number: Set an end number Interval: Set interval to N, traverse list for every N. For example, set a starting number to 1, set an end number to 10 (does not contain 10). When set an interval to 1, the interval values are 1, 2, 3, 4...9. When Set an interval to 2, the interval values are 1, 3, 5, 7, 9 |
Variable: Click drop-down list to select a variable or create a variable | None | |
Traverse a list | Variable: Click drop-down list to select a variable or create a variable List: Add a list to this module |
None | |
Break out or continue a loop | Break out: Break out of a loop Continue: Continue a loop |
None |
2.3 Math
Blockly | Description | Parameter | Return |
---|---|---|---|
Return a number, which can be a parameter or condition for other modules | Number: Set a number | Return a number | |
Calculate two numbers to get a result Operators: +, -, ×, ÷ |
Return a result | ||
Get a calculated number Operator: square root, absolute, ln, log10, e^, 10^ |
Return a result | ||
Calculate trigonometric Trigonometric: sin, cos, tan, asin, acos, atan |
Return a result number | ||
Get a constant value Constants: π, e, sqrt(2), sqrt(1/2) |
Return a constant value | ||
Judge a value type Types: even, odd, prime, whole, positive, negative, divisible by |
Return 1: true Return 0: false |
||
Modify the value of variable | Variable: select variable or create a variable Value: Set a value for variable |
None | |
Round a value Round types: round, round down, round up |
Value: Set a value to round | Return a value | |
Calculate the data which is in a list Calculation types: sum, min, max, average, median, modes, standard, random item |
List: | Return a result | |
Get a remainder | Divisor: Set a divisor Dividend: Set a dividend |
Return a remainder | |
Limit a number in a range | The limited number: Input a value low: Input a minimum value high: Input a maximum value |
Return a number | |
Get a random integer in a range | Minimum number: Set a minimum value Maximum number: Set a maximum value |
Return a random integer | |
Get a random fraction | None | Return a random fraction |
2.4 Text
Blockly | Description | Parameter | Return |
---|---|---|---|
Set text | None | Return text | |
Create a string | None | Return a string | |
Append a string to another string | Appended String: Select a appended string String: Input a string to append |
None | |
Get the length of string | String: Input a string | Return length | |
Judge whether a string is empty or not | String: Input a string | Return 1: Empty Return 0: Not empty |
|
Find the indexes of the first and last position of substring | String: Drag a string into this module Index: Select the index where substring appears Substring: Input a substring that you want to find |
If string is found, return the index, otherwise return 0 | |
Get a character at a specified position from a string | String: Drag a string to this module Select the index of character: Letter #, Letter # from end, First letter, Last letter, Random letter |
Return a letter | |
Get a substring from a string | String: Set a string Select the starting index Select the end index |
Return a substring | |
Convert string to uppercase or lowercase Convert styles: UPPER CASE, lower case, Title Case |
Return a converted string | ||
Remove space in a string Space position: Both sides, Right side, Left side |
Return the converted string | ||
Print a string | None | None | |
Set a prompt | Input a prompt | Return a prompt |
2.5 Lists
Blockly | Description | Parameter | Return |
---|---|---|---|
Create an empty list | Add item: Click +, and drag item to list. | Return an empty list | |
Create a list with item | Add item: Click +, and drag item to list based on site requirements | Return a list | |
Create a list with one element repeated | Item: Set one element Repeat times: Set repeating times |
Return a list | |
Get the length of list | List: drag a list to this module to get the length | Return a length | |
Judge a list whether is empty or not | List: Drag a list to this module | Return 1: Empty Return 0: Not empty |
|
Get the indexes of the first and last item in list | List: Drag the searched list to this module Searched positions: The first occurrence, The last occurrence The searched item: Drag the searched item to this module |
If searched item is found, return the index, otherwise return 0 | |
Operate the items in list Operations: Get, Get and remove, Remove Remove Index: #, # from end, First, Last, Random Index: Set index |
List: Drag a list to this module When the operation is get or get and remove, return the obtained value There is no return, when the operation is remove |
||
Modify item in list Modifications: Set, Insert at Index: #, # from end, first, last, random Index: Set index Value: Set value |
List: Drag a list to this module | Return a modified list | |
Get a sub-list from list | List: Drag a list to this module The starting positions: get a sub-list from #, get a sub-list from # from end, get a sub-list from first The end positions: to #, to # from end, to end Index: Set index |
Return a sub-list | |
Sort and copy list Sort regulations: numeric, alphabetic, alphabetic, ignore case sort: ascending, descending |
Return a sorted list |
2.6 Colour
Blockly | Description | Parameter | Return |
---|---|---|---|
Select a color from color plate | None | Return a color | |
Get a random color | None | Return a random color | |
Create a color with three colors: red, green, blue Red: The range is 0~100 Green: The range is 0~100 Blue: The range is 0~100 |
Return a custom color | ||
Create a color by mixing two colors | Color 1: Click color plate to select a color Color 2: Click color plate to select a color Ratio: Set the ratio of two colors, the range is 0~1 |
Return a color |
2.7 Variables
Blockly | Description | Parameter | Return |
---|---|---|---|
Create variable Create variable: Click drop list to create variable Select variable: Click drop list to select variable Rename variable: Click drop list to rename variable |
Return a variable | ||
Assign values to variables Create variable: Click drop-down list to create variable Select variable: Click drop-down list to select variable Rename variable: Click drop-down list to rename variable |
Value: set variable value | None |
2.8 Function
Blockly | Description | Parameter | Return |
---|---|---|---|
Define a function without return value | Function name: Click edit box to input function name Parameters: Click +, and drag parameter module to the right module and name it. Tip: Click +, and add tip for function. |
None | |
Define a function with a return value | Function name: Click edit box to input function name Parameters: Click +, and drag parameter module to the right module and name it. Tip: Click +, and add tip for function. |
Return: return a value | |
If condition is true, return a value | Condition: Drag a condition into this module Return: Drag a return module into this module |
None |
2.9 Dobot API
NOTICE If you use the motion command when writing a program in Cartesian coordinate system, please add the orientation command before this motion command, which indicates the arm orientation of Dobot M1.
When creating TCP/IP, the IP address of the client and server must be in the same network segment.
2.9.1 Basic
Blockly | Description | Parameter | Return |
---|---|---|---|
Get the current system time | None | System time, unit: second | |
Create Server IP address and port | Server Ip: Server IP address. That is, IP address of Dobot M1 or M1Studio as the server Port: Server Port |
None | |
Server (Dobot M1 or M1Studio) receives data from the client (external equipment) | None | Client data | |
Server (Dobot M1 or M1Studio) sends data to the client (external equipment) | Data: Data sent to the client | None | |
Close the server | None | None | |
Create Client IP address and port | Client Ip: Client IP address. That is, IP address of Dobot M1 or M1Studio as the client Port: Client port |
None | |
Client (Dobot M1 or M1Studio) receives data from the server (external equipment) | None | Server data | |
Client (Dobot M1 or M1Studio) sends data to the server (external equipment) | Data: Data sent to the server | None | |
Close the client | None | None |
Figure 2.1 Server demo: A diagram illustrating a server setup for Dobot M1 communication, showing connections and data flow.
Figure 2.2 Client demo: A diagram illustrating a client setup for Dobot M1 communication, showing connections and data flow.
2.9.2 Config
Blockly | Description | Parameter | Return |
---|---|---|---|
Set the velocity ratio and acceleration ratio in PTP mode | VelocityRatio: Velocity ratio in PTP mode. The actual velocity = the maximum velocity * VelocityRatio JerkRatio: Acceleration ratio in PTP mode. The actual velocity = the maximum acceleration * JerkRatio |
None | |
Set the lifting height and maximum lifting height in JUMP mode | JumpHeight: Lifting height ZLimit: Maximum lifting height |
None |
2.9.3 Motion
Blockly | Description | Parameter | Return |
---|---|---|---|
Set the arm orientation | Arm Orientation: Left, Lefty-hand; Right: Righty-hand | None | |
Get the arm orientation | None | Arm Orientation: Left, Lefty-hand; Right: Righty-hand | |
Move Dobot M1 to a target position in MOVL mode | X: Set X-axis coordinate in Cartesian coordinate system Y: Set Y-axis coordinate in Cartesian coordinate system Z: Set Z-axis coordinate in Cartesian coordinate system R: Set R-axis coordinate in Cartesian coordinate system |
None | |
Move Dobot M1 to a target position in JUMP mode | X: Set X-axis coordinate in Cartesian coordinate system Y: Set Y-axis coordinate in Cartesian coordinate system Z: Set Z-axis coordinate in Cartesian coordinate system R: Set R-axis coordinate in Cartesian coordinate system |
None | |
Move Dobot M1 to a target position in MOVJ mode | X: Set X-axis coordinate in Cartesian coordinate system Y: Set Y-axis coordinate in Cartesian coordinate system Z: Set Z-axis coordinate in Cartesian coordinate system R: Set R-axis coordinate in Cartesian coordinate system |
None | |
Move Dobot M1 to a target position in MOVJ mode | X: Set Y-axis coordinate increment in Cartesian coordinate system Y: Set Y-axis coordinate increment in Cartesian coordinate system Z: Set Z-axis coordinate increment in Cartesian coordinate system R: Set R-axis coordinate increment in Cartesian coordinate system |
None | |
Move Dobot M1 to a target position in MOVL mode | J1: Set J1-axis coordinate in Joint coordinate system J2: Set J2-axis coordinate in Joint coordinate system J3: Set J3-axis coordinate in Joint coordinate system J4: Set J4-axis coordinate in Joint coordinate system |
None | |
Move Dobot M1 to a target position in MOVJ mode | J1: Set J1-axis coordinate in Joint coordinate system J2: Set J2-axis coordinate in Joint coordinate system J3: Set J3-axis coordinate in Joint coordinate system J4: Set J4-axis coordinate in Joint coordinate system |
None | |
Move Dobot M1 to a target position in MOVJ mode | J1: Set J1-axis coordinate in Joint coordinate system J2: Set J2-axis coordinate in Joint coordinate system J3: Set J3-axis coordinate in Joint coordinate system J4: Set J4-axis coordinate in Joint coordinate system |
None | |
Move Dobot M1 to a target position in MOVJ mode | J1: Set J1-axis coordinate increment in Joint coordinate system J2: Set J2-axis coordinate increment in Joint coordinate system J3: Set J3-axis coordinate increment in Joint coordinate system J4: Set J4-axis coordinate increment in Joint coordinate system |
None | |
Move Dobot M1 to a target position in ARC mode It is necessary to confirm the three points with other motion blocks. |
First parameter: Middle point, which can be set to Cartesian coordinate Second parameter: End point, which can be set to Cartesian coordinate |
None | |
Move Dobot M1 to a target position in CIRCLE mode It is necessary to confirm the three points with other motion blocks. |
First parameter: Middle point, which can be set to Cartesian coordinate Second parameter: End point, which can be set to Cartesian coordinate Count: Circle number |
None | |
Get the real-time Cartesian coordinates of Dobot M1 | Coordinates: x: X-axis coordinate, y: Y-axis coordinate, z: Z-axis coordinate, r: R-axis coordinate | Return Cartesian coordinate | |
Get the real-time joint angle of Dobot M1 | Joints: joint1: J1-axis coordinate, joint 2: J2-axis coordinate, joint 3: J3-axis coordinate, joint 4: J4-axis coordinate | Return Joint coordinate | |
Set the wait time If you need to set the pause time between the two modules, please call this module |
Delaytime, Unit: s | None |
2.9.4 I/O
Blockly | Description | Parameter | Return |
---|---|---|---|
Get digital input | Input: Digital input address. Value range: IN01-IN24 | Level value of the right digital input address. 0: Low level; 1: High level | |
Get analog input | AD: Analog input address. Value range: AD01-AD06 | Value of the right analog input address. Value range: 0-4095 | |
Set EIO output | Output: Digital output address. Value range: OUT01-OUT02 Value: 0: Low level; 1: High level |
None |