Skip to content

limelight #11

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

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
05d7bd5
Hghhgn
FriedLongJohns Jan 15, 2025
97e63d2
bug fixes
timtogan Jan 18, 2025
3d72d22
//BabyMode
Niosocket11 Jan 18, 2025
3d4ce23
kSlowNormalBaby Drive and Rot
Niosocket11 Jan 18, 2025
6add2e8
BabyMode un//
Niosocket11 Jan 18, 2025
54f1b76
Got missing stuff added, plus overall cleaner code
Niosocket11 Jan 22, 2025
1e55ae0
Fixed AHRS
Niosocket11 Jan 26, 2025
89fc78e
Adhit Das Commit: Fixed ~30 Drivetrain errors
DriverStationComputer Jan 29, 2025
b4fa953
Fixed SysId and part of measure
Niosocket11 Feb 1, 2025
a6f55cb
Mutable Measure fixed
Niosocket11 Feb 1, 2025
ed1346f
Fixed Drivetrain Port for Gyro
Kenneth-Choothakan Feb 1, 2025
ed71b66
Merge branch 'drivetrain' of https://github.com/DeepBlueRobotics/Robo…
Kenneth-Choothakan Feb 1, 2025
47c642a
Fixed .per thing for time on Drivetrain
Kenneth-Choothakan Feb 1, 2025
aaa5e3f
mutable fully fixed
Niosocket11 Feb 1, 2025
a8ceeec
Merge branch 'drivetrain' of https://github.com/DeepBlueRobotics/Robo…
Niosocket11 Feb 1, 2025
419fb82
Update Drivetrain.java
Niosocket11 Feb 1, 2025
4533dcf
Port gyro fixed
Kenneth-Choothakan Feb 1, 2025
f02f32b
Fixed the .per timeunit line
Kenneth-Choothakan Feb 1, 2025
2f0fc06
Created limelighthelper subystem and rotateRelative command and added…
Kenneth-Choothakan Feb 1, 2025
397764b
Fixed some things in robot container
Kenneth-Choothakan Feb 1, 2025
bacfacc
Final fixes
Niosocket11 Feb 1, 2025
78b6ae7
Wheel base and trackwidth added
Niosocket11 Feb 1, 2025
b5aa93e
Changed motors to new rev lib ones
DriverStationComputer Feb 1, 2025
2f141a8
Added temporary pid testing code to guess and check later
DriverStationComputer Feb 1, 2025
451085c
Updated LimelightHelpers.
DriverStationComputer Feb 2, 2025
1cd5156
Limelight yeeted
Niosocket11 Feb 2, 2025
d746032
Merge branch 'drivetrain' of https://github.com/DeepBlueRobotics/Robo…
DriverStationComputer Feb 2, 2025
fa7c6ac
Very short commit, just changed helpers
DeepBlueRobots Feb 5, 2025
a68d948
Changed pid c so it matches turn motor configuration
Kenneth-Choothakan Feb 5, 2025
0a564b3
added 4 pid controllers for turn in an array named turnPidControllers
Kenneth-Choothakan Feb 8, 2025
a5ba3a7
Mostly ported last year's limelight code into code for just one Limel…
AdhitDasDeepBlue Feb 18, 2025
2e5bb15
There were a bunch of syntax/spelling issues in the code, as I was no…
AdhitDasDeepBlue Feb 19, 2025
5bf5896
Fixed all the errors in Limelight subsystem! There are still issues i…
AdhitDasDeepBlue Feb 19, 2025
8babae0
consistent metrics
Niosocket11 Feb 19, 2025
458cc50
I made a distance to reef method. I should really improve it, it's me…
AdhitDasDeepBlue Feb 23, 2025
4e6eaab
Merge branch 'limelight' of https://github.com/DeepBlueRobotics/Robot…
AdhitDasDeepBlue Feb 23, 2025
d8211fb
hell yeah!!!
stwiggy Feb 26, 2025
5462f16
added camera
DriverStationComputer Feb 26, 2025
a07c0c4
merged drivetrain + karena fix your constants
stwiggy Mar 2, 2025
061dd23
reminder to fix constants!
stwiggy Mar 2, 2025
8497db9
added strafing to the left/right, check math when not sleepy
stwiggy Mar 8, 2025
2381c84
timer
stwiggy Mar 11, 2025
5537b2e
pretest commits
stwiggy Mar 13, 2025
0856d9c
Some adhit code
Kenneth-Choothakan Mar 26, 2025
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
39 changes: 39 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/java
{
"name": "Java",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/java:1-17-bookworm",

"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "none",
"installMaven": "false",
"installGradle": "true"
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"redhat.java",
"ms-vscode.cpptools",
"vcjava.vscode-java-debug",
"ms-toolsai.jupyter",
"vcjava.vscode-java-dependency"
]
}
},

"postAttachCommand": "./.devcontainer/installWPILibExtension.sh && exit"

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
7 changes: 7 additions & 0 deletions .devcontainer/installWPILibExtension.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Modified from ChatGPT suggestions
WPILIB_VSIX_URL=$(curl -s "https://api.github.com/repos/wpilibsuite/vscode-wpilib/releases/latest" | jq -r '.assets[] | select(.name | test(".vsix$")) | .browser_download_url')
INSTALL_LOCATION="/tmp/wpilib-extension/latest.vsix"
echo "$WPILIB_VSIX_URL"
curl --create-dirs -L -o "$INSTALL_LOCATION" "$WPILIB_VSIX_URL"
code --install-extension "$INSTALL_LOCATION"

14 changes: 14 additions & 0 deletions .pathplanner/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"robotWidth": 0.9,
"robotLength": 0.9,
"holonomicMode": true,
"pathFolders": [
"Center Limelight 4 Piece"
],
"autoFolders": [],
"defaultMaxVel": 3.0,
"defaultMaxAccel": 3.0,
"defaultMaxAngVel": 540.0,
"defaultMaxAngAccel": 720.0,
"maxModuleSpeed": 4.5
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
6 changes: 6 additions & 0 deletions .wpilib/wpilib_preferences.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"enableCppIntellisense": false,
"currentLanguage": "java",
"projectYear": "2024",
"teamNumber": 199
}
45 changes: 45 additions & 0 deletions src/main/java/org/carlmontrobotics/BuildInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package org.carlmontrobotics;

import java.util.Properties;
import java.io.File;
import java.io.InputStream;
import java.nio.file.Path;
import java.nio.file.Files;

import edu.wpi.first.util.sendable.Sendable;
import edu.wpi.first.util.sendable.SendableBuilder;
import edu.wpi.first.wpilibj.Filesystem;

public class BuildInfo implements Sendable {
private Properties props = new Properties();

static private BuildInfo instance = null;

public static BuildInfo getInstance() {
if (instance == null) {
instance = new BuildInfo();
}
return instance;
}

private BuildInfo() {
Path path = Path
.of(Filesystem.getDeployDirectory().getAbsolutePath() + File.separator + "BuildInfo.properties");
try (InputStream is = Files.newInputStream(path)) {
props.load(is);
} catch (Exception ex) {
System.err.println("Error reading build properties from %s".formatted(path));
}
}

@Override
public void initSendable(SendableBuilder builder) {
props.stringPropertyNames().forEach(name -> {
var value = props.getProperty(name);
// Workaround bug (https://github.com/lessthanoptimal/gversion-plugin/pull/14)
// where the gversion plugin surrounds values with quotes.
value = value.replaceAll("\"", "");
builder.publishConstString(name, value);
});
}
}
119 changes: 119 additions & 0 deletions src/main/java/org/carlmontrobotics/Config.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
package org.carlmontrobotics;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;

import edu.wpi.first.util.sendable.Sendable;
import edu.wpi.first.util.sendable.SendableBuilder;

public abstract class Config implements Sendable {
public static final Config CONFIG = new Config() {
{
// Override config settings here, like this:
// this.exampleFlagEnabled = true;

// NOTE: PRs with overrides will NOT be merged because we don't want them
// polluting the master branch.
// Feel free to add them when testing, but remove them before pushing.
}
};

// Add additional config settings by declaring a protected field, and...
protected boolean exampleFlagEnabled = false;
protected boolean swimShady = false;
protected boolean setupSysId = false;
protected boolean useSmartDashboardControl = false; // whether to control arm position + rpm of
// outtake through SmartDashboard
// Note: disables joystick control of arm and
// outtake command if
// using SmartDashboard

// ...a public getter starting with "is" for booleans or "get" for other types.
// Do NOT remove this example. It is used by unit tests.

public boolean isExampleFlagEnabled() {
return exampleFlagEnabled;
}

public boolean isSwimShady() {
return swimShady;
}

public boolean isSysIdTesting() {
return setupSysId;
}

public boolean useSmartDashboardControl() {
return useSmartDashboardControl;
}

// --- For clarity, place additional config settings ^above^ this line ---

private static class MethodResult {
String methodName = null;
Object retVal = null;
Object defaultRetVal = null;

MethodResult(String name, Object retVal, Object defaultRetval) {
this.methodName = name;
this.retVal = retVal;
this.defaultRetVal = defaultRetval;
}
}

private List<MethodResult> getMethodResults() {
var methodResults = new ArrayList<MethodResult>();
var defaultConfig = new Config() {
};
for (Method m : Config.class.getDeclaredMethods()) {
var name = m.getName();
if (!Modifier.isPublic(m.getModifiers()) || m.isSynthetic() || m.getParameterCount() != 0
|| !name.matches("^(get|is)[A-Z].*")) {
continue;
}
Object retVal = null;
try {
retVal = m.invoke(this);
} catch (Exception ex) {
retVal = ex;
}
Object defaultRetVal = null;
try {
defaultRetVal = m.invoke(defaultConfig);
} catch (Exception ex) {
defaultRetVal = ex;
}
methodResults.add(new MethodResult(name, retVal, defaultRetVal));
}
return methodResults;
}

@Override
public void initSendable(SendableBuilder builder) {
getMethodResults().forEach(mr -> {
if (!mr.retVal.equals(mr.defaultRetVal)) {
builder.publishConstString("%s()".formatted(mr.methodName),
String.format("%s (default is %s)", mr.retVal, mr.defaultRetVal));
}
});
}

@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
getMethodResults().forEach(mr -> {
if (!mr.retVal.equals(mr.defaultRetVal)) {
stringBuilder.append(
String.format("%s() returns %s (default is %s)", mr.methodName, mr.retVal, mr.defaultRetVal));
}
});
if (stringBuilder.isEmpty()) {
stringBuilder.append("Using default config values");
} else {
stringBuilder.insert(0, "WARNING: USING OVERRIDDEN CONFIG VALUES\n");
}
return stringBuilder.toString();
}
}
Loading