For information on the latest version, please have a look at 1.33.5.
get_workpiece_weight
Starts a payload measurement and returns the measured workpiece weight in kg, relative to the last reset_workpiece_weight. It does not return the value set with set_workpiece_weight. The arm must be in STANDBY with servo on. A virtual robot returns 0. A refused or unsent measurement also returns 0, so a return of 0 does not distinguish a failure from a zero weight.
The returned value represents the workpiece component of the total payload (excluding tool weight).
Definition
DRFLEx.h within class CDRFLEx, public section
float get_workpiece_weight() {
return _get_workpiece_weight(_rbtCtrl);
};
Parameter
None
Return
Value |
Description |
|---|---|
float |
Measured workpiece weight in kilograms (kg). |
Caution
Ensure the servo is on and the arm is stationary before calling.
After the measurement completes, the function sends a slow stop, the same as stop(STOP_TYPE_SLOW), which stops any motion in progress.
Example
// Measure the current workpiece weight
float weight = drfl.get_workpiece_weight();
// Print the measured weight value
printf("Current workpiece weight: %.3f kg\n", weight);
This example measures the current workpiece weight and prints the value to the console for verification or monitoring.