Ok guys, I have a camera that sends X,Y and part rotation through tcp\ip socket connection to the UR5. Now i need to know how to make a position variable and move to it.
EOAT rotation
-
Trowathegodofdeath -
October 23, 2014 at 8:23 PM -
Thread is Unresolved
-
-
Here is some sample code for PolyScope for how you might do this:
Code
Display MoreProgram Init Variables list = [0,0,0,0] var_1 = False BeforeStart cp≔Tool MoveJ cp Robot Program MoveJ Home Loop var_1≟ False var_1≔socket_open("192.168.1.200",30000) list≔socket_read_ascii_float(3) If list[0]≟3 socket_send_string("Received") new_pose≔p[list[1],list[2],0.0,d2r(0),d2r(0),list[3]] MoveL new_pose Halt sync()
Good luck!!
-
Is there anyway to take a pose position (p[.800, .456, .255, 0,0,0]) and turn it into a joint position, add in the rotation of wrist 3, then convert it back into a pose position?
Ok, is cp:=Tool a variable or script? I put it in as a variable and the robot says its not valid. And will i have to change my math that i used to get the X and Y positions since i based them off the base feature instead of Tool?
-
You can use the script function get_inverse_kin(x) where x is a pose to get the joint angles
See example below (not actual code) e.gCodelist = get_inverse_kin(pose) " Use the assigments option on the advanced tab list[2] = list[2] + d2r(30) " add 30 degrees to the elbow angle. d2r converts degrees to radians, this line would be a script MoveJ list "change waypoint to variable to move to list
in "cp = Tool" is not script you create cp using the assigments option and set to to the Tool pose.
You do not necessarily have to base them off of the base frame. If you can define the camera grid plane as a pose w.r.t the base feature then you can move w.r.t that plane using the pose_trans script function.e.gCodeplane_wrt_base = p[0.3,0.3,0.3,3.14,0,0] pose_wrt_plane = p[0.1,0.1,0,0,0,1.57] pose_wrt_base = pose_trans(plane_wrt_base, pose_wrt_plane) "returns pose w.r.t base frame movel(pose_wrt_base) " script line
Hope this helps. Good luck! -
I have it now. Thanks guys. My problem was also with dereferencing variables in sub-programs.