modify trip measurement

This commit is contained in:
interfisch 2023-06-18 02:09:41 +02:00
parent 8d180debf7
commit 150ce61f9f
2 changed files with 16 additions and 3 deletions

View File

@ -44,7 +44,6 @@ bool ESCSerialComm::update(unsigned long loopmillis) //returns true if something
meanSpeedms=_meanRPM*wheelcircumference/60.0; // Units: 1/min * m / 60s meanSpeedms=_meanRPM*wheelcircumference/60.0; // Units: 1/min * m / 60s
trip+=abs(meanSpeedms)* ((trip_update_interval_real)/1000.0); trip+=abs(meanSpeedms)* ((trip_update_interval_real)/1000.0);
//mah consumed //mah consumed
currentConsumed += (Motorparams.filtered_curL+Motorparams.filtered_curR)* (trip_update_interval_real/1000.0)/3600.0; //amp hours currentConsumed += (Motorparams.filtered_curL+Motorparams.filtered_curR)* (trip_update_interval_real/1000.0)/3600.0; //amp hours
} }
@ -310,3 +309,10 @@ unsigned long ESCSerialComm::getFeedbackInterval() {
bool ESCSerialComm::getControllerConnected() { bool ESCSerialComm::getControllerConnected() {
return controller_connected; return controller_connected;
} }
float ESCSerialComm::getWheelspeed_L() {
return getFeedback_speedL_meas()*wheelcircumference/60.0; // Units: 1/min * m / 60s
}
float ESCSerialComm::getWheelspeed_R() {
return getFeedback_speedR_meas()*wheelcircumference/60.0; // Units: 1/min * m / 60s
}

View File

@ -109,6 +109,11 @@ class ESCSerialComm
void resetStatistics(); void resetStatistics();
float getWheelspeed_L();
float getWheelspeed_R();
private: private:
long _millis_lastinput; //declare private variable long _millis_lastinput; //declare private variable
@ -161,6 +166,8 @@ class ESCSerialComm
float filterMedian(int16_t* values); float filterMedian(int16_t* values);
}; };
#endif #endif