Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 6bd7ba4
Merge: 2beeda8 1815272
Author: CL16gtgh <ryang359@gatech.edu>
Date:   Fri May 24 21:35:01 2024 -0400

    Merge branch 'master' into feature/TCMux-relevant-status-tracking

commit 2beeda8
Author: CL16gtgh <ryang359@gatech.edu>
Date:   Wed May 22 18:55:23 2024 -0400

    Trying to get rid of self limiting features

commit 65f9ba0
Author: CL16gtgh <ryang359@gatech.edu>
Date:   Wed May 22 17:36:43 2024 -0400

    Squashed commit of the following:

    commit 0b68870
    Author: CL16gtgh <ryang359@gatech.edu>
    Date:   Wed May 22 17:33:24 2024 -0400

        Squashed commit of the following:

        commit 07faefa
        Merge: f149cdc bb03837
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Wed May 22 17:29:16 2024 -0400

            Merge branch 'master' into CASE_testbranch

        commit f149cdc
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Wed May 22 17:06:46 2024 -0400

            Reapply "bad"

            This reverts commit 2a253cd.

        commit e8cbee7
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Wed May 22 17:06:35 2024 -0400

            Reapply "Update main.cpp"

            This reverts commit 50de74c.

        commit 3d1aab3
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Wed May 22 17:06:23 2024 -0400

            Reapply "Merge branch 'master' into CASE_testbranch"

            This reverts commit e062970.

        commit e062970
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Wed May 22 16:37:16 2024 -0400

            Revert "Merge branch 'master' into CASE_testbranch"

            This reverts commit df74595.

        commit 50de74c
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Wed May 22 16:37:07 2024 -0400

            Revert "Update main.cpp"

            This reverts commit dfa4f7a.

        commit 2a253cd
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Wed May 22 16:36:55 2024 -0400

            Revert "bad"

            This reverts commit 95c4618.

        commit 95c4618
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Wed May 22 16:36:42 2024 -0400

            bad

        commit dfa4f7a
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Wed May 22 16:24:22 2024 -0400

            Update main.cpp

        commit df74595
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Wed May 22 16:23:20 2024 -0400

            Merge branch 'master' into CASE_testbranch

        commit bb03837
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Wed May 22 15:10:02 2024 -0400

            more detailed steering report

        commit 2b56423
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Wed May 22 14:26:14 2024 -0400

            not working when steered to right

        commit 40dd816
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Tue May 21 18:05:55 2024 -0400

            Revert "Added Derate Factor code to AMS interface"

            This reverts commit 5262fe8.

        commit 760bd8f
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Tue May 21 18:04:56 2024 -0400

            Revert "added derate factor to case and loadcell"

            This reverts commit 5d9761b.

        commit 5d9761b
        Author: shaynoorani <113149316+shaynoorani@users.noreply.github.com>
        Date:   Tue May 21 00:07:20 2024 -0700

            added derate factor to case and loadcell

        commit 5262fe8
        Author: shaynoorani <113149316+shaynoorani@users.noreply.github.com>
        Date:   Mon May 20 23:53:20 2024 -0700

            Added Derate Factor code to AMS interface

        commit 23be5cd
        Merge: 8ac101b 1416d3e
        Author: shaynoorani <113149316+shaynoorani@users.noreply.github.com>
        Date:   Mon May 20 22:54:56 2024 -0700

            Merge branch 'master' of https://github.com/hytech-racing/MCU

        commit 1416d3e
        Author: Ben Hall <rcmast3r1@gmail.com>
        Date:   Sat May 11 15:24:45 2024 -0400

            adding private member functions to doxygen docs

        commit 408193b
        Author: Ben Hall <rcmast3r1@gmail.com>
        Date:   Sat May 11 15:11:22 2024 -0400

            fixing repo library dep clone directives

    commit 28d5e72
    Author: CL16gtgh <ryang359@gatech.edu>
    Date:   Wed May 22 16:17:14 2024 -0400

        Revert "Squashed commit of the following:"

        This reverts commit 25136c7.

    commit 25136c7
    Author: CL16gtgh <ryang359@gatech.edu>
    Date:   Wed May 22 16:15:59 2024 -0400

        Squashed commit of the following:

        commit bb03837
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Wed May 22 15:10:02 2024 -0400

            more detailed steering report

        commit 2b56423
        Author: CL16gtgh <ryang359@gatech.edu>
        Date:   Wed May 22 14:26:14 2024 -0400

            not working when steered to right

        commit 23be5cd
        Merge: 8ac101b 1416d3e
        Author: shaynoorani <113149316+shaynoorani@users.noreply.github.com>
        Date:   Mon May 20 22:54:56 2024 -0700

            Merge branch 'master' of https://github.com/hytech-racing/MCU

        commit 1416d3e
        Author: Ben Hall <rcmast3r1@gmail.com>
        Date:   Sat May 11 15:24:45 2024 -0400

            adding private member functions to doxygen docs

        commit 408193b
        Author: Ben Hall <rcmast3r1@gmail.com>
        Date:   Sat May 11 15:11:22 2024 -0400

            fixing repo library dep clone directives

    commit ccd205a
    Author: CL16gtgh <ryang359@gatech.edu>
    Date:   Wed May 22 15:50:25 2024 -0400

        finale

    commit d0c523e
    Author: CL16gtgh <ryang359@gatech.edu>
    Date:   Wed May 22 14:57:58 2024 -0400

        read more values

    commit b528dfc
    Merge: f4e69ef 207b299
    Author: CL16gtgh <ryang359@gatech.edu>
    Date:   Mon May 20 21:26:55 2024 -0400

        Merge branch 'CASE_testbranch' into feature/filter-steering-reading

    commit 207b299
    Author: Luke Chen <43226681+Luke-kC@users.noreply.github.com>
    Date:   Sat May 18 00:59:13 2024 -0700

        Decoupled and NL scheduled slip targets for TCS

commit afda31e
Author: CL16gtgh <ryang359@gatech.edu>
Date:   Wed May 22 16:00:49 2024 -0400

    Squashed commit of the following:

    commit ccd205a
    Author: CL16gtgh <ryang359@gatech.edu>
    Date:   Wed May 22 15:50:25 2024 -0400

        finale

    commit d0c523e
    Author: CL16gtgh <ryang359@gatech.edu>
    Date:   Wed May 22 14:57:58 2024 -0400

        read more values

    commit b528dfc
    Merge: f4e69ef 207b299
    Author: CL16gtgh <ryang359@gatech.edu>
    Date:   Mon May 20 21:26:55 2024 -0400

        Merge branch 'CASE_testbranch' into feature/filter-steering-reading

    commit 207b299
    Author: Luke Chen <43226681+Luke-kC@users.noreply.github.com>
    Date:   Sat May 18 00:59:13 2024 -0700

        Decoupled and NL scheduled slip targets for TCS

commit b736169
Author: CL16gtgh <ryang359@gatech.edu>
Date:   Wed May 22 15:52:14 2024 -0400

    Fix skill issue

commit 9facf9e
Merge: 3daa65b f4e69ef
Author: CL16gtgh <ryang359@gatech.edu>
Date:   Mon May 20 01:19:17 2024 -0400

    Merge branch 'feature/filter-steering-reading' into feature/TCMux-relevant-status-tracking

commit 3daa65b
Author: CL16gtgh <ryang359@gatech.edu>
Date:   Mon May 20 00:11:51 2024 -0400

    a lil bit of ocd

commit 1e5326a
Author: CL16gtgh <ryang359@gatech.edu>
Date:   Sun May 19 23:20:57 2024 -0400

    Added implementation in TelemetryInterface and updated .ini file

commit 3a1f493
Author: CL16gtgh <ryang359@gatech.edu>
Date:   Sun May 19 18:40:13 2024 -0400

    Added steering status report

commit 1284ebc
Author: CL16gtgh <ryang359@gatech.edu>
Date:   Sun May 19 16:02:14 2024 -0400

    Idea outline for reporting TCMux status
  • Loading branch information
CL16gtgh committed May 25, 2024
1 parent 2dadde9 commit ee32c25
Show file tree
Hide file tree
Showing 11 changed files with 224 additions and 65 deletions.
4 changes: 4 additions & 0 deletions include/MCU_rev15_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,8 @@ const int SECONDARY_STEERING_SENSE_CENTER = 1945; // 1960 // 1970
const float STEERING_RANGE_DEGREES = 257.0f; // 253.0f // 256.05f // 134+130-7(slop)
const float STEERING_IIR_ALPHA = 0.7f; // shaves off around 1 deg of max discrepancy

// TC parameters
const float SIMPLE_TC_REAR_TORQUE_SCALE = 1.0;
const float SIMPLE_TC_REGEN_TORQUE_SCALE = 0.4;

#endif /* __MCU15_H__ */
44 changes: 28 additions & 16 deletions lib/interfaces/include/TelemetryInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class TelemetryInterface
TelemetryInterface(CANBufferType *msg_output_queue, const TelemetryInterfaceReadChannels &channels) : msg_queue_(msg_output_queue),
channels_(channels){};

/* GETTERS for basic conversions that don't have a home*/
/* GETTERS for basic conversions that don't have a home */

AnalogConversion_s get_glv_voltage(const AnalogConversionPacket_s<8> &adc1)
{
Expand Down Expand Up @@ -75,23 +75,27 @@ class TelemetryInterface
const AnalogConversion_s &lc_fl,
const AnalogConversion_s &lc_fr,
const AnalogConversion_s &pots_fl,
const AnalogConversion_s &pots_fr);
const AnalogConversion_s &pots_fr
);
void update_analog_readings_CAN_msg(
const SteeringEncoderConversion_s &steer1,
const AnalogConversion_s &steer2,
const AnalogConversion_s &current,
const AnalogConversion_s &reference,
const AnalogConversion_s &glv);
const AnalogConversion_s &glv
);
void update_drivetrain_rpms_CAN_msg(
InvInt_t *fl,
InvInt_t *fr,
InvInt_t *rl,
InvInt_t *rr);
InvInt_t *rr
);
void update_drivetrain_err_status_CAN_msg(
InvInt_t *fl,
InvInt_t *fr,
InvInt_t *rl,
InvInt_t *rr);
InvInt_t *rr
);
void update_drivetrain_status_telem_CAN_msg(
InvInt_t *fl,
InvInt_t *fr,
Expand All @@ -100,31 +104,39 @@ class TelemetryInterface
bool accel_implaus,
bool brake_implaus,
float accel_per,
float brake_per);
float brake_per
);
void update_drivetrain_torque_telem_CAN_msg(
InvInt_t *fl,
InvInt_t *fr,
InvInt_t *rl,
InvInt_t *rr);
InvInt_t *rr
);
void update_penthouse_accum_CAN_msg(
const AnalogConversion_s &current,
const AnalogConversion_s &reference);

void enqeue_controller_CAN_msg(const PIDTVTorqueControllerData &data);
const AnalogConversion_s &reference
);
void update_TCMux_status_CAN_msg(
const TCMuxStatus_s &tcMuxStatus
);
void update_steering_status_CAN_msg(
const float steering_system_angle,
const float filtered_angle_encoder,
const float filtered_angle_analog,
const uint8_t steering_system_status,
const uint8_t steering_encoder_status,
const uint8_t steering_analog_status
);

/* Enqueue outbound telemetry CAN messages */
// void enqueue_CAN_mcu_pedal_readings();
// void enqueue_CAN_mcu_load_cells();
// void enqueue_CAN_mcu_front_potentiometers();
// void enqueue_CAN_mcu_rear_potentiometers();
// void enqueue_CAN_mcu_analog_readings();

template <typename T>
void enqueue_CAN(T can_msg, uint32_t id);

template <typename U>
void enqueue_new_CAN(U *structure, uint32_t (*pack_function)(U *, uint8_t *, uint8_t *, uint8_t *));

void enqeue_controller_CAN_msg(const PIDTVTorqueControllerData &data);

// TODO dont pass in pointer to inverter interface here we will break shit with this
/* Tick at 50Hz to send CAN */
void tick(
Expand Down
41 changes: 38 additions & 3 deletions lib/interfaces/src/TelemetryInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ void TelemetryInterface::update_front_thermistors_CAN_msg(const AnalogConversion
const AnalogConversion_s &therm_fr) {

FRONT_THERMISTORS_t front_thermistors_;
front_thermistors_.thermistor_motor_fl = therm_fl.raw;
front_thermistors_.thermistor_motor_fr = therm_fr.raw;
front_thermistors_.thermistor_motor_fl_ro = HYTECH_thermistor_motor_fl_ro_toS(therm_fl.raw);
front_thermistors_.thermistor_motor_fr_ro = HYTECH_thermistor_motor_fr_ro_toS(therm_fr.raw);

enqueue_new_CAN<FRONT_THERMISTORS_t>(&front_thermistors_, &Pack_FRONT_THERMISTORS_hytech);
}
Expand Down Expand Up @@ -194,6 +194,42 @@ void TelemetryInterface::update_penthouse_accum_CAN_msg(const AnalogConversion_s
enqueue_new_CAN<PENTHOUSE_ACCUM_MSG_t>(&message, &Pack_PENTHOUSE_ACCUM_MSG_hytech);
}

void TelemetryInterface::update_TCMux_status_CAN_msg(const TCMuxStatus_s &tcMuxStatus)
{
TCMUX_STATUS_REPORT_t msg;

msg.speed_above_thresh = tcMuxStatus.speedPreventsModeChange;
msg.torque_delta_above_thresh = tcMuxStatus.torqueDeltaPreventsModeChange;
msg.tc_not_ready = tcMuxStatus.controllerNotReadyPreventsModeChange;
msg.steering_system_has_err = tcMuxStatus.steeringSystemError;
msg.mode_intended = tcMuxStatus.modeIntended;
msg.mode_actual = tcMuxStatus.modeActual;
msg.dash_dial_mode = tcMuxStatus.dialMode;
msg.torque_mode = tcMuxStatus.torqueMode;
msg.torque_limit_ro = HYTECH_torque_limit_ro_toS(tcMuxStatus.maxTorque);

enqueue_new_CAN<TCMUX_STATUS_REPORT_t>(&msg, &Pack_TCMUX_STATUS_REPORT_hytech);
}

void TelemetryInterface::update_steering_status_CAN_msg(const float steering_system_angle,
const float filtered_angle_encoder,
const float filtered_angle_analog,
const uint8_t steering_system_status,
const uint8_t steering_encoder_status,
const uint8_t steering_analog_status)
{
STEERING_SYSTEM_REPORT_t msg;

msg.steering_system_angle_ro = HYTECH_steering_system_angle_ro_toS(steering_system_angle);
msg.steering_encoder_angle_ro = HYTECH_steering_encoder_angle_ro_toS(filtered_angle_encoder);
msg.steering_analog_angle_ro = HYTECH_steering_analog_angle_ro_toS(filtered_angle_analog);
msg.steering_system_status = steering_system_status;
msg.steering_encoder_status = steering_encoder_status;
msg.steering_analog_status = steering_analog_status;

enqueue_new_CAN<STEERING_SYSTEM_REPORT_t>(&msg, &Pack_STEERING_SYSTEM_REPORT_hytech);
}

/* Send CAN messages */
template<typename T>
void TelemetryInterface::enqueue_CAN(T msg_class, uint32_t id) {
Expand Down Expand Up @@ -237,7 +273,6 @@ void TelemetryInterface::enqeue_controller_CAN_msg(const PIDTVTorqueControllerDa

}


/* Tick SysClock */
void TelemetryInterface::tick(const AnalogConversionPacket_s<8> &adc1,
const AnalogConversionPacket_s<4> &adc2,
Expand Down
23 changes: 20 additions & 3 deletions lib/shared_data/include/TorqueControllersData.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
#ifndef TORQUECONTROLLERSDATA
#define TORQUECONTROLLERSDATA
#ifndef __TORQUE_CONTROLLERS_DATA__
#define __TORQUE_CONTROLLERS_DATA__

#include <stdint.h>

struct TCMuxStatus_s
{
bool speedPreventsModeChange;
bool torqueDeltaPreventsModeChange;
bool controllerNotReadyPreventsModeChange;
bool steeringSystemError;

uint8_t modeIntended;
uint8_t modeActual;
uint8_t dialMode;

uint8_t torqueMode;
float maxTorque;
};

struct PIDTVTorqueControllerData
{
Expand All @@ -11,4 +28,4 @@ struct PIDTVTorqueControllerData
float rr_torque_delta;
};

#endif
#endif /* __TORQUE_CONTROLLERS_DATA__ */
23 changes: 18 additions & 5 deletions lib/systems/include/SteeringSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "AnalogSensorsInterface.h"
#include "Filter_IIR.h"
#include "SysClock.h"
#include "TelemetryInterface.h"

// Digital Encoder = Primary Sensor
// Analog Encoder = Secondary Sensor

Expand Down Expand Up @@ -52,17 +54,20 @@ class SteeringSystem
Filter_IIR<float> steeringFilters_[NUM_SENSORS];
float filteredAnglePrimary_;
float filteredAngleSecondary_;

TelemetryInterface *telemHandle_;
public:
SteeringSystem(SteeringEncoderInterface *primarySensor)
: SteeringSystem(primarySensor, DEFAULT_STEERING_ALPHA)
SteeringSystem(SteeringEncoderInterface *primarySensor, TelemetryInterface *telemInterface)
: SteeringSystem(primarySensor, telemInterface, DEFAULT_STEERING_ALPHA)
{}

SteeringSystem(SteeringEncoderInterface *primarySensor, float filterAlpha)
: SteeringSystem(primarySensor, filterAlpha, filterAlpha)
SteeringSystem(SteeringEncoderInterface *primarySensor, TelemetryInterface *telemInterface, float filterAlpha)
: SteeringSystem(primarySensor, telemInterface, filterAlpha, filterAlpha)
{}

SteeringSystem(SteeringEncoderInterface *primarySensor, float filterAlphaPrimary, float filterAlphaSecondary)
SteeringSystem(SteeringEncoderInterface *primarySensor, TelemetryInterface *telemInterface, float filterAlphaPrimary, float filterAlphaSecondary)
: primarySensor_(primarySensor)
, telemHandle_(telemInterface)
{
steeringFilters_[0] = Filter_IIR<float>(filterAlphaPrimary);
steeringFilters_[1] = Filter_IIR<float>(filterAlphaSecondary);
Expand All @@ -80,6 +85,14 @@ class SteeringSystem
{
return steeringData_;
}

void reportSteeringStatus(
const float angle,
const float filteredAngleEncoder,
const float filteredAngleAnalog,
const uint8_t systemStatus,
const uint8_t encoderStatus,
const uint8_t analogSensorStatus);
};

#endif /* __STEERINGSYSTEM_H__ */
52 changes: 31 additions & 21 deletions lib/systems/include/TorqueControllerMux.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
#include "DashboardInterface.h"
#include "VectornavInterface.h"
#include "LoadCellInterface.h"
#include "TelemetryInterface.h"

const float MAX_SPEED_FOR_MODE_CHANGE = 5.0; // m/s
const float MAX_TORQUE_DELTA_FOR_MODE_CHANGE = 0.5; // Nm

/// @brief
/// @brief multiplexer class for managing available torque controllers
class TorqueControllerMux
{
private:
Expand All @@ -42,11 +43,11 @@ class TorqueControllerMux
};

TorqueController_e muxMode_ = TorqueController_e::TC_NO_CONTROLLER;
DialMode_e cur_dial_mode_ = DialMode_e::MODE_0;
DialMode_e currDialMode_ = DialMode_e::MODE_0;

TorqueControllerOutput_s controllerOutputs_[static_cast<int>(TorqueController_e::TC_NUM_CONTROLLERS)];


// Handle array for all torque controllers
TorqueControllerBase* controllers[static_cast<int>(TorqueController_e::TC_NUM_CONTROLLERS)] = {
static_cast<TorqueControllerBase*>(&torqueControllerNone_),
static_cast<TorqueControllerBase*>(&torqueControllerSimple_),
Expand All @@ -56,33 +57,41 @@ class TorqueControllerMux
static_cast<TorqueControllerBase*>(&tcCASEWrapper_)
};

// Status tracking structure for visibility
TCMuxStatus_s tcMuxStatus_;

DrivetrainCommand_s drivetrainCommand_;
TorqueLimit_e torqueLimit_ = TorqueLimit_e::TCMUX_LOW_TORQUE;
TorqueLimit_e torqueLimit_ = TorqueLimit_e::TCMUX_FULL_TORQUE;
bool torqueLimitButtonPressed_ = false;
unsigned long torqueLimitButtonPressedTime_ = 0;
TelemetryInterface *telemHandle_;

public:
/// @brief torque controller mux in which default instances of all torque controllers are created for use
TorqueControllerMux()
TorqueControllerMux(TelemetryInterface *telemInterface)
: torqueControllerNone_(controllerOutputs_[static_cast<int>(TorqueController_e::TC_NO_CONTROLLER)])
, torqueControllerSimple_(controllerOutputs_[static_cast<int>(TorqueController_e::TC_SAFE_MODE)])
, torqueControllerLoadCellVectoring_(controllerOutputs_[static_cast<int>(TorqueController_e::TC_LOAD_CELL_VECTORING)])
, torqueControllerSimpleLaunch_(controllerOutputs_[static_cast<int>(TorqueController_e::TC_SIMPLE_LAUNCH)])
, torqueControllerSlipLaunch_(controllerOutputs_[static_cast<int>(TorqueController_e::TC_SLIP_LAUNCH)])
, tcCASEWrapper_(controllerOutputs_[static_cast<int>(TorqueController_e::TC_CASE_SYSTEM)]) {}
, tcCASEWrapper_(controllerOutputs_[static_cast<int>(TorqueController_e::TC_CASE_SYSTEM)])
, telemHandle_(telemInterface) {}


/// @brief torque controller mux constructor that leaves all other TCs with defaults accept for simple TC
/// @param simpleTCRearTorqueScale the scaling from 0 to 2 in which 2 is full rear torque allocation, 0 is full front, 1 = balanced
/// @param simpleTCRegenTorqueScale scaling from 0 to 2 in which 0 is full rear regen and 2 is full front regen, 1 = balanced
TorqueControllerMux(float simpleTCRearTorqueScale, float simpleTCRegenTorqueScale)
TorqueControllerMux(float simpleTCRearTorqueScale, float simpleTCRegenTorqueScale, TelemetryInterface *telemInterface)
: torqueControllerNone_(controllerOutputs_[static_cast<int>(TorqueController_e::TC_NO_CONTROLLER)])
, torqueControllerSimple_(controllerOutputs_[static_cast<int>(TorqueController_e::TC_SAFE_MODE)], simpleTCRearTorqueScale, simpleTCRegenTorqueScale)
, torqueControllerLoadCellVectoring_(controllerOutputs_[static_cast<int>(TorqueController_e::TC_LOAD_CELL_VECTORING)], 1.0, simpleTCRegenTorqueScale)
, torqueControllerSimpleLaunch_(controllerOutputs_[static_cast<int>(TorqueController_e::TC_SIMPLE_LAUNCH)])
, torqueControllerSlipLaunch_(controllerOutputs_[static_cast<int>(TorqueController_e::TC_SLIP_LAUNCH)])
, tcCASEWrapper_(controllerOutputs_[static_cast<int>(TorqueController_e::TC_CASE_SYSTEM)]) {}
// Functions
, tcCASEWrapper_(controllerOutputs_[static_cast<int>(TorqueController_e::TC_CASE_SYSTEM)])
, telemHandle_(telemInterface) {}

// Functions
/// @brief tick controllers to calculate drivetrain command
void tick(
const SysTick_s &tick,
const DrivetrainDynamicReport_s &drivetrainData,
Expand All @@ -94,12 +103,20 @@ class TorqueControllerMux
const vector_nav &vn_data,
const DrivetrainCommand_s &CASECommand
);

/// @brief apply corresponding limits on drivetrain command calculated by torque controller
void applyRegenLimit(DrivetrainCommand_s* command, const DrivetrainDynamicReport_s* drivetrain);
void applyTorqueLimit(DrivetrainCommand_s* command);
void applyPowerLimit(DrivetrainCommand_s* command, const DrivetrainDynamicReport_s* drivetrain);
void applyPosSpeedLimit(DrivetrainCommand_s* command);

/// @brief GETTERS
const DrivetrainCommand_s &getDrivetrainCommand()
{
return drivetrainCommand_;
};

const TorqueLimit_e &getTorqueLimit()
const TorqueLimit_e getTorqueLimit()
{
return torqueLimit_;
};
Expand All @@ -109,19 +126,9 @@ class TorqueControllerMux
return torqueLimitMap_[torqueLimit_];
}

void applyRegenLimit(DrivetrainCommand_s* command, const DrivetrainDynamicReport_s* drivetrain);

void applyTorqueLimit(DrivetrainCommand_s* command);

void applyPowerLimit(DrivetrainCommand_s* command, const DrivetrainDynamicReport_s* drivetrain);

void applyPosSpeedLimit(DrivetrainCommand_s* command);



const DialMode_e getDialMode()
{
return cur_dial_mode_;
return currDialMode_;
}

const TorqueController_e getDriveMode()
Expand All @@ -139,6 +146,9 @@ class TorqueControllerMux
return static_cast<TorqueControllerBase*>(&torqueControllerNone_);
}
}

/// @brief report TCMux status through Telemetry via CAN
void reportTCMuxStatus();
};

#endif /* __TORQUECTRLMUX_H__ */
1 change: 0 additions & 1 deletion lib/systems/include/TorqueControllers.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <Utility.h>
#include <DrivetrainSystem.h>
#include <PedalsSystem.h>
#include <SteeringSystem.h>
#include "AnalogSensorsInterface.h"
#include "DashboardInterface.h"
#include "PhysicalParameters.h"
Expand Down
Loading

0 comments on commit ee32c25

Please sign in to comment.