Variables
abb_rws_client_python_rw6.highlevel.variables
High-level RAPID variable read/write for ABB RWS RobotWare 6.
Author: Clement RACINET
Composed operations built exclusively from atomic rws/ functions.
No HTTP calls are made directly in this module.
All functions are async and require an open RWSClient instance.
get_variable(client, *, symbolurl)
async
Read a RAPID variable value.
Wraps get_rapid_symbol_data and extracts the value field
from the response body.
Route (delegated): GET /rw/rapid/symbol/data/{symbolurl}
ABB constraints
- No mastership required for reads.
symbolurlformat:RAPID/T_ROB1/MainModule/my_var
| Parameters: |
|
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
Example
async with RWSClient(host="192.168.125.1") as client:
val = await get_variable(
client,
symbolurl="RAPID/T_ROB1/MainModule/counter",
)
print("counter =", val)
Source code in abb_rws_client_python_rw6/highlevel/variables.py
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 240 241 242 243 244 245 246 247 248 249 250 251 | |
set_variable_with_mastership(client, *, symbolurl, value, domain='rapid')
async
Write a RAPID variable value, acquiring and releasing mastership.
Composes:
post_mastership_domain_request(domain, action="request")update_rapid_variable_current_value(action="set", value=value)post_mastership_domain_release(domain, action="release")
Mastership is always released in a finally block, even if
the write fails, to avoid leaving the controller locked.
Route (delegated):
- POST /rw/mastership/{domain} (action=request)
- POST /rw/rapid/symbol/data/{symbolurl} (action=set)
- POST /rw/mastership/{domain} (action=release)
ABB constraints
- Requires AUTO mode for mastership.
symbolurlformat:RAPID/T_ROB1/MainModule/my_vardomainmust be one of:"rapid","cfg","motion".
| Parameters: |
|
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
Example
async with RWSClient(host="192.168.125.1") as client:
await set_variable_with_mastership(
client,
symbolurl="RAPID/T_ROB1/MainModule/target_x",
value="250.0",
)
Source code in abb_rws_client_python_rw6/highlevel/variables.py
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 | |
set_variables_with_mastership(client, *, values, domain='rapid')
async
Write multiple RAPID variables while holding mastership once.
Requests mastership a single time, writes every symbolurl -> value
pair sequentially, then releases mastership in a finally block.
More efficient than calling set_variable_with_mastership in a
loop, which would request/release mastership once per variable.
Route (delegated):
- POST /rw/mastership/{domain} (action=request)
- POST /rw/rapid/symbol/data/{symbolurl} (action=set), once per entry
- POST /rw/mastership/{domain} (action=release)
ABB constraints
- Requires AUTO mode for mastership.
domainmust be one of:"rapid","cfg","motion".
| Parameters: |
|
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
Example
async with RWSClient(host="192.168.125.1") as client:
await set_variables_with_mastership(
client,
values={
"RAPID/T_ROB1/M/x": "1",
"RAPID/T_ROB1/M/y": "2",
},
)
Source code in abb_rws_client_python_rw6/highlevel/variables.py
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 | |