Home› Programming
Discussion
Back to discussions page
VT_340
Posts: 24 Apprentice
How can I make a UR5 draw arcs and circles? |
7.4K views
|
Answered | |
/ Most recent by matthewd92
in Programming
|
37 comments |

Hi!
I want to make the UR5 make draw random lines, arcs and circles on a piece of paper. My approach for that so far was to generate the geometry in Processing (Java for creatives..) and send points via TCP as moveP commands. The problem is that for example I was not able to make a smooth motion, even with a small blend radius and high "solution" up to 50 points per arc. Any idea how this problem is solved? Would also use ROS or other solutions asI am in a early project-phase and just want to collect potential ways how to do it.
Thanks in advance.
I want to make the UR5 make draw random lines, arcs and circles on a piece of paper. My approach for that so far was to generate the geometry in Processing (Java for creatives..) and send points via TCP as moveP commands. The problem is that for example I was not able to make a smooth motion, even with a small blend radius and high "solution" up to 50 points per arc. Any idea how this problem is solved? Would also use ROS or other solutions asI am in a early project-phase and just want to collect potential ways how to do it.
Thanks in advance.
Tagged:
You could also place the get_inverse_kin() function inside the servoj function to use TCP coordinates and calculate the required joint positions. I have done that before successfully.
Well documentation is a bit poor sometimes but I figured it out myself.
You can just send s.th like this via TCP:
This must be sent as one string while the spaces for the blocks must be included. Once code is sent to port 30002 the program starts automatically. Don't forget to add a line feed (10) at the end of your string, otherwise it won't work properly.
Thanks and greetings from germany.
Thanks in advance!
servoj(get_inverse_kin(-0.028682, -0.467049, 0.05000001, -3.14159274, 0.00000000, 0.00000000), t = 0.05)
This lines results in a a popup-error claiming this:
"TypeError: get_inverse_kin() takes at most 4 arguments (6given)"
Seems lik a bug or something, a pose consists of 6 floats .. no?
VT
Change your line to read:
Let me know if you have any issues with that.
http://www.zacobria.com/universal-robots-knowledge-base-tech-support-forum-hints-tips/python-code-example-of-converting-rpyeuler-angles-to-rotation-vectorangle-axis-for-universal-robots/
Do you need realtime change of your path? Or is it OK to once generate your trajectory and then just give the robot a go to perform a certain movement?
You can use ROS to do this, or just use python or whatever to once send the driver-program to the robot and then send poses or joint values via TCP by your realtime application. (like I did)
hi, Matthew,VT_340,
I am trying to control ur5 running through a trajectory in windows. I want to use the script function:servoj(), but my data format is based on the tool space(a vector:X,Y,Z,RX,RY,RZ), so I need to translate the data to joint space. I found the ur5 script manual, and one of the functions that i can give is called get_inverse_kin(). if i have a c++ program running on an external pc, and i send this command to the ur5 to get the joint position, then try to use the servoj to servo ur5 to the joint position.
but the robot had no response.Followed my script code:
Could you help me out?
Tom
This can be tricky, because you need to take care of the exact syntax. Look how my Python script looks like:
cmd_str = "def socketdriverProg(): " + "\n"
...
cmd_str += " " + "if q[6] == 2.0:" + "\n"
...
In the end I send the program as one long string to the port.
my_str="def trajPlan():\n ";
my_str+= " servoj(get_inverse_kin(p[-0.028682, -0.467049, 0.0500, -3.14159, 0, 0], t = 5)\n";
my_str+= "end\n";
Then I send the program as one long string to the port (tried both 30002 and 30003 ), but the robot still had no response. Was something wrong?
As I wrote you need to take care of the characters, including the whitespace character. URScript works like Python so whitespace character is an issue so thats why I included them in my string.
Make your program easier for beginning just to see if the syntax is correct:
my_str="def testPopUp():\n ";
my_str+=" ";
my_str+= "popup(\”Messages\”, title=\”The Headline in the Blue box\”, blocking=True)\n";
my_str+= "end\n";
The exact syntax I don't know because I don't know much about c++
the former motion function:
I had the same problem as you but I couldn't fix it. I am trying to publish a path including many points for UR5 and execute them by using Servoj.
In this regard, I defined a talker to translate a gcode file to robot positions and publish them one by one. But I still have jerks in each point (the same as using Move commands). As I read in UR5 document, the main shape of servoj command is as below:
< servoj(q, a, v, t=0.008, lookahead_time=0.1, gain=300) >
I think my problem is related to calculating time. Why did you choose t=0.05 sec? And how should I define it to prevent unwanted stopping or jerky movements for each point?
I think there is a reason why ROS controls the UR robot in the way it does: It uploads a URScript program to the robot which opens a port for sending data to AND is solving the jerk issue by using threads. I never really understood how it works, but it works. Check it out on Github. I don't know if there are other ways to solve the problem, but in general the UR-Robots are made for Pick-And-Place tasks.. if you want to go beyond that, it is possible, but not well documented and it can become tricky.
I tested different times and I chose t = 0.1 as a candidate. It produces less fluctuation for movements. I hope that I can find out the logic behind this.