Skip to content

Commit

Permalink
Merge branch 'documentation-abby' into documentation-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
abbymartin committed Sep 22, 2024
2 parents 713177e + 8363cf5 commit 0861410
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/interfaces/include/LoadCellInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@

/* Library Includes */
#include "SysClock.h"
#include "AnalogSensorsInterface.h"

/* Interface */
#include "AnalogSensorsInterface.h"


/* Structs */

/**
* One load cell tick containing an AnalogConversion struct for each of the four load cells.
* Struct holding conversions for each wheel's load cell data.
* AnalogConversion_s struct holds raw and converted values and whether the result was clamped.
* Load cell data is converted from raw -> lbs
*/
struct LoadCellInterfaceTick_s
{
Expand All @@ -34,9 +36,10 @@ struct LoadCellInterfaceOutput_s
bool FIRSaturated;
};


/**
* An interface for the LoadCells. This class holds the data for a FIR filter, applies it to the given inputs, and can
* return the filtered load cells.
* The LoadCellInterface filters load cell signals to be used in the TorqueControllers system.
* Applies FIR filter and determines if signal is saturated
*/
class LoadCellInterface
{
Expand Down
23 changes: 23 additions & 0 deletions lib/interfaces/include/SABInterface.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
#ifndef __SABINTERFACE_H__
#define __SABINTERFACE_H__

/* Library */
#include "hytech.h"
#include "FlexCAN_T4.h"

/* Interface */
#include "AnalogSensorsInterface.h"

/**
* The SAB Interface receieves CAN messages containing load cell and potentionmeter readings.
* Through this interface values are parsed, updated, and converted to real units.
*/
class SABInterface
{
private:
public:
/* Rear load cell output */
AnalogChannel rlLoadCell;
AnalogChannel rrLoadCell;

/* Rear potentiometer output */
AnalogChannel pot3;
AnalogChannel pot4;

/**
* Constructor that defines conversion for both load cells and potentionmeter data
* Defined offset and scale values from MCU_rev15_defs are used to convert from raw data to correct units (pounds)
*/
SABInterface(
float rlLoadCellScale,
float rlLoadCellOffset,
Expand All @@ -38,13 +52,22 @@ class SABInterface
pot4.offset = pot4Offset;
};

/**
* Overloaded constructor with default values for potentiometer data.
* Sets pot scale to 1.0 and offset to 0.0 so value stays same as last sample.
*/
SABInterface(
float rlLoadCellScale,
float rlLoadCellOffset,
float rrLoadCellScale,
float rrLoadCellOffset
) : SABInterface (rlLoadCellScale, rlLoadCellOffset, rrLoadCellScale, rrLoadCellOffset, 1.0, 0.0, 1.0, 0.0) {};


/**
* Parses CAN message into individual values for rear load cell and potentiometer readings.
* Updates each sensor's lastSample value and converts data (rlLoadCell and rrLoadCell converted to pounds)
*/
void retrieve_pots_and_load_cells_CAN(CAN_message_t &recvd_msg);
};

Expand Down

0 comments on commit 0861410

Please sign in to comment.