Closed sansoy closed 1 year ago
hi @sansoy , can you print the cmd string send in the self.send(cmd).
ROUTINE SET_DOUT(cmd: STRING): STRING
----------------------------------------------------
-- Function: Sets digital out.
-- cmd string should follow the below format:
-- 'setdout:n:value'
-- n: a single digit number
-- value: 'true' or 'false' (lowercase)
----------------------------------------------------
-- Arguments:
-- cmd [IN]: command string.
----------------------------------------------------
-- Return value: response string.
----------------------------------------------------
VAR
dout_num: INTEGER
dout_val: STRING[8]
BEGIN
-- Get DOUT number
CNV_STR_INT(SUB_STR(cmd, 9, 1), dout_num)
-- Get DOUT value
dout_val = SUB_STR(cmd, 11, STR_LEN(cmd) - 10)
IF dout_val = 'true' THEN
DOUT[dout_num] = TRUE
resp = '0:success'
RETURN(resp)
ENDIF
IF dout_val = 'false' THEN
DOUT[dout_num] = FALSE
resp = '0:success'
RETURN(resp)
ENDIF
resp = '1:wrong-dout-value'
RETURN(resp)
END SET_DOUT
as you see in the SET_DOUT function in the mappdk_cmd.kl, these line:
-- Get DOUT number
CNV_STR_INT(SUB_STR(cmd, 9, 1), dout_num)
-- Get DOUT value
dout_val = SUB_STR(cmd, 11, STR_LEN(cmd) - 10)
make sure that the position of the value in the cmd string is the same.
that's my understanding of the problem
@sansoy there was a bug. Previously, SET_DOUT and GET_DOUT routines accepted only 1-digit values as numbers. I have now fixed the new version and updated the .pc files. Can you please upgrade fanucpy and change the .pc files? It works on my side on Roboguide.
Please let me know if the error persists, and I will try to handle it later today.
Dude! It all works. Thank you, Thank you, Thank you! Sabri
On Thu, May 25, 2023 at 12:20 AM Agajan Torayev @.***> wrote:
@sansoy https://github.com/sansoy there was a bug. Previously, SET_DOUT and GET_DOUT routines accepted only 1-digit values as numbers. I have now fixed the new version and updated the .pc files. Can you please upgrade fanucpy and change the .pc files? It works on my side on Roboguide.
Please let me know if the error persists, and I will try to handle it later today.
— Reply to this email directly, view it on GitHub https://github.com/torayeff/fanucpy/issues/24#issuecomment-1562406022, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACV24IUVL5636OWQ62O42DXH4B5PANCNFSM6AAAAAAYOAOSZE . You are receiving this because you were mentioned.Message ID: @.***>
My pleasure! I am closing the issue!
in the readme page you have the following for getting/setting DOUT
robot.get_rdo(dout_num=1) robot.set_rdo(dout_num=1, value=True)
should be
robot.get_dout(dout_num=1) robot.set_dout(dout_num=1, val=True) #value should be val
the get_dout function works
but
the set_dout option gives me the following error robot.set_dout(dout_num=104, val=True) File "..fanucpy/Robot.py", line 289, in set_dout self.send_cmd(cmd) File "..fanucpy/Robot.py", line 98, in send_cmd return self.handle_response(resp) File "..fanucpy/Robot.py", line 62, in handle_response raise Exception(msg) Exception: wrong-dout-value