I am trying to narrow down how to capture the highest recorded/peak TCP torque at a given waypoint.
Of course, I can view what the ZTorque is at any given moment via the variables tab (slow as it is); however, I would like to know at the given waypoint, what the peak torque is, so I can fine tune some things. Is there any script I can write that captures the highest recorded Torque at the TCP for each given program cycle/run? Working with a FT sensor, of course.
Thanks in advance
Don’t forget to use the zero_ftsensor() command before reading the value, as you can get erroneous results otherwise.
As for logging the highest value, just use a temporary variable to hold the highest reading, and only write to it if the current reading is higher than that value. For example using some pseudocode:
PROGRAM: var highestZTorque = 0 runThread = True DO SOME WAYPOINTS OR SOMETHING runThread = False popup("The highest torque was", highestZTorque) //I know this isn't proper popup formatting THREAD: while(True): while(!runThread): sync() end TCPforce = get_tcp_force() ZTorque = TCPforce if(ZTorque > highestZTorque): highestZTorque = ZTorque end end
Block your thread from running with the runThread variable, and only set it true when you start caring about capturing the data. Make sure to zero the sensor and your temporary variable before doing so each time.
Side note, there is just a “force()” command which gives a single value of the force reading at the flange (I think) which might be all you care about if you’re just reading the Z value of your TCP force.