Hello,
I am working on an application in which I am attempting to adjust the pick and place waypoints via an Allen Bradely HMI. I have successful communications bringing values, representing the desired offset, over to the UR. I use these Offeset values in the following UR code to apply them to a base waypoint and then move to the resulting variable waypoint.
OffsetX:=read_float_input_register(0)/1000
OffsetY:=read_float_input_register(1)/1000
OffsetZ:=read_float_input_register(2)/1000
OffsetPose:=p[OffsetX,OffsetY,OffsetZ,0.00,0.00,0.00]
VarWaypoint:=pose_add(BaseWaypoint, OffsetPose)
MoveJ
----VarWaypoint
Doing this results in an attempted move to the correct point in space however it inverts the elbow angle which results in a crash into other equipment in the area. If I do a move to the BaseWaypoint position the elbow moves upward and remains clear.
Any theory as to why the UR would treat a variable waypoint differently than a fixed waypoint of the same coordinates? Suggestions on how to constrain the elbow movement to remain clear of other equipment. I know there are ways to create protected space, but I am not sure how that would affect moves.
Thanks!
Does hitting the checkbox in that MoveJ to “use joint angles” do anything for you?
I tried selecting “use joint angles” a couple of times however it did not help. I did figure out how to use the get_inverse_kin(). and after some investigative work I found the correct angles for “qnear” and got this to work. The code looks like this:
OffsetX:=read_float_input_register(0)/1000
OffsetY:=read_float_input_register(1)/1000
OffsetZ:=read_float_input_register(2)/1000
Qnear:=[0.112,-2.3014,-0.552,-1.248,-1.478,-1.552)
OffsetPose:=p[OffsetX,OffsetY,OffsetZ,0.00,0.00,0.00]
BasePosePlusOffset:=pose_add(BaseWaypoint, OffsetPose)
VarWaypoint:=get_inverse_kin(BasePosePlusOffset, Qnear)
MoveJ
----VarWaypoint
To find the values for Qnear I had to move the UR to my base position that I knew worked and then read out the current joint angles into a variable that I then copied over by hand for use in the live code. Oddly the joint angles shown in the user interface for editing positions resulted in the same crash as before. So, I am guessing the reference frame for the joint angles used in a variable waypoint and those used in a fix waypoint are different? or some variation on that idea.
Last note, the UR script manual was helpful in figuring out the sintax for get_inverse_kin.
Glad you got it working. If you were curious, you could save the program with the fixed waypoint as something, then change it to variable and save it as something else. Then you can insert a script node, choose file, and open both programs and inspect the script that it generated and see if you can spot any differences.