Skip to content

LittleStinkerGuy/Controls-Take-Home-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Daniel Kharis Controls Take Home Project

The change log will be updated with every commit and will walk through my though process of implementing changes and challenges I faced working on them.

Todo:

  • Create basic code to move various models of motors in ./robotCode
    • Kraken Support
    • Falcon Support
    • SparkMax Support
    • Network Table Support
    • Create motor instances with network table
  • Add support for motor movement in ./driverUI
  • Create a basic debug library in ./RobotCode
  • Add logging system in ./driverUI
  • Add more commands to motor features

Changelog

1. Basic Project Setup

Changes Made:

  1. Created two folders: One for the driver UI and one to create sample code to test the UI with.
  2. Initialized a WPILib project
  3. Initialized a python project with a venv and generated a .gitignore with CodeZombie's VSCode extension

Challenges Faced: N/A

2. Create Subsystems for TalonFX motors and SparkMax motors

Changes Made:

  1. Updated README for specific motor support
  2. Created Motor interface to easily support both motor controllers later in the code
  3. Added support for FalconFX motors which includes Kraken and Falcon Motors
  4. Added support for SparkMax

Challenges Faced:

  1. Finding specific documentation for motors
  2. Constructing the Motor interface to be compatible with both motor libraries
  3. Handling the fact that a SparkMax motor can have both an absolute and relative encoder

Solutions

  1. Found code samples in various parts of the web including Swayam's WWRF code repo and last year's GRT code. Also used auto generated Javadoc documentation.
  2. Changed definition of current and voltage getters because FalconFX exposes a couple values (like motor.getSupplyVoltage() or motor.getMotorVoltage()) and SparkMax only exposes one.
  3. If setPosition() is used with an absolute encoder, it doesn't do anything. (Bad Solution)

3. Add support for reading motor state and moving motors

Changes Made:

  1. Changed setup of motor subsystem to include the MotorInterface interface and Motor abstract class to implement network table code with all instances of Motor
  2. Created a MotorTester subsystem to create test motors
  3. Added network table implementation to Motor class

Challenges Faced:

  1. Identifying "correct" network table implementation and schema
  2. Handling possible race conditions in code
  3. Understanding overall WPILib project structure
  4. The network table implementation to change motor values seemed not to work

Solutions

  1. Once again taking inspiration from last year's GRT code and ChatGPT.
  2. I did research on race condition in Java and discovered AtomicBooleans and the Volatile Keyword
  3. Digging into documentation and also discovering command robots vs timed robots.
  4. Looking into the manufacturers' documentation revealed that a separate sim library was required to get them to show changes.

4. Created Python UI

Changes Made:

  1. Made motor control widgets
  2. Made widget that creates motor controller widgets
  3. Laid out UI
  4. Added intractability to the controller creator

Challenges Faced:

  1. Learning a new UI framework alsnfsjkgs
  2. Getting widgets to the correct width
  3. Proper lining up of the motor controller widgets

Solutions

  1. Hard work and pain 😭
  2. Google!

[Video Link] (https://drive.google.com/file/d/1HZgKQ2iL1SDjZNOIrh_RFdqEI_6NvMkD/view?usp=sharing)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors