Hello all,
I tried to develop the function which expresses the tool_speed with respect to a frame in the robot base. The goal is to use the speedl function whatever the frame (working_frame, tool_frame…)
The job for the cartesian speed projection in the robot base was done by @ajp .
I got the same logic for the rotation. The rotation is expressed in “rotation vector” formalism for ur robots. A bit of vocabulary about wikipedia : Axis-Angle & rotation vector:
- axis-angle = [(ex, ey, ez), angle] , e is the vector which defines the rotation (expressed in a frame)
- axis_with_angle_magnitude = rotation_vector = [ex * θ, ey * θ, ez * θ]
Like the cartesian speed vector the rotation is a vector. I used the same method as the cartesian speed vector.
Diagram :
Below the script function :
def get_speed_wrt_base(tool_speed, frame_wrt_base):
# convert tool_speed expressed in the frame_wrt_base in the robot base frame
# examples :
# speed_wrt_base([0.020, 0.020,0,0,0,0], plane_1)
# speedl(get_speed_wrt_base([0,0,0.02,0,0,1.57], get_actual_tcp_pose()),a=1,t=0.5,aRot=4))
#### input arguments
# tool_speed : [Tx, Ty, Tz, Rx, Ry, Rz] spatial vector list - Txyz [m/s]), Rxyz [rad/s]
# frame_wrt_base : pose
#### output arguments
# speed_wrt_base : [Tx, Ty, Tz, Rx, Ry, Rz] spatial vector list - Txyz [m/s]), Rxyz [rad/s]
# Translationnal speed vector calculus
T_wrt_frame=p[tool_speed[0],tool_speed[1],tool_speed[2],0,0,0]
T_wrt_base_raw= pose_trans (frame_wrt_base, T_wrt_frame)
T_wrt_base=pose_sub(T_wrt_base_raw,frame_wrt_base)
# Rotationnal speed vector calculus
R_wrt_frame=p[tool_speed[3],tool_speed[4],tool_speed[5],0,0,0]
R_wrt_frame_abs=norm([R_wrt_frame[0],R_wrt_frame[1],R_wrt_frame[2]])
if R_wrt_frame_abs != 0: # test if zero vector
R_wrt_base_raw=pose_trans(frame_wrt_base, R_wrt_frame)
R_wrt_base=pose_sub(R_wrt_base_raw, frame_wrt_base)
else:
R_wrt_base=p[0,0,0,0,0,0]
end
# Concatenate T and R
speed_wrt_base_list=[T_wrt_base[0],T_wrt_base[1],T_wrt_base[2],R_wrt_base[0],R_wrt_base[1],R_wrt_base[2]]
return speed_wrt_base_list
end
The speedl function can be used wit this new calculated spatial vector. Example for a screwing move along the Z TCP (whatever the TCP postion and orientation) :
speedl(get_speed_wrt_base([0,0,0.02,0,0,1.57], get_actual_tcp_pose()),a=1,t=0.5,aRot=4))
The function works with any working_frame.
Do not hesitate to give me feedback…