torayeff / fanucpy

Python Interface for FANUC robots
Apache License 2.0
109 stars 29 forks source link

null response to commands other than .connect() #12

Closed bigeetea closed 2 years ago

bigeetea commented 2 years ago

image

I am having a problem running on V7.20-1 Controller. The Robot Controller is not returning a response for methods other than connect().

Take a look at the screen shot and you will see the "curpos" command and empty response:

cmd.encode(): b'curpos\n' resp:

The empty response is what is causing the exception when trying to split(":")

I have tried many things, but nothing seems to get a response.

Any ideas?

FYI - the success line at the top of the screen shot is the call to connect() .. and the Robot2 class is my copy of your class just with some print statements for debugging

torayeff commented 2 years ago

Can you please try decreasing string length from 254 to 128 in all of the .kl files? I assume that might be the problem for controller versions v7.x

bigeetea commented 2 years ago

Yes - I forked your project and fixed all the build errors for V7.2 i.e. class or variable names longer than 12 chars and strings set to 128. The software is definitely running on the Robot Controller, and the .connect() method appears to work, however other commands (move, curpos, curjpos, etc) don't move the robot and don't return a response.

torayeff commented 2 years ago

Can you try this simple command: print(f"Get gripper state: {robot.get_rdo(7)}")

We can start debugging from there.

bigeetea commented 2 years ago

same result -- I have attached sample code and stacktrace

image

image

bigeetea commented 2 years ago

No difference if when I use your main branch directly -- sample code --

image

image

bigeetea commented 2 years ago

image

image

The only difference I have found between your instructions and my v7.2 controller is: No ability to set port number on Server Tag:

image

torayeff commented 2 years ago

Can you add the following command on line 66 in mappdk_server.kl: WRITE(resp, CR) It will output the resp on teach pendant. Let’s see whether we can get the output there.

bigeetea commented 2 years ago

Where should I see the output? Should it be on the User screen under the sentence "MAPPDK SERVER started" ?? Because I"m not seeing anything on the User screen:

image

For reference, here is all I changed in my fork to make your project compile and run on V7.2

https://github.com/bigeetea/fanucpy/pull/2/files

torayeff commented 2 years ago

Whenever you run any command from python, it should be visible after MAPPDK SERVER started.

bigeetea commented 2 years ago

you said python in your last comment.. I think you meant Karel since we're still talking about mappdk_server.kl .... correct?

bigeetea commented 2 years ago

I figured out why I didn't see anything on the User screen... we aren't taking the ELSE side of the logic:

image

bigeetea commented 2 years ago

cmd is definitely uninitialized

image

torayeff commented 2 years ago

You should put: WRITE("RESP:", resp, CR) here: https://github.com/torayeff/fanucpy/blob/1a2141af4abaceac82b93738e815982b9bda228f/src/fanuc-driver/mappdk_server.kl#L66

Then call Python command such as: print(f"Get gripper state: {robot.get_rdo(7)}")

Please check if the above works and we can continue debugging from there.

bigeetea commented 2 years ago

same result .. nothing except "MAPPDK SERVER started" is ever printed .. the reason is because we never run line # 66

the reason is because cmd is uninitialized, so we never go into the ELSE side of that logic.. it always runs line # 62 and # 63

        IF UNINIT(cmd) THEN
            keep_conn = FALSE
bigeetea commented 2 years ago

I believe the problem is something inside of mappdk_comm.kl OPEN_COMM method... it has something to do with line # 48

MSG_CONNECT(server_tag, status)

...something isn't happening correctly with that upon startup

I'd be happy to share my screen via zoom and pair debug this issue if you'd like.

torayeff commented 2 years ago

It seems there is a small typo in this line. Can you please also change it to: '$HOSTS_CFG[' + server_str + '].$SERVER_PORT'