Skip to content

4698RaiderRobotics/Swerve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

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'
                }
            }

Releases

No releases published

Packages

No packages published

Languages