Skip to content

Commit 67a517b

Browse files
committed
added get_home_path
1 parent 64de9bb commit 67a517b

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

src/abb_robot_client/rws.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,15 @@ def get_ramdisk_path(self) -> str:
363363
res_json = self._do_get("ctrl/$RAMDISK")
364364
return res_json["_embedded"]["_state"][0]["_value"]
365365

366+
def get_home_path(self) -> str:
367+
"""
368+
Get the path of the HOME variable on the controller
369+
370+
:return: The HOME path
371+
"""
372+
res_json = self._do_get("ctrl/$HOME")
373+
return res_json["_embedded"]["_state"][0]["_value"]
374+
366375
def get_execution_state(self) -> RAPIDExecutionState:
367376
"""
368377
Get the RAPID execution state
@@ -432,7 +441,7 @@ def set_digital_io(self, signal: str, value: Union[bool, int], network: str = "L
432441
lvalue = "1" if bool(value) else "0"
433442
payload = {"lvalue": lvalue}
434443
_res = self._do_post("rw/iosystem/signals/" + network + "/" + unit + "/" + signal + "?action=set", payload)
435-
444+
436445
def pulse_digital_io(self, signal: str, duration: int, network: str = "", unit: str = ""):
437446
"""
438447
Pulse a digital IO signal for a specified duration. The signal will be set to ON for the duration and then set back to OFF.
@@ -444,7 +453,7 @@ def pulse_digital_io(self, signal: str, duration: int, network: str = "", unit:
444453
"""
445454
payload = {"lvalue": "1", "mode": "pulse", "Pulses": "1", "ActivePulse": duration}
446455
_res = self._do_post("rw/iosystem/signals/" + network + "/" + unit + "/" + signal + "?action=set", payload)
447-
456+
448457
def get_analog_io(self, signal: str, network: str = "Local", unit: str = "DRV_1") -> float:
449458
"""
450459
Get the value of an analog IO signal.
@@ -488,7 +497,7 @@ def set_group_io(self, signal: str, value: int, network: str = "", unit: str = "
488497
"""
489498
lvalue = str(value)
490499
payload = {"lvalue": lvalue}
491-
_res = self._do_post("rw/iosystem/signals/" + network + "/" + unit + "/" + signal + "?action=set", payload)
500+
_res = self._do_post("rw/iosystem/signals/" + network + "/" + unit + "/" + signal + "?action=set", payload)
492501

493502
def get_rapid_variables(self, task: str = "T_ROB1") -> List[str]:
494503
"""

src/abb_robot_client/rws2.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,15 @@ def get_ramdisk_path(self) -> str:
268268
res_json = self._do_get("ctrl/$RAMDISK")
269269
return res_json["state"][0]["value"]
270270

271+
def get_home_path(self) -> str:
272+
"""
273+
Get the path of the HOME variable on the controller
274+
275+
:return: The HOME path
276+
"""
277+
res_json = self._do_get("ctrl/$HOME")
278+
return res_json["_embedded"]["_state"][0]["_value"]
279+
271280
def get_execution_state(self) -> RAPIDExecutionState:
272281
"""
273282
Get the RAPID execution state
@@ -367,7 +376,7 @@ def set_digital_io(self, signal: str, value: bool | int, network: str = "", unit
367376
else:
368377
url = f"rw/iosystem/signals/{signal}/set-value?mastership=implicit"
369378
_res = self._do_post(url, payload)
370-
379+
371380
def pulse_digital_io(self, signal: str, duration: int, network: str = "", unit: str = ""):
372381
"""
373382
Pulse a digital IO signal for a specified duration. The signal will be set to ON for the duration and then set back to OFF.
@@ -430,8 +439,8 @@ def set_group_io(self, signal: str, value: int, network: str = "", unit: str = "
430439
url = f"rw/iosystem/signals/{network}/{unit}/{signal}/set-value?mastership=implicit"
431440
else:
432441
url = f"rw/iosystem/signals/{signal}/set-value?mastership=implicit"
433-
_res = self._do_post(url, payload)
434-
442+
_res = self._do_post(url, payload)
443+
435444
# def get_rapid_variables(self, task: str="T_ROB1") -> List[str]:
436445
# """
437446
# Get a list of the persistent variables in a task

0 commit comments

Comments
 (0)