@@ -190,36 +190,36 @@ def start(self, cycle: Optional[str] = 'asis', tasks: Optional[list[str]] = ["T_
190190 self .deactivate_task (rob_task .name )
191191
192192 payload = {"regain" : "continue" , "execmode" : "continue" , "cycle" : cycle , "condition" : "none" , "stopatbp" : "disabled" , "alltaskbytsp" : "true" }
193- res = self ._do_post ("rw/rapid/execution/start" , payload )
194-
193+ res = self ._do_post ("rw/rapid/execution/start?mastership=implicit " , payload )
194+
195195 def activate_task (self , task : str ):
196196 """
197197 Activate a RAPID task
198198
199199 :param task: The name of the task to activate
200200 """
201- self ._do_post ("rw/rapid/tasks/activate" , data = {"task" : task })
202-
203- def deactivate_task (self , task : str ) -> None :
201+ self ._do_post ("rw/rapid/tasks/activate?mastership=implicit " , data = {"task" : task })
202+
203+ def deactivate_task (self , task : str ) -> None :
204204 """
205205 Deactivate a RAPID task
206206
207207 :param task: The name of the task to deactivate
208208 """
209- self ._do_post (f"rw/rapid/tasks/{ task } /deactivate" , data = {"task" : task })
209+ self ._do_post (f"rw/rapid/tasks/{ task } /deactivate?mastership=implicit " , data = {"task" : task })
210210
211211 def stop (self ):
212212 """
213213 Stop RAPID execution of normal tasks
214214 """
215215 payload = {"stopmode" : "stop" }
216- res = self ._do_post ("rw/rapid/execution/stop" , payload )
216+ res = self ._do_post ("rw/rapid/execution/stop?mastership=implicit " , payload )
217217
218218 def resetpp (self ):
219219 """
220220 Reset RAPID program pointer to main in normal tasks
221221 """
222- res = self ._do_post ("rw/rapid/execution/resetpp" )
222+ res = self ._do_post ("rw/rapid/execution/resetpp?mastership=implicit " )
223223
224224 def get_ramdisk_path (self ) -> str :
225225 """
@@ -257,9 +257,7 @@ def get_controller_state(self) -> str:
257257 def set_controller_state (self , ctrl_state ):
258258 """Possible ctrl-states to set are `motoroff` or `motoron`"""
259259 payload = {"ctrl-state" : ctrl_state }
260- self .request_mastership ()
261- res = self ._do_post ("rw/panel/ctrl-state" , payload )
262- self .release_mastership ()
260+ res = self ._do_post ("rw/panel/ctrl-state?mastership=implicit" , payload )
263261
264262 def set_motors_on (self ):
265263 """
@@ -326,7 +324,7 @@ def set_digital_io(self, signal: str, value: bool|int, network: str='Local', uni
326324 """
327325 lvalue = '1' if bool (value ) else '0'
328326 payload = {'lvalue' : lvalue }
329- res = self ._do_post (f"rw/iosystem/signals/{ network } /{ unit } /{ signal } " , payload )
327+ res = self ._do_post (f"rw/iosystem/signals/{ network } /{ unit } /{ signal } ?mastership=implicit " , payload )
330328
331329 def get_analog_io (self , signal : str , network : str = 'Local' , unit : str = 'DRV_1' ) -> float :
332330 """
@@ -383,7 +381,7 @@ def get_rapid_variable(self, var: str, task: str = "T_ROB1") -> str:
383381 :param task: The task containing the pers variable
384382 :return: The pers variable encoded as a string
385383 """
386- res_json = self ._do_get (f"rw/rapid/symbol/RAPID/{ task } /{ var } /data" )
384+ res_json = self ._do_get (f"rw/rapid/symbol/RAPID/{ task } /{ var } /data?mastership=implicit " )
387385 state = res_json ["state" ][0 ]["value" ]
388386 return state
389387
@@ -401,14 +399,15 @@ def set_rapid_variable(self, var: str, value: str, task: str = "T_ROB1"):
401399 else :
402400 var1 = var
403401 self .request_mastership ()
404- res = self ._do_post (f"rw/rapid/symbol/RAPID/{ var1 } /data/ " , payload )
402+ res = self ._do_post (f"rw/rapid/symbol/RAPID/{ var1 } /data?mastership=implicit " , payload )
405403 self .release_mastership ()
406404
407405 def read_file (self , filename : str , directory : str = "$HOME" ) -> bytes :
408406 """
409407 Read a file off the controller
410408
411409 :param filename: The relative path to the filename to read, e.g.: $HOME/...
410+ :param directory: The directory to read the file from, e.g. $HOME
412411 :return: The file bytes
413412 """
414413 res_json = self ._do_get_raw (f"fileservice/{ directory } /{ filename } " )
@@ -426,6 +425,7 @@ def upload_file(self, filename: str, contents: str, directory: str = "$HOME") ->
426425
427426 :param filename: The filename to write
428427 :param contents: The file content as str
428+ :param directory: The directory to write the file to, e.g. $HOME
429429 """
430430 url = f"{ self .base_url } /fileservice/{ directory } /{ filename } "
431431 header = {"Content-Type" : "text/plain;v=2.0" }
@@ -692,7 +692,7 @@ def set_speedratio(self, speedratio: float):
692692 :param speedratio: The new speed ratio between 0% - 100%
693693 """
694694 payload = {"speed-ratio" : str (speedratio )}
695- self ._do_post (f "rw/panel/speedratio?mastership=implicit" , payload )
695+ self ._do_post ("rw/panel/speedratio?mastership=implicit" , payload )
696696
697697
698698 # def send_ipc_message(self, target_queue: str, data: str, queue_name: str, cmd: int=111, userdef: int=1, msgtype: int=1 ):
0 commit comments