Skip to content
Snippets Groups Projects
Commit 31894e33 authored by Davide Mor's avatar Davide Mor
Browse files

[RIGv2] Calibrated loadcells

parent 1d42cb03
No related branches found
Tags
No related merge requests found
Pipeline #7724 failed
......@@ -72,6 +72,18 @@ static constexpr unsigned int LC_CALIBRATE_SAMPLE_PERIOD = 40;
static constexpr float SERVO_CURRENT_SCALE = 4.5466;
static constexpr float SERVO_CURRENT_ZERO = 2.520 / SERVO_CURRENT_SCALE;
static constexpr float BATTERY_VOLTAGE_SCALE = 4.7917;
// LC Tank sensor calibration data
// - 1.866kg V: 0.000941
// - 5.050kg V: 0.002550
// - 6.916kg V: 0.003559
static constexpr float LC_TANK_SCALE = 1968.8771f;
// LC Vessel sensor calibration data
// - 1.866kg V: 0.00027
// - 5.050kg V: 0.00073
// - 6.916kg V: 0.00100
static constexpr float LC_VESSEL_SCALE = 6914.9731f;
} // namespace Sensors
} // namespace Config
......
......@@ -138,7 +138,8 @@ LoadCellData Sensors::getVesselWeight()
sample.voltage[Config::Sensors::ADC1_VESSEL_LC_CHANNEL] -
vesselLcOffset;
return {sample.timestamp, calibratedVoltage};
return {sample.timestamp,
-calibratedVoltage * Config::Sensors::LC_VESSEL_SCALE};
}
LoadCellData Sensors::getTankWeight()
......@@ -147,7 +148,9 @@ LoadCellData Sensors::getTankWeight()
float calibratedVoltage =
sample.voltage[Config::Sensors::ADC1_TANK_LC_CHANNEL] - tankLcOffset;
return {sample.timestamp, calibratedVoltage};
// This ADC channel is flipped for some reason
return {sample.timestamp,
-calibratedVoltage * Config::Sensors::LC_TANK_SCALE};
}
CurrentData Sensors::getUmbilicalCurrent()
......@@ -159,7 +162,9 @@ CurrentData Sensors::getServoCurrent()
{
auto sample = getADC1LastSample();
float current = (sample.voltage[Config::Sensors::ADC1_SERVO_CURRENT_CHANNEL] - Config::Sensors::SERVO_CURRENT_ZERO) *
float current =
(sample.voltage[Config::Sensors::ADC1_SERVO_CURRENT_CHANNEL] -
Config::Sensors::SERVO_CURRENT_ZERO) *
Config::Sensors::SERVO_CURRENT_SCALE;
// Current reading are flipped
return {sample.timestamp, -current / 5.0f * 50.0f};
......
......@@ -172,7 +172,7 @@ int main()
while (true)
{
Thread::sleep(1000);
// sdLogger.log(modules.get<Radio>()->getMavStatus());
sdLogger.log(modules.get<Radio>()->getMavStatus());
sdLogger.log(CpuMeter::getCpuStats());
CpuMeter::resetCpuStats();
// TODO: What the fuck is this?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment