Use joint load value to stop a loop in a program

Please let me know if I’m asking this question in the wrong place, I am a very new user doing this for a class.

I would like to end a loop when the load of wrist-3 exceeds a certain amp. Here’s some photos to help:

Photo 1 shows the screen where I found current load. it would be nice so when wrist-3 exceeds 0.7A, it ends the program.
Photo 2 shows where I would like to put my expression.
Photo 3 is my options when I tap on the place to write in the expression.

Again I am very new so please be patient. Ultimately I’m trying to use a Gripper to screw in a bottle cap and I would like to set it so it stops turning when it is tight. If there’s a better way to go about this, let me know.

So the robot has a built-in force/torque sensor, which can measure the torque applied in wrist 3 for example. This should be what you want to use. :slight_smile:

Make a thread and assign a variable (ForceVariable). From the Script dropdown menu, you can insert get_tcp_force() in your variable expression. Or write it yourself. This will write the current force applied in all directions and torque in all directions to the variable. Remember to use a Wait or Sync() in the thread to not overload the processor.
Then you can use this variable in your Loop expression such as Loop Until ForceVariable[5] > 2. The [5] isolates the 6th force/torque axis, which is RZ, which corresponds to Wrist 3 in the Tool Feature. :slight_smile:

It is a good idea to zero the FT sensor, before you start the procedure. This is done by executing the script zero_ftsensor() in the air before touching the object. Also, put a wait(0.2) before the zero command.

Thank you so much for the help! I’ve got a question that should help get me going.
How often should I zero the FT sensor? just once every loop, or should it be it’s own thread that updates continuously?

When you zero the FT sensor, it zeroes the values disregarding any force applied to the sensor. So you should only zero it, when you need it at a zero value.
Which is basically right before you will do a reading or apply force to anything.

Once every loop should be fine, though. :slight_smile: Make sure the robot is completely still before zeroing, and that the tool is not touching anything.

1 Like