Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 2.02 KB

README.adoc

File metadata and controls

30 lines (22 loc) · 2.02 KB

Swerve Drive

Swerve Drive Code for Team 4698

The swerve drive has three vector controls, x, y, and omega (angular velocity). Straight forward is positive x direction, straight left is positive y direction, and counter-clockwise is positive omega. The ChassisSpeeds object stores these three values in one object. The robot takes in the joystick commands for x speed, y speed, and omega (rotational) speed and adds them to a ChassisSpeeds object. The ChassisSpeeds values are robot relative, meaning positive x is forward on the robot. They can be changed to field relative, meaning positive x is directly away from you, with a gyro. The ChassisSpeeds object is then split up into an array of 4 individual SwerveModuleStates objects using the SwerveDriveKinematics class. These SwerveModuleStates can be sent to each individual swerve module and the motors can be set using this.

More information can be found at this blog and in this video.

GIT Submodule Use

Add this submodule to a WPILib Project with the command:

    git submodule add https://github.com/4698RaiderRobotics/Swerve.git src\Swerve

This will put the swerve code file in the project src directory in a folder named Swerve.

To allow the compiler to find the include and source files the build.gradle file must be modified to have the following in the frcUserProgram component:

            sources.cpp {
                source {
                    srcDirs 'src/main/cpp', 'src/Swerve/cpp'
                    include '**/*.cpp', '**/*.cc'
                }
                exportedHeaders {
                    srcDirs 'src/main/include', 'src/Swerve/include'
                }
            }