Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add launchController and implement launch control capability #33

Merged
merged 34 commits into from
May 27, 2024

Conversation

mathbrook
Copy link
Member

with this PR I am hoping to implement a launch control system that follows the state behavior and has the same functionality as the code in https://github.com/KSU-MS/KS6e-VCU-firmware/tree/launch

design ideas

  • keep launch control's manipulation of the torque command separate from the pedal's torque calculation
  • ie. do not run launch control algorithm inside calculate_torque, instead have a separate object manipulate the torque value in the state machine where we have most visibility
  • added launchController class with its own state enum to handle the different states and conditions of launch control mode
  • using mcu_status launch control flag to manage entering the launch control logic
stateDiagram-v2

    rtd : READY_TO_DRIVE
    rtd --> checkButtons
    checkButtons-->toggle_lc:toggle lc if buttons are pressed
    state toggle_lc{
        toggle_get_lc_active-->set_lc_active(1):set to 1 if it was 0
        toggle_get_lc_active-->set_lc_active(0):set to 0 if it was 1
        set_lc_active(1)-->[*]
        set_lc_active(0)-->[*]
    }
    toggle_lc -->get_lc_active
    checkButtons-->get_lc_active:if buttons are not held go to check lc state
    get_lc_active-->launchState:mcu_status.get_launch_ctrl_active returns 1
    get_lc_active-->command_torque:mcu_status.get_launch_ctrl_active returns 0
    state launchState{
        idle-->waiting:gas pressed, button pressed, and no implaus
        idle-->[*]
        waiting-->idle: gas released or implaus
        waiting-->[*]
        waiting-->launching: gas still pressed and button released 
        launching-->finished: brake pressed (cancel early)
        launching-->finished: time completed
        launching-->[*]:launching in progress
        finished-->[*]:launch control done, set launch_ctrl_active to 0
    }
    launchState-->command_torque:deactivate LC when finished
    command_torque-->rtd:return to start of RTD loop
Loading

@mathbrook mathbrook changed the base branch from feature/rev3-complete to testing March 5, 2024 01:09
@mathbrook mathbrook requested a review from RCMast3r March 28, 2024 01:37
@mathbrook mathbrook force-pushed the feature/launchcontroller branch from 47b8b47 to b48a80e Compare May 20, 2024 03:29
@mathbrook mathbrook merged commit 86a3923 into testing May 27, 2024
1 check passed
@mathbrook mathbrook deleted the feature/launchcontroller branch May 29, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant