Skip to content

Commit

Permalink
baselaunchcontroller
Browse files Browse the repository at this point in the history
  • Loading branch information
Comerm28 committed Sep 22, 2024
1 parent f809063 commit 9da0a02
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/systems/include/BaseController.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef BASECONTROLLER
#define BASECONTROLLER
#include "SharedDataTypes.h"

/// @brief definition for a drivetrain command with no torque
namespace BaseControllerParams
{
const DrivetrainCommand_s TC_COMMAND_NO_TORQUE = {
Expand Down
11 changes: 11 additions & 0 deletions lib/systems/include/BaseLaunchController.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "BaseController.h"
#include <algorithm>
#include <math.h>

/// @brief Modes to guide tick behavior and progression
enum class LaunchStates_e
{
NO_LAUNCH_MODE,
Expand All @@ -12,6 +14,7 @@ enum class LaunchStates_e
LAUNCHING
};

/// @brief contains constants for tick behavior and progression
namespace BaseLaunchControllerParams
{
const int16_t DEFAULT_LAUNCH_SPEED_TARGET = 1500;
Expand All @@ -37,13 +40,21 @@ class BaseLaunchController : public virtual Controller
int16_t init_speed_target_ = 0;

public:
/// @brief Constructor for template launch controller
/// @param initial_speed_target unused right now
/// @note requires one method: calc_launch_algo
BaseLaunchController(int16_t initial_speed_target)
: init_speed_target_(initial_speed_target)
{
writeout_.command = BaseControllerParams::TC_COMMAND_NO_TORQUE;
writeout_.ready = true;
}

/// @brief ticks launch controller to progress through launch states when conditions are met
/// @param SysTick_s &tick
/// @param PedalsSystemData_s &pedalsData
/// @param float[] wheel_rpms
/// @param VectornavData_s &vn_data
void tick(const SysTick_s &tick,
const PedalsSystemData_s &pedalsData,
const float wheel_rpms[],
Expand Down

0 comments on commit 9da0a02

Please sign in to comment.