torayeff / fanucpy Goto Github PK
View Code? Open in Web Editor NEWPython Interface for FANUC robots
License: Apache License 2.0
Python Interface for FANUC robots
License: Apache License 2.0
@torayeff, again Thank you for this awesome repository and your help and response in earlier issues.
I am working on a welding scenario, so I want to make a function for the welding like robot.gripper(True)
from your code, is it possible to give me some instructions or information on how you made the gripper function?
Hello, @torayeff , Hello, I have an inquiry about how the GET_CURPOS work,
as I understand if I set up a specific USERFRAME according to my need, then I just need to send the positions value according to my userframe. however, every time I use robot.move function with a position in my modified userframe it gives me a 'position-is-not-reachable' error.
So I moved my robot manually to the 0,0,0 position in my userframe, and used the GET_CURPOS function to retrieve my robot position, but the position retrieved is not the same as my userframe , the other userframe , or toolframe. so on which userframe or coordinate does GET_CURPOS is based on?
and in general how i can make robot.move to move the robot on my userframe.
I hope you can give any help or advice, I am still a novice so any help will be great for me.
Hi torayeff, I'm having trouble sending commands to my Fanuc robot through MAPPDK. I'm fairly certain it has little to do with your driver and more with network communication, but maybe you've ran into similar issues while coding or testing the driver.
I went through all of the instructions in the FANUC MAPPDK Driver readme, and MAPPDK is (apparently) running fine on my controller. The only part I've skipped is the logger on port 18736 (for now). The robot (CRX-10ia) and the laptop from which I want to issue commands through fanucpy (an Ubuntu machine) are in the same subnet, with IPs ending with .10 and .100 as in the readme. I've disabled DHCP via the teach pendant.
With all that set up, I try running a sample python file to send a command to the robot and get this error:
File "/home/wherever my script is/test.py", in connect
self.comm_sock.connect((self.host, self.port))
ConnectionRefusedError: [Errno 111] Connection refused
The machines see each other and can ping between them.
Is it possible, to get the current joint velocities and accelerations similar to robot.get_curjpos
?
Is there maybe a custom command one can send or a routine one can define?
Thank you
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
Hi,
I'm using Robotiq's Dual Adapter for two types of sanders and need to activate/deactivate both of them separately.
I'm trying to figure out how to instantiate two separate DO (not RDO), ie 101 & 104.
I noticed in robot.py the "setdo" command for the gripper so i created set/get methods for DO, ie
def get_do(self, do_num: int):
"""Get DO value.
Args:
do_num (int): DO number.
Returns:
do_value: DO value.
"""
cmd = f"getdo:{do_num}"
_, do_value = self.send_cmd(cmd)
do_value = int(do_value)
return do_value
def set_do(self, do_num: int, val: bool):
"""Sets DO value.
Args:
do_num (int): DO number.
val (bool): Value.
"""
if val:
val = "true"
else:
val = "false"
cmd = "setdo" + f":{self.ee_DO_num }:{val}"
self.send_cmd(cmd)
However, when run it I get the following message "WRONG COMMAND setdo:104:true".
Any thoughts/help would be appreciated.
Sabri
Hi,
I am trying to test your library on an old RJ3iB. Is there a way to define/determine the port using the teach pendant as well as the ee_DO_type and ee_DO_num? Do you know how to do it or do you have any related resources?
I currently can read the position of the arm with a code of my own:
import requests
from bs4 import BeautifulSoup
from time import sleep
while(1):
r = requests.get("http://192.168.1.6/MD/CURPOS.DG")
soup = BeautifulSoup(r.text, "html.parser")
text = soup.text
poses = list()
for i in range(1,7):
position_init = text.find(str('Joint ' + str(i) + ':')) + 11
position_end = text[position_init:].find('\n')
poses.append(float(text[position_init:position_init + position_end]))
print(poses)
sleep(0.01)
Thank you
Hello, I have a question to ask.
I am simulating an arm using ROBOT GUIDE on computer A. On computer A, I can execute robot.move() locally. On another computer B within the same network, I can successfully execute robot.get_curjpos() as well.
However, when I attempt to execute robot.move() on computer B, Python does not raise an error, but on computer A's ROBOT GUIDE, I encounter an error message: "INTP-311 (MAPPDK_SERVER,204) Uninitialized." Could you please help me understand the reason behind this?
In the line 24
VAR
.....
uframe_str: STRING[1]
tool_str: STRING[1]
This STRING[1] should be STRING[2] or STRING[254],because the out of function CNV_INT_STR() is more than STRING[1],it conclude a blank space.
In the line 53
CNV_INT_STR(UFRAMENUM, 1, 0, uframe_str)
CNV_INT_STR(TOOLNUM, 1, 0, tool_str)
the mistake will make uframe_str=' ' and tool_str=' ',you can not set the correct MNUFRAME and MNTOOL by
GET_VAR(entry, 'SYSTEM', '$MNUFRAME[1, ' + uframe_str + ']', $GROUP[1].$UFRAME, status)
GET_VAR(entry, 'SYSTEM', '$MNUTOOL[1, ' + tool_str + ']', $GROUP[1].$UTOOL, status)
My English is not good , I hope you can understand me.
Hi! Im trying to connect Fanuc LRMate 200id/7L and faced issues with starting a server. I do not have KAREL on my Fanuc, as I understand, .pc files is a compiled binary version of .kl files so I can use .pc files instead. I configured everything as in your guide but still have a problem PRIO-230 Ethernet Adapter error and I cant find the solution of that in manuals. Maybe Im missing something, that you could point
Im new to fanuc and industrial robots and have to learn it to educational purposes
The controller refuses the 'Move' commands on 'Auto' mode and needs some correction for the R-30iB Mate Plus controller.
Hello
I am working on Fanuc CR-4iA robot, when I am trying to move the last joint or yaw value of the robot, it is always going to zero. I just printed the cmd that is sending to the robot from Robot.py , and it is having the value i am giving. The reading of the joint values are proper, but when we command last value it is always setting zero.
We can manually jog the joint using teach pendent, and can read the values as well.
I think some settings in Karel code may be wrong, can you give some insights about the same if possible ? @torayeff . This is 6 axis robot.
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
Good job! I'm just wondering - is there a plan to publish this stuff to PyPI, so one can install it using pip? Thanks.
Right now, there is a gripper
method to control the gripper. However, there is no possibility to read back the gripper's (DO) state.
These days, a lot of libraries use type hints (PEP 484) as it improves the experience of developers during coding, and mainly it makes the code more robust (can be checked by mypy
within CI). It would be nice if fanucpy
could be PEP 484 (and 561) compatible.
fanucpy/src/fanuc-driver/mappdk_comm.kl
Line 40 in 1a2141a
Hello
Can we omit the mappdk_logger and start only with mappdk_server to interact with the robot? Can you explain what will be the after-effects if we are not using the logger?
Also, any methods to start and stop the running mappdk_server after some time in the TP code?
Right now, the handle_response
raises Exception
:
Line 61 in 27a70d1
which is probably not a good practice. I propose to define at least one library-specific exception and optionally other derived exceptions... Something like this:
class FanucPyException(Exception):
pass
class CommException(FanucPyException)
pass
Which will allow me (in the application code) to catch just the specific exception raised by the library, instead of the generic one.
Thanks for your consideration.
The FANUC CRX robot models come equipped with internal force sensing.
https://crx.fanucamerica.com/collaborative-robot-accessories/fanuc-force-sensing/
Can i use fanucpy to detect this force?
Hello, @torayeff ^_^,
I want to get The DH parameters and the joint limits of the robot arm I am controlling with Fanucpy. so is there a specific function in Karel or the TP language, that I can call it from my code and retrieve the DH parameters and Joint limits?
and Since I am using Roboguide, I can use any arm version, if there is any way to get any arm DH parameters and Joint limits. I just use that specific arm.
Hello
I have tried to build the Fanuc driver with Roboguide 9.4 and Ktrans version v9.4. I am not able to build 3 Karel files in the driver, please have a look, I am pasting the error below
1. File mappdk_cmd.kl
----------------------------------------------------------------------
Translating C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl
KTRANS Version V9.40 (Build 22 9/23/2022)
Copyright (C) FANUC America Corporation, 1985 through 2022.
All Rights Reserved.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(10)
10 ROUTINE GET_CURPOS(cmd: STRING): STRING
^ ERROR
"PROGRAM" expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(10)
10 ROUTINE GET_CURPOS(cmd: STRING): STRING
^ ERROR
Id expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(10)
10 ROUTINE GET_CURPOS(cmd: STRING): STRING
^ ERROR
";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(10)
10 ROUTINE GET_CURPOS(cmd: STRING): STRING
^ ERROR
"BEGIN" expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(10)
10 ROUTINE GET_CURPOS(cmd: STRING): STRING
^ ERROR
";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(10)
10 ROUTINE GET_CURPOS(cmd: STRING): STRING
^ ERROR
Invalid statement or "ENDxxx" or "UNTIL" expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(10)
10 ROUTINE GET_CURPOS(cmd: STRING): STRING
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(10)
10 ROUTINE GET_CURPOS(cmd: STRING): STRING
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(10)
10 ROUTINE GET_CURPOS(cmd: STRING): STRING
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(10)
10 ROUTINE GET_CURPOS(cmd: STRING): STRING
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(19)
19 VAR
^ ERROR
Invalid statement or "ENDxxx" or "UNTIL" expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(19)
19 VAR
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(20)
20 resp: STRING[254]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(20)
20 resp: STRING[254]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(20)
20 resp: STRING[254]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(20)
20 resp: STRING[254]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(20)
20 resp: STRING[254]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(21)
21 out: STRING[254]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(21)
21 out: STRING[254]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(21)
21 out: STRING[254]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(21)
21 out: STRING[254]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(21)
21 out: STRING[254]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(22)
22 cpos: XYZWPR
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(22)
22 cpos: XYZWPR
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_cmd.kl(23)
23 BEGIN
^ ERROR
Invalid statement or "ENDxxx" or "UNTIL" expected.
===============Translation not successful===============
Build Failed: Error translating program: Code: 0xFFFFFFFF:
2. File: mappdk_comm.kl
Translating C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl
KTRANS Version V9.40 (Build 22 9/23/2022)
Copyright (C) FANUC America Corporation, 1985 through 2022.
All Rights Reserved.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(11)
11 ROUTINE OPEN_COMM(comm_file: FILE;
^ ERROR
"PROGRAM" expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(11)
11 ROUTINE OPEN_COMM(comm_file: FILE;
^ ERROR
Id expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(11)
11 ROUTINE OPEN_COMM(comm_file: FILE;
^ ERROR
";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(11)
11 ROUTINE OPEN_COMM(comm_file: FILE;
^ ERROR
"BEGIN" expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(11)
11 ROUTINE OPEN_COMM(comm_file: FILE;
^ ERROR
";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(11)
11 ROUTINE OPEN_COMM(comm_file: FILE;
^ ERROR
Invalid statement or "ENDxxx" or "UNTIL" expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(11)
11 ROUTINE OPEN_COMM(comm_file: FILE;
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(12)
12 server_num: INTEGER;
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(12)
12 server_num: INTEGER;
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(12)
12 server_num: INTEGER;
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(13)
13 port_number: INTEGER)
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(13)
13 port_number: INTEGER)
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(13)
13 port_number: INTEGER)
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(13)
13 port_number: INTEGER)
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(24)
24 VAR
^ ERROR
Invalid statement or "ENDxxx" or "UNTIL" expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(24)
24 VAR
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(25)
25 entry: INTEGER
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(25)
25 entry: INTEGER
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(26)
26 status: INTEGER
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(26)
26 status: INTEGER
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(27)
27 resp: STRING[254]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(27)
27 resp: STRING[254]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(27)
27 resp: STRING[254]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(27)
27 resp: STRING[254]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(27)
27 resp: STRING[254]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(28)
28 server_str: STRING[2]
^ ERROR
Invalid statement. ";" or new line expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_comm.kl(28)
28 server_str: STRING[2]
^ ERROR
Too many syntax errors encountered.
===============Translation not successful===============
Build Failed: Error translating program: Code: 0xFFFFFFFF:
----------------------------------------------------------------------
3. File mappdk_utils.kl
KTRANS Version V9.40 (Build 22 9/23/2022)
Copyright (C) FANUC America Corporation, 1985 through 2022.
All Rights Reserved.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_utils.kl(9)
9 ROUTINE TP_CLS
^ ERROR
"PROGRAM" expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_utils.kl(9)
9 ROUTINE TP_CLS
^ ERROR
Id expected.
C:\Users\NITRO\Desktop\fanuc-driver\mappdk_utils.kl(9)
9 ROUTINE TP_CLS
^ ERROR
";" or new line expected.
===============Translation not successful===============
Build Failed: Error translating program: Code: 0xFFFFFFFF:
----------------------------------------------------------------------
In section 2.1.1 you are referencing $HOSTS_CFG
However, in the screenshot in section 2.1.3 you are showing $HOSTC_CFG
Which is it?
Hello,
I send you a vidéo of my problem. I can communicated with the robot but when i need to move an error appear.
Sincerely,
Antoine.
Version 0.1.6 imports sqlalchemy
(see fdf76dd#diff-0f3271fd54afd0487ac6855d92f2de5bf8d815b81d9e70a5eb8f3f7c0d1ed229R5), but the dependency is not declared in pyproject.toml
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.