Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
dd34417
Initial commit
dejabot Jan 14, 2023
8f2e55d
Initialize swerveOdometry
dejabot Jan 14, 2023
e0185cf
Update to WPILib 2023
maxspier Jan 14, 2023
e90ee7b
Merge pull request #1 from Team766/update_wpilib
dejabot Jan 14, 2023
45fc147
Merge branch 'main' of https://github.com/Team766/2023 into swerveOdo…
BCNOFNeNaMg Jan 14, 2023
2985ad2
more merges from WPILib 2023 changes
BCNOFNeNaMg Jan 14, 2023
d9b8e58
Removed Repeated element from LogListValue
BCNOFNeNaMg Jan 14, 2023
577a30d
update implementation of WPIRobotProvider.hasNewDriverStationData().
dejabot Jan 16, 2023
b88b9c2
more fixes for WPILib 2023
dejabot Jan 17, 2023
e8b1efb
fix formatting
dejabot Jan 17, 2023
ce537b8
respond to PR comments
dejabot Jan 17, 2023
9d96ed0
code review feedback: wait then refresh
dejabot Jan 18, 2023
2e9ac19
Merge pull request #2 from Team766/fix_wpirobotprovider_hasnewdrivers…
dejabot Jan 18, 2023
11026a6
rev Maroon Framework version (#16)
dejabot Jan 12, 2023
1a97891
Disable editing via /config.
dejabot Jan 14, 2023
028a5c2
Fix HTML formatting in /config
dejabot Jan 16, 2023
2b119dd
Fix PID gain scaling in MotorControllerWithSensorScale
rcahoon Jan 16, 2023
0550083
Beacon position sensor for simulator
rcahoon Jan 16, 2023
8af12f2
Add braces around if bodies
rcahoon Jan 17, 2023
e3490bb
Revert config file changes
dejabot Jan 22, 2023
6016427
Revert config file changes
dejabot Jan 22, 2023
651132a
Added FollowPoints stopping robot during procdure
BCNOFNeNaMg Jan 22, 2023
395cafb
update deployconfigFiles to occur before the deploy task kills the ro…
dejabot Jan 23, 2023
4648c79
Merge pull request #4 from Team766/fix-revert-config-changes
dejabot Jan 23, 2023
bef4a23
Merge pull request #5 from Team766/fix-deploy-config-files
dejabot Jan 23, 2023
b0153e2
Create pull_request_template.md
rcahoon Jan 23, 2023
6563d0f
Added seperate CANBus compatability (hopefully)
rajitzg Jan 23, 2023
9a242dd
added robot controls
rajitzg Jan 23, 2023
3354d2f
got rid of unnecesary odometry code/fixed errors
IndraGerard Jan 24, 2023
0cb799b
Got swerve working with CANivore
IndraGerard Jan 26, 2023
fede0d6
Added critical points and rotation to FollowPoints
BCNOFNeNaMg Jan 28, 2023
05bbca2
Signified how to make FollowPoints() field oriented
BCNOFNeNaMg Jan 28, 2023
39ab4cd
improved swerve code
IndraGerard Jan 28, 2023
ddaa033
Added example FileReader
BCNOFNeNaMg Jan 31, 2023
a0ce8ac
Merge branch 'swerveCANivore' into swerveOdometry
BCNOFNeNaMg Feb 7, 2023
fc0c6f7
Made FollowPoints work with CANivore
BCNOFNeNaMg Feb 7, 2023
c9fea67
switch to java lite runtime for protobufs
dejabot Feb 7, 2023
12079b6
accidentally deleted newline (?). fix.
dejabot Feb 7, 2023
0d94724
Merge pull request #7 from Team766/fix-protobuf-lite
dejabot Feb 8, 2023
449c614
Fixed Robot spinning
BCNOFNeNaMg Feb 9, 2023
e59c576
Made rotation fixes
BCNOFNeNaMg Feb 9, 2023
a19ad3b
switch CI action to run on pushes to *main*
dejabot Feb 9, 2023
1f2bc7a
Add JVM heap limits for RoboRIOv1 to prevent out-of-memory crashes
rcahoon Feb 7, 2023
5928096
Fixed Rotation in FollowPoints
BCNOFNeNaMg Feb 11, 2023
36bc15c
Merge pull request #9 from Team766/dejabot-ci-tweak
dejabot Feb 11, 2023
f2d4626
update to WPILib 2023.3.2
dejabot Feb 11, 2023
194c652
Add MaroonSim model for the two-joint arm (#10)
rcahoon Feb 11, 2023
cb96d5c
Added FollowPoints read-from-file ability
BCNOFNeNaMg Feb 11, 2023
77a9b44
Fixed
maxspier Feb 11, 2023
79fd82a
Added javadocs to Odometry and FollowPoints
BCNOFNeNaMg Feb 11, 2023
a878872
Merge branch 'main' of https://github.com/Team766/2023 into swerveOdo…
BCNOFNeNaMg Feb 11, 2023
4360628
add javadoc target to build
dejabot Feb 12, 2023
0e1603a
add directories for sample documents, in markdown format.
dejabot Feb 12, 2023
199b955
Print useful message when reading motor config fails.
Feb 11, 2023
52230c7
Added a mode to view all log messages in the web UI.
Feb 11, 2023
a1f5888
Simplify how streams are concatenated.
Feb 12, 2023
2393c39
Merge pull request #15 from Team766/blaise/all-messages
blaisegassend Feb 12, 2023
7af4c3c
Use LoggerExceptionUtils.exceptionToString() rather than rolling my own.
Feb 13, 2023
8fad4f4
Merge remote-tracking branch 'mf/master'
rcahoon Feb 12, 2023
ab75155
Changed resetCurrentPosition to setCurrentPosition
BCNOFNeNaMg Feb 14, 2023
123c103
Added Swerve comments using javadocs
SauquetAlex Feb 16, 2023
637036f
Reverted resetCurretPosition and setCross
BCNOFNeNaMg Feb 16, 2023
417a0bb
Deleted setCross
BCNOFNeNaMg Feb 16, 2023
fd5f482
Fixed weird bug
SauquetAlex Feb 16, 2023
f549517
Fixed critical points not parsing
BCNOFNeNaMg Feb 18, 2023
06dd0e4
Merge pull request #12 from Team766/fix-pid-controller-reset
maxspier Feb 18, 2023
656fc6b
added image displayer (with interlacing)
BCNOFNeNaMg Feb 18, 2023
00e50fd
Reversed Y-Direction and stopped robot travelling infinitely
BCNOFNeNaMg Feb 19, 2023
2b3c0b1
Added tnt & torchflower
BCNOFNeNaMg Feb 19, 2023
10dc684
Merge pull request #11 from Team766/update-wpilib
dejabot Feb 19, 2023
cc9785d
Merge pull request #13 from Team766/compile-javadoc
SauquetAlex Feb 19, 2023
2cbd409
Merge branch 'main' of https://github.com/Team766/2023 into doc-place…
dejabot Feb 19, 2023
b4e523b
Merge pull request #16 from Team766/doc-placeholders
SauquetAlex Feb 19, 2023
ba8201e
Allows robot to move backwards in swerveDrive()
BCNOFNeNaMg Feb 19, 2023
d96ef7d
Reverted attempted gyro-off-by-90 fix
BCNOFNeNaMg Feb 19, 2023
9d371ca
Merge branch 'main' of https://github.com/Team766/2023 into swerveOdo…
BCNOFNeNaMg Feb 19, 2023
04cc350
Improved accuracy of FollowPoints
BCNOFNeNaMg Feb 20, 2023
7f48b5d
Updated build.gradle and dependencies.
SauquetAlex Feb 20, 2023
421941f
Added directories
SauquetAlex Feb 20, 2023
5225503
Removed superflous docs
SauquetAlex Feb 20, 2023
ea0d9f6
Example of constants added. Ready for use!
SauquetAlex Feb 20, 2023
edb5cf2
Added Odometry documentation
BCNOFNeNaMg Feb 20, 2023
75feea6
Added FollowPoints documentation
BCNOFNeNaMg Feb 20, 2023
98b2e43
Fixed config.txt name
SauquetAlex Feb 20, 2023
9fc884c
Merge branch 'RevA' of https://github.com/Team766/2023 into swerveOdo…
BCNOFNeNaMg Feb 20, 2023
135078b
renamed constants for adrian
SauquetAlex Feb 20, 2023
a06b8ef
Added Input Constants
BCNOFNeNaMg Feb 20, 2023
c1527b3
Merge branch 'swerveOdometry' of https://github.com/Team766/2023 into…
BCNOFNeNaMg Feb 20, 2023
4cc79a0
Added swerveOdometry Code
BCNOFNeNaMg Feb 20, 2023
a77d350
Added quaver
BCNOFNeNaMg Feb 20, 2023
533fc34
Added a template for documentation and an image folder
SauquetAlex Feb 20, 2023
8885312
Wrong folder for template :)
SauquetAlex Feb 20, 2023
89f6a56
Update template
SauquetAlex Feb 21, 2023
d4805a9
Added swerve drive documentation
SauquetAlex Feb 21, 2023
8fbfa3c
Fixed changes requested by Alex
BCNOFNeNaMg Feb 21, 2023
f6fe0ae
Merge pull request #17 from Team766/OdometryRevA
SauquetAlex Feb 21, 2023
6240465
Added capability for rotating images
BCNOFNeNaMg Feb 28, 2023
de157cf
Added rotation
BCNOFNeNaMg Mar 2, 2023
f35e3c2
Added animations
BCNOFNeNaMg Mar 2, 2023
8fb9c0b
added constants
SauquetAlex Mar 4, 2023
7216eee
Added filter
BCNOFNeNaMg Mar 4, 2023
1ca79ae
Able to apply filter by adding "filter_" in OI
BCNOFNeNaMg Mar 4, 2023
9ef5730
Merge branch 'ImageDisplayer' of https://github.com/Team766/2023 into…
BCNOFNeNaMg Mar 4, 2023
0256c77
Added ability to display purple & yellow
BCNOFNeNaMg Mar 4, 2023
a443f2d
Added documentation
BCNOFNeNaMg Mar 4, 2023
a40266b
Renamed constants to consts
BCNOFNeNaMg Mar 4, 2023
ca34588
Merge pull request #20 from Team766/Capitalization-Fix
SauquetAlex Mar 4, 2023
67f9d2a
Renamed consts to constants
BCNOFNeNaMg Mar 4, 2023
ae81944
Merge pull request #21 from Team766/Capitalization-Fix
SauquetAlex Mar 4, 2023
94aa5bb
Fixed error resulting from unrecognized partial derivative symbol
BCNOFNeNaMg Mar 4, 2023
7bba535
Delete src/main/java/com/team766/robot/Constants directory
BCNOFNeNaMg Mar 4, 2023
27bda14
Deleted empty constant file
BCNOFNeNaMg Mar 4, 2023
78a257d
Merge branch 'RevA' of https://github.com/Team766/2023 into CANdleRevA
BCNOFNeNaMg Mar 4, 2023
e2d84bb
Added "off" to documentation
BCNOFNeNaMg Mar 4, 2023
8edac05
Reset OI
BCNOFNeNaMg Mar 4, 2023
6d5557e
Removed matrix from CANdleMech
BCNOFNeNaMg Mar 4, 2023
346e404
changed constants name
SauquetAlex Mar 9, 2023
e48405e
Merge branch 'main' into CANdleRevA
SauquetAlex Mar 9, 2023
58558b3
Merge pull request #24 from Team766/CANdleRevA
SauquetAlex Mar 9, 2023
d19fa73
Delete src/main/java/com/team766/robot/Constants directory
SauquetAlex Mar 9, 2023
f8b8f0b
Delete src/main/java/com/team766/robot/Constants directory
SauquetAlex Mar 9, 2023
6bf8907
fixed constants
SauquetAlex Mar 9, 2023
c42a655
Merge branch 'fixConstants' of https://github.com/Team766/2023 into f…
SauquetAlex Mar 9, 2023
ad146ef
Revert "Merge branch 'fixConstants' of https://github.com/Team766/202…
SauquetAlex Mar 9, 2023
97f6d84
HEEEEconstants
SauquetAlex Mar 9, 2023
35959b9
notHEEEE
SauquetAlex Mar 9, 2023
9dfab9a
Merge pull request #25 from Team766/fixConstants
SauquetAlex Mar 9, 2023
3918333
update build.gradle to 4.2
Mar 11, 2023
f1e75a3
Merge branch 'main' of https://github.com/Team766/2023 into SwerveDoc
SauquetAlex Mar 11, 2023
917093f
Merge branch 'main' of https://github.com/Team766/2023
Mar 11, 2023
fc9842e
Merge pull request #26 from Team766/SwerveDoc
BCNOFNeNaMg Mar 11, 2023
f4a29a0
initial revA bringup
Mar 12, 2023
0dfb69c
initial revA bringup, got drive working
Mar 12, 2023
2553cdd
Remove unnecessary import from OI
rcahoon Mar 13, 2023
93bee2e
Merge remote-tracking branch 'mf/master'
rcahoon Mar 13, 2023
7797b9b
Merge remote-tracking branch 'origin/main' into ryancahoon/main-compa…
rcahoon Mar 13, 2023
923a078
Merge branch 'main' into bringup
rajitzg Mar 16, 2023
1b726a6
Merge pull request #27 from Team766/bringup
rajitzg Mar 16, 2023
ca8cda4
Merge branch 'main' of https://github.com/Team766/2023 into ryancahoo…
rcahoon Mar 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id "java"
id 'java-library'
id 'maven-publish'
id "edu.wpi.first.GradleRIO" version "2023.4.1"
id "edu.wpi.first.GradleRIO" version "2023.4.2"
id 'com.google.protobuf' version '0.8.19'
}

Expand Down
53 changes: 53 additions & 0 deletions docs/FollowPoints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# The FollowPoints() Procedure

## What is FollowPoints?

FollowPoints is a procdure in which the robot follows a path of points. It does not find the robot's position, but utilizes another position-finding system (such as odometry).

## How does FollowPoints work?

FollowPoints utilizes the "Pure Pursuit" method. This method involves a circle drawn around the robot.

![Image](images/followPoints1.png)

At the start of the method, the robot moves towards the first point. In th above image, the robot would move towards Point 1.

![Image](images/followPoints2.png)

Once the circle around the robot intersects the line between Points 1 and 2, the robot starts to move toward the point where this line intersects the circle. In the image above, this is the purple point (the orange point is also a place where the circle and line intersect, but the robot will move towards the intersection point closest to Point 2). The robot will continue moving towards this point, moving closer to the line, until it reaches the line between Points 2 and 3, when it will start to follow that line. This procedure ensures the robot travels along a smooth curve.

## FollowPoints Customization Options

### Critical Points

Though it allows for a smooth curve, Pure Pursuit means that the robot won't actually reach any of the points, and will instead curve around them. It also means that if there are three consecutive and near-colinear points, the method will bypass the second point, as the robot will immediately intersect the line between the second and third points.

To remedy this, the `FollowPoints()` procedure allows for points to be specified as "critical points." The robot must reach a critical point before moving to the next point. The last point in a `FollowPoints()` procedure is always treated as a critical point, no matter if it is actually specified as one.

### Headers

All points are inputted as `PointDir` objects, which contain a header as an argument. The robot will rotate so it is facing the header of the point it is moving towards.

### Procedures

Optionally, an array of procedures may be provided as an input. If given, once the robot reaches a given point (or starts moving towards the next point in the case the point is not a critical point), it will run that procedure. The boolean `stopRobot` determines whether the robot will stop and wait for the procedure to finish before continuing.

## Desmos Integration

For the 2023 season, FollowPoints has been integrated with [the Desmos model of the field](https://www.desmos.com/calculator/v6mpw9cwbn).

![Image](images/desmosFieldModel.png)

To use this model, drag the points across the field. To make a point a critical point, click the red/gray dots at the bottom of the field (the first dot corresponds to the first point, the second to the second point, etc.). To change the heading at each point, click on the purple dot attached to each point to rotate it by 15 degrees. The model currently does not support procedures.

To add a new point, add its x- and y-coordinate to the table. Add a 0 or 1 to the c_p list corresponding to if the point is critical, and add an angle measure in degrees to the a list for the heading.

To export the path, open the console (Ctrl+Shift+J), scroll to the bottom of the Desmos equations list and copy-and-paste the code into the console. Copy-and-paste the resulting json format into the deploy folder (C:\Users\admin\Documents\GitHub\2023\src\main\deploy).

## Running FollowPoints()

There are several constructors accepted by FollowPoints():

* An array of PointDirs will provide a path, but will not allow for the specification of procedures or critical points.
* A string with the name of a json file will run the path generated by a Desmos model.
* A default constructor will run a path with provided "Steps," objects containing a PointDir, a "critical point" boolean, a procedure, and a "stop robot at procedure" boolean.
45 changes: 45 additions & 0 deletions docs/Odometry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Odometry

## What is Odometry?

Odometry is a method to calculate the position of the robot based on how far each of the wheels has traveled.

## How does Odometry work?

On a swerve drive-bot, each wheel can both spin and rotate. We use this to estimate where each robot has traveled. Each wheel keeps track of how far it has traveled, as well as its heading, and we use this to calculate the position of each wheel.

![Image](images/odometry_wheel.png)

Given a wheel's starting position, distance traveled, and angle change, an arc is used to estimate the new x- and y-positions of that wheel. Once positions for all four wheels are calculated, they are averaged to find the new position of the robot.

## Benefits of Odometry

* **It does not require any external hardware.** Odometry is entirely based on the wheels, and does not require any cameras or lights, and so will rarely break. This leaves it as a robust backup in case another position-finding system fails.
* **It works fast.** Odometry can easily run at 100 or even 1000 times per second, meaning it can be used in the times between updates from another position-finding system.

## Limitations of Odometry

* **It is highly dependent on how accurately the circumference of the wheel can be measured.** Even a small error can lead to odometry thinking the robot is meters away from where it actually is.
* **Error compounds over time.** Unlike other forms of position-finding, odometry error only gets worse the longer the robot is driven. This puts odometry as best used in-combination with another form of position-finding.
* **Wheel slippage leads to huge amounts of error.** Odometry assumes there is no wheel slippage, and that if a wheel spins once, it has traveled the length of its circumference. If the robot runs into an object but the wheels keep spinning, the position will be thrown off.

## How to use Odometry

Odometry should be run in the Drive.java mechanism, which allows it to work even when Tele-Op is turned off.

### Initialization

To initialize Odometry, use the constructor
`swerveOdometry(MotorController[] motors, CANCoder[] CANCoders, Point[] wheelLocations, double wheelCircumference, double gearRatio, int encoderToRevolutionConstant, double rateLimiterTime)`.

* motorList, CANCoderList, and wheelLocations should contain arrays with an element corresponding to each wheel in the same order.
* gearRatio and encoderToRevolutionConstant are dependent on the swerve module.
* rateLimiterTime is how often odometry should run. The faster it runs, the more accurate it will be, but the more memory it takes up.

### Running Odometry

To use odometry, set a PointDir object equal to the `odometry.run()` method within `Robot.drive.run()`.

### Integrating Odometry with other Position-Finding Methods

Use the `setCurrentPosition(Point P)` method to set the odometry current position to a position found from another source.
16 changes: 16 additions & 0 deletions docs/Point and PointDir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Point and PointDir

## What are Point and PointDir?

Point and PointDir are two classes which make it easy to represent a position with or without a heading. PointDir inherits from Point.

## How to use Point and PointDir

Points have an x-coordinate and a y-coordinate, which can be accessed via `getX()` and `getY()`. PointDir additionally has a heading, which can be accessed via `getHeading()`.

Point has several useful methods:

* `distance(Point a)` returns the distance between the current point and `a`.
* `slope(Point a)` returns the slope of the line between the current point and `a`. It has a maximum and minimum of ±1000.
* `add(Point a)` returns a point with an whose coordinates are the sums of the corresponding coordinates of the current point and `a`.
* `scaleVector(Point inputPoint, double scale)` returns a point whose coordinates are the coordinates of a vector between the current point and `inputPoint`, scaled to have a length of `scale`.
57 changes: 57 additions & 0 deletions docs/SwerveDrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Swerve Drive

## What is swerve drive?

Swerve drive is a type of drive train that allows for independent control of each wheel. This allows for the robot to move in any direction, and rotate in place. It also allows for the robot to move sideways or rotate while moving linearly, which is useful for some games.

## How does swerve drive work?

Swerve drive works by having each wheel connected to a motor that can rotate 360 degrees. Each wheel has a steering and a driving motor. The steering motor rotates the wheel, and the driving motor rotates the wheel and the robot.

Here is an example of a swerve drive module (mk4i):

![Image](images/swervedrive.png)

As you can see, there are 2 motors which control the orientation and speed of the wheel. There is also an absolute encoder that allows the robot to know the orientation of the wheel even after it is fully turned off.

When 4 of these modules are connected to a robot, it can move in any direction and rotate in place by using vector addition.

Strafing is the process of moving in 2 dimentions by orienting all of the wheels at the same angle and moving them at the same speed.

Rotating is the process of rotating in place by orienting all of the wheels at 90 degrees angles from each other and then turning them at the same speed.

When strafing and rotating are done at the same time, we get a vector sum of the two vectors for each wheel (speed is a magnitude while orientation is well, orientation). Since rotatin and strafing are going to be different for each wheels, the robot is able to move while rotating.

One caveat is that the added vectors could be greater than 1, there, we need to scale all of the vectors down.

## Benefits of swerve drive

* **Agility.** Because swerve can move in any directions and rotate, it is very easy to avoid defense from other robots. It is also easier to move around the field and score points for most objectives.
* **Modular.** Because swerve drive modules are modular, the robot is easily repairable It is also possible to drive the robot with only 3 modules working (if one module is broken during a match for example).

## Limitations of sweve drive

* **Very complex.** Because of the complex nature of swerve drive, the code is to read or understand. Moreover, the chance of something going wrong is high.
* **Draws a lot of power.** Swerve drive uses 8 motors at once, which draw a lot of power, it is **nessessary** to prepare the amount of amps drawn by each motor on the robot.

## How to use swerve drive

Call the `swerveDrive` procedure in the `Drive` mechanism. This procedure takes 3 parameters:

* `x` - The x component of the vector to move in.
* `y` - The y component of the vector to move in.
* `rotation` - The amount to rotate the robot.

You can also inpute a pointDir, but this should only be used for `FollowPoints`.
### Initialization

Calling `Drive()` will initialize the mechanism. This will initialize the motors and the encoders.

### Running swerveDrive

To use the mecanism, call the `swerveDrive` method. You can simply use joysticks as inputs.
No procedures are needed for swerve, all is containted in the `Drive.java` mechanism.

### Integrating Mechanism with other code

Thanks to the option to add a pointDir in the method `swerveDrive`, it is possible to use swerve drive with `FollowPoints` (or another procedure).
9 changes: 9 additions & 0 deletions docs/candle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# A Simple Guide on Using CANdle to Display Single Colors

Use `Robot.candle.setColor(int r, int g, int b);` to display single colors on the CANdle.

**Yellow:** R: 255 G: 255 B: 0

**Purple:** R: 255 G: 0 B: 255

**Off** R: 0 G: 0 B: 0
Binary file added docs/images/desmosFieldModel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/followPoints1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/followPoints2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/odometry_wheel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/swervedrive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/main/deploy/FollowPoints.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"points": [
{
"coordinates": [1, 0, 0],
"critical": false,
"procedure": {
"name" : "DoNothing()",
"stop" : false
}
}
]
}
4 changes: 2 additions & 2 deletions src/main/java/com/team766/hal/GenericRobotMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ public void teleopInit() {
m_autonMode = null;
}

if (m_oiContext == null) {
if (m_oiContext == null && m_oi != null) {
m_oiContext = Scheduler.getInstance().startAsync(m_oi);
}
}

public void teleopPeriodic() {
if (m_oiContext.isDone()) {
if (m_oiContext != null && m_oiContext.isDone()) {
m_oiContext = Scheduler.getInstance().startAsync(m_oi);
Logger.get(Category.OPERATOR_INTERFACE).logRaw(Severity.WARNING, "Restarting OI context");
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/team766/hal/RobotProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class RobotProvider {
public static RobotProvider instance;

protected EncoderReader[] encoders = new EncoderReader[20];
protected SolenoidController[] solenoids = new SolenoidController[10];
protected SolenoidController[] solenoids = new SolenoidController[20];
protected GyroReader[] gyros = new GyroReader[13];
protected HashMap<String, CameraReader> cams = new HashMap<String, CameraReader>();
protected JoystickReader[] joysticks = new JoystickReader[8];
Expand Down Expand Up @@ -212,7 +212,7 @@ public DoubleSolenoid getSolenoid(String configName) {
.toArray(SolenoidController[]::new));
return new DoubleSolenoid(forwardSolenoids, reverseSolenoids);
} catch (IllegalArgumentException ex) {
Logger.get(Category.CONFIGURATION).logData(Severity.ERROR, "Solenoid %s not found in config file, using mock solenoid instead", configName);
Logger.get(Category.CONFIGURATION).logData(Severity.ERROR, "Solenoid %s not found in config file, using mock solenoid instead %s", configName, ex.toString());
return new DoubleSolenoid(null, null);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/team766/hal/wpilib/Solenoid.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

public class Solenoid extends edu.wpi.first.wpilibj.Solenoid implements SolenoidController {
public Solenoid(int channel) {
super(PneumaticsModuleType.CTREPCM, channel);
super(PneumaticsModuleType.REVPH, channel);
}
}
10 changes: 9 additions & 1 deletion src/main/java/com/team766/hal/wpilib/WPIRobotProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import edu.wpi.first.util.WPIUtilJNI;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.I2C;
import edu.wpi.first.wpilibj.PneumaticHub;
import edu.wpi.first.wpilibj.PneumaticsControlModule;
import edu.wpi.first.wpilibj.RobotController;
import edu.wpi.first.wpilibj.SPI;
Expand Down Expand Up @@ -94,6 +95,12 @@ public void run() {
public WPIRobotProvider() {
m_dataRefreshThread = new Thread(m_DataRefreshRunnable, "DataRefreshThread");
m_dataRefreshThread.start();

try {
ph.enableCompressorAnalog(80, 100);
} catch (Exception ex) {
LoggerExceptionUtils.logException(ex);
}
}

private MotorController[][] motors =
Expand All @@ -102,6 +109,7 @@ public WPIRobotProvider() {
// The presence of this object allows the compressor to run before we've declared any solenoids.
@SuppressWarnings("unused")
private PneumaticsControlModule pcm = new PneumaticsControlModule();
private PneumaticHub ph = new PneumaticHub();

@Override
public MotorController getMotor(int index, String configPrefix, MotorController.Type type,
Expand All @@ -128,7 +136,7 @@ public MotorController getMotor(int index, String configPrefix, MotorController.
motor = new CANVictorMotorController(index);
break;
case TalonFX:
final ValueProvider<String> CANBus = ConfigFileReader.getInstance().getString(type + ".CANBus");
final ValueProvider<String> CANBus = ConfigFileReader.getInstance().getString(configPrefix + ".CANBus");
motor = new CANTalonFxMotorController(index, CANBus.get());
break;
case VictorSP:
Expand Down
Loading