get_tcp_force() returns a list of the 6 forces, Fx, Fy, Fz, Tx, Ty, Tz, then all you need to do is get the one you want with something like this pseudo code
local forces = get_actual_tcp_force()
local Fz = forces[2]
The thing to remember is that UR gives those forces in base coordinates, so the Z axis is the base Z, not the tool flange Zthe force() function returns the normal value of the vector of the forces so as you change the orientation of the tool that vector will change but the normal value of the vector should stay the same.
Also, you can zero out the sensor before you use it for measurement which will make the vector more accurate since it will take out the effect of gravity on any vector that is not parallel with the Z axis (assuming the robot is mounted in a vertical way). The command for zeroing the sensor is zero_ftsensor(). We generally have a wait before we zero, generally use a command like the one below to ensure that the robot has steadied itself and then we will fire the zero command and go on with the program
# Commands that get us close to where we want to use the force
while (not is_steady()):
sync()
end
zero_ftsensor()
# Commands where we use the force
Hello everyone,
as the title says, I would like to access the force of the tools z-Axis on my UR5e. Saying that, the task my robot has to accomplish is to press lots valves into drillings. The force here has to be at a level of 50 newtons. Once that is reached the robot has to stop and go back to its original position, as this means that the valve has already been pressed into the drilling successfully.
As every drilling has got a different position and more importantly different angles, im having problems with just grabbing the current value of the "force()" function, as it seems to calculate a three dimensional force vector. The "force()" function works perfectly fine as long as the drillings are in a vertical position. However, as soon as they are not in a vertical position, meaning angles are involved, the "force()" function does not fulfill my requirements. Hence i would like to have access to the tools z-Axis force component only, as its always oriented exactly vertically to the tool.
I am using a C# program, that writes a .script language program, which gets sent to the UR5e by Ethernet (Port 30002). Here's a minimized example of what Im sending to the UR5e (i've deleted some parts which, in this matter, are not neccessary). Also i've marked the crucial parts:
So, basically all I want to do is to replace "if ( force ()<50):" with something like "if (Fz_Tool < 50):". However, I could not find a way to achieve this yet. Also, if somebody knows the .script language command on how to grab the force of the tools z-Axis it would help me most. However, a polyscope (.urp) command would also be helpful as then it could executed and thus translated into the corresponding .script language file.