Skip to content

Commit

Permalink
Update conversion per Futek load cell calibration data
Browse files Browse the repository at this point in the history
  • Loading branch information
twyatt committed Feb 1, 2017
1 parent 55d2c34 commit 31c4c9a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions client/src/main/java/client/main/MainController.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,19 @@ private void setupGauges() {
* Rated Output = 2 mV/V (i.e. output @ capacity)
* Capacity = 2000 lb
*
* (2000 lb) / (2 mV/V) => y = 1000 * x
* Calibration Data:
* Output (mV/V) Load (lb)
* 0.0 0
* 0.4627 400
* 0.9262 800
* 1.3901 1200
* 1.8542 1600
* 2.3176 2000
*
* Linear curve fit: y = 862.791 * x + 0.485
* https://docs.google.com/spreadsheets/d/1XMN06cI92ah1l_Vc1dmJLuunMsgse7e8xNSH-bHrNUc/edit?usp=sharing
*/
final ValueTranslator forceTranslator = new ValueTranslator(1000f, 0f);
final ValueTranslator forceTranslator = new ValueTranslator(862.791f, 0.485f);
final GaugeSettings settingsForce = new GaugeSettings()
.setUnit("lb")
.setMinValue(-100)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void loop() throws IOException, InterruptedException {
if ((x += 0.01f) > 1000f) x = 0f; // 0 to 1000
float s = (float) Math.sin(x); // -1 to 1
float sp = (s / 2f) + 0.5f; // 0 to 1
float ratedOutput = sp * 2f; // 0 to 2 (which is full mV/V range of Futek load cell)
float ratedOutput = sp * 2.3176f; // 0 to 2.3176 (which is full calibrated mV/V range of Futek load cell)

if (bridgeDataListener != null) {
BridgeDataEvent event = new BridgeDataEvent(null, 0, ratedOutput);
Expand Down

0 comments on commit 31c4c9a

Please sign in to comment.