Cobot moves takes longest posible route to waypoint even with get_inverse_kin()

My code works up until the point where it moves to the calculated Origin. At this point instead of moving the one inch the the Origin, the arm does a 360. i want to know what I am doing wrong here or how it can be fixed. A snippet of my code will be placed below for reference.

what is the value of approach_general? is this a “waypoint” variable with a approach_general_p AND approach_general_q? or is this a variable you assigned in urscript?

movej takes a position argument in the form of joint positions in rad (ie - “[base, shoulder, elbow, w1, w2, w3]”). That being said; you CAN pass it a pose value (ie “p[x,y,z,rx,ry,rz]”) and it will do the inverse kinematics automatically.

However, I do not know what it does under the hood. try specifying the qnear=get_current_joint_pos() if your approach_general variable is infact a polyscope “waypoint”. like this:

movej(get_inverse_kin(origin, qnear=get_actual_joint_positions()))

edit: here is the script manual docs for get_inverse_kin():

Thanks for the reply! Yes approach_general is defined earlier in the program as a waypoint. I tried using the get_inverse_kin in the past and had no luck. It still tries to go in a full circle.

i think youre changing the x,y,z of origin with the results from the robotiq find surface, but youre not updating the rx,ry,rz which i assume are the rx,ry,rz from the OG approach_general

Yeah I thought that too but when I enter the values that are closest to what those values should be which is pi, 0, 0. THose values are displayed on the teach pendant when im close to where Origin should be located.

Also if that were the case, one of the four times that I tell it to move to approach_general in the program it sould do the 360, no?