Utilities
This page contains information on all functions present within util.py and aims to give a clear understanding both of what these functions do and the requirements for any data to be input into them.
Most of these functions contain actions for the arm that do not necessarily fit into other categories such as connection and checking verification.
Functions
arm_utilities
Source code in actions\util.py
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
check_verification()
checks verification
Returns:
| Name | Type | Description |
|---|---|---|
out |
tuple[int, int]
|
tuple((code, status)), returned result is only corrent when code is 0. |
code |
int
|
See the API Code Documentation for details. |
status |
int
|
0: verified other: not verified |
Source code in actions\util.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
clean_conf()
Clean current config and restore system default settings
Note
- This interface will clear the current settings and restore to the system default settings
Returns:
| Name | Type | Description |
|---|---|---|
code |
int
|
See the API Code Documentation for details. |
Source code in actions\util.py
76 77 78 79 80 81 82 83 84 85 86 | |
clean_warn()
Clean the warn
Returns:
| Name | Type | Description |
|---|---|---|
code |
int
|
See the API Code Documentation for details. |
Source code in actions\util.py
67 68 69 70 71 72 73 74 | |
connect(port=None, baudrate=None, timeout=None, axis=None, **kwargs)
Connect to arm
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
port
|
port name or ip address, default is the value when initializing an instance |
None
|
|
baudrate
|
baudrate, only available in serial, default is the value when initializing an instance |
None
|
|
timeout
|
timeout, only available in serial, default is the value when initializing an instance |
None
|
|
axis
|
number of axes, only required when using a serial port connection, default is 7 |
None
|
Source code in actions\util.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 | |
delete_blockly_app(name)
Delete blockly app
ArgsP
name: blockly app name
Returns:
| Name | Type | Description |
|---|---|---|
code |
int
|
See the API Code Documentation for details. |
Source code in actions\util.py
200 201 202 203 204 205 206 207 208 209 210 | |
disconnect()
Disconnect
Source code in actions\util.py
22 23 24 25 26 | |
emergency_stop()
Emergency stop (set_state(4) -> motion_enable(True) -> set_state(0))
Note
- This interface does not automatically clear errors. If there is an error, you will need to handle it according to the error code.
Source code in actions\util.py
173 174 175 176 177 178 179 180 | |
reset(speed=None, mvacc=None, mvtime=None, is_radian=None, wait=False, timeout=None)
Reset the xArm
Warning
without limit detection
Note
- If there are errors or warnings, this interface will clear the warnings and errors.
- If not ready, the api will auto enable motion and set state
- This interface does not modify the value of last_used_angles/last_used_joint_speed/last_used_joint_acc
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
speed
|
reset speed (unit: rad/s if is_radian is True else °/s), default is 50 °/s |
None
|
|
mvacc
|
reset acceleration (unit: rad/s^2 if is_radian is True else °/s^2), default is 5000 °/s^2 |
None
|
|
mvtime
|
reserved |
None
|
|
is_radian
|
if the speed and acceleration are in radians or not, defaults to self.default_is_radian |
None
|
|
wait
|
whether to wait for the arm to complete, default is False |
False
|
|
timeout
|
maximum waiting time(unit: second), default is None(no timeout), only valid if wait is True |
None
|
Source code in actions\util.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
run_blockly_app(path, **kwargs)
Run the app generated by xArmStudio software
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
app path |
required |
Source code in actions\util.py
182 183 184 185 186 187 188 189 | |
run_gcode_app(path, **kwargs)
Run gcode project file by xArmStudio software
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
gcode file path |
required |
Returns:
| Name | Type | Description |
|---|---|---|
code |
int
|
returned result is only corrent when code is 0. |
Source code in actions\util.py
229 230 231 232 233 234 235 236 237 238 239 | |
run_gcode_file(path, **kwargs)
Run the gcode file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
gcode file path |
required |
Source code in actions\util.py
191 192 193 194 195 196 197 198 | |
save_conf()
Save config
Note
- This interface can record the current settings and will not be lost after the restart.
- The clean_conf interface can restore system default settings
Returns:
| Name | Type | Description |
|---|---|---|
code |
int
|
See the API Code Documentation for details. |
Source code in actions\util.py
88 89 90 91 92 93 94 95 96 97 98 99 | |
send_hex_cmd(datas, **kwargs)
Hexadecimal communication protocol instruction
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
datas
|
Hexadecimal data_list |
required | |
timeout
|
timeout: wait timeout, seconds, default is 10s. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
out |
Hexadecimal data_list or code |
|
code |
int
|
See the API Code Documentation for details. Note: code 129~144 means modbus tcp exception, the actual modbus tcp exception code is (code-0x80), refer to Standard Modbus TCP |
Source code in actions\util.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
set_reduced_mode(on)
Turn on/off reduced mode
Note
- This interface relies on Firmware 1.2.0 or above
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
on
|
True/False such as: Turn on the reduced mode : code=arm.set_reduced_mode(True) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
code |
int
|
See the API Code Documentation for details. |
Source code in actions\util.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
set_servo_attach(servo_id=None)
Attach the servo
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
servo_id
|
1-(Number of axes), 8, if servo_id is 8, will attach all servo
2: 8: attach all joints
|
None
|
Returns:
| Name | Type | Description |
|---|---|---|
code |
int
|
See the API Code Documentation for details. |
Source code in actions\util.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
set_servo_detach(servo_id=None)
Detaches the servo, be sure to do protective work before unlocking to avoid injury or damage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
servo_id
|
1-(Number of axes), 8, if servo_id is 8, will detach all servo
2: 8: detach all joints, please
|
None
|
Returns: code (int): See the API Code Documentation for details.
Source code in actions\util.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
system_control(value=1)
Control the xArm controller system
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
1: shutdown 2: reboot |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
code |
int
|
See the API Code Documentation for details. |
Source code in actions\util.py
116 117 118 119 120 121 122 123 124 125 126 127 128 | |