Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
639aa9e
initial stages
therekrab May 3, 2025
6ffd51f
Incorporate autopilot and add more states
therekrab May 3, 2025
86b251c
Add final states and operator bindings
therekrab May 3, 2025
63373d0
Run formatter on Superstructure.java
therekrab May 3, 2025
060fb2d
Add javadoc to Superstructure.enter()
therekrab May 4, 2025
15ee77a
Reformat LEDs; Add PassiveSubsystem extension
therekrab May 4, 2025
bdf3273
removed empty line
therekrab May 4, 2025
7eeae86
Add Modifer interface
therekrab May 4, 2025
8d8f2d9
Add passive intake-completion behavior for CoralRollers
therekrab May 4, 2025
180dc3a
Move LED logic to passive
therekrab May 4, 2025
dbfe6eb
Add elevator prefire
therekrab May 4, 2025
b75a7ed
Tested;Improved;Updated
therekrab May 4, 2025
1fd4b1d
Revert back to basic autopilot
therekrab May 4, 2025
8e826a4
Started working on named commands
therekrab May 5, 2025
ca60431
Recalibrate steer
May 6, 2025
e60c6d3
made progress
therekrab May 9, 2025
12614df
Add remaining named commands; fix command sequencing
therekrab May 10, 2025
8157196
Clean autopilot logic
therekrab May 10, 2025
e89b4ce
Create NT groups
therekrab May 10, 2025
46f9609
Remove Shape class
therekrab May 10, 2025
91c5ed1
Extract VisionConstants
therekrab May 11, 2025
e5a2f65
Remove unused CANrangeConstants
therekrab May 11, 2025
ae2ddec
Extract algae constants
therekrab May 11, 2025
3f215e0
Extract VisionConstants
therekrab May 11, 2025
4c07893
Extract CoralConstants
therekrab May 11, 2025
9ff0d37
Create elevator package
therekrab May 11, 2025
bf0077b
Extract elevator constants
therekrab May 11, 2025
9a88e28
Remove unused method in drivetrain
therekrab May 11, 2025
82afaf2
Passive behavior should not take itself
therekrab May 11, 2025
9c82743
Add call to take() after any setters in subsystems with passive behavior
therekrab May 11, 2025
a58d0ca
Add pivot package; extract pivot constants
therekrab May 11, 2025
d9f9d92
Add passive behavior and releases for algae
therekrab May 11, 2025
88fe790
Working auto in sim
therekrab May 11, 2025
9256ec3
Create drivetrain package; Extract drive constants
therekrab May 12, 2025
ffb22fb
Unbreak force field
therekrab May 12, 2025
e0e7a46
attempting to improve align jitter
May 12, 2025
e82dbb2
new stuff
May 12, 2025
c82c9f5
fix intake
May 13, 2025
ec7e785
Fully track applied voltage
therekrab May 13, 2025
6743de5
Improve autozero logic
therekrab May 13, 2025
b353ba6
Reformat constant files to match kConvention
therekrab May 13, 2025
a98b906
Implement super coral
therekrab May 13, 2025
109cd84
Update CTRE to latest; build IO for algae
therekrab May 14, 2025
badd489
Add IO interfacing to remaining subsystems
therekrab May 14, 2025
a2770c6
Add javadoc to APProfile and replace I/U with path/correction
therekrab May 14, 2025
ba405ab
fix lots of real life errors
May 14, 2025
8462ce1
liking the auton
May 15, 2025
9cf44ac
Working on getting better vision handling
therekrab May 15, 2025
85503d9
Add jerk control to autopilot
therekrab May 15, 2025
bbf9883
Add rotation radius to autopilot and useful in auton
therekrab May 15, 2025
6a46ff2
Cache status signals and only refresh once per loop
therekrab May 15, 2025
736e7fd
Improve vision logic
therekrab May 16, 2025
495c8cc
Merge branch 'vision' into rewrite
therekrab May 17, 2025
209b427
Rename pieceHeld to coralHeld in robot observer
therekrab May 17, 2025
4d3dbf8
Fix memory copy error with APTarget; add beeline-to-intake
therekrab May 17, 2025
69588b0
Add network vision logger; add recalibrate to auton
therekrab May 18, 2025
627a68a
Centralized call to refresh status signals
therekrab May 18, 2025
07756dd
Add code to register ALL status signals
therekrab May 18, 2025
72326e9
Add loop tracking and enable DataLogManager
therekrab May 18, 2025
07a2155
Add manual pose setters as backup options for start of match
therekrab May 18, 2025
18b4e33
Test, test, test
May 20, 2025
763794e
disable smart dashboard things; remove unused autons
May 21, 2025
b86869d
remove additional NT writes
May 21, 2025
a7177a0
Optional multiInputFilter
therekrab May 21, 2025
b7784dd
Add multiInput use while disabled
therekrab May 21, 2025
3494941
Fix buttons
May 21, 2025
4fa9672
Merge branch 'rewrite' of https://github.com/hackbots-3414/2025_Reefs…
May 21, 2025
eea1a6b
Add magical 6328 build.gradle "improvements"
therekrab May 22, 2025
3681a61
Merge branch 'rewrite' of https://github.com/hackbots-3414/2025_Reefs…
therekrab May 22, 2025
752ebc5
Increase vision trust
May 22, 2025
74e3d96
Move all nonessential logging to DataLog for onboard logging
therekrab May 23, 2025
f441ec2
Merge branch 'rewrite' into datalog; add pose logging
therekrab May 24, 2025
25df1dd
Replace more SmartDashboard outputs with OnboardLoggers
therekrab May 24, 2025
b14902f
Add vision logging
therekrab May 24, 2025
5058017
Change logging settings for vision
therekrab May 24, 2025
b5a1f0e
Remove unused graph from simgui
therekrab May 24, 2025
2d261cc
Clean up old stuff in TimestampedVisionEstimate
therekrab May 24, 2025
6a77202
Fix aligned bug and move binding constants out of constants.java
therekrab May 25, 2025
f52364d
Use Commands.idle() rather than our impl
therekrab May 25, 2025
f0bd702
Change starting positions for auton to be flat against the line
May 28, 2025
6694972
Add left align and right align to drive controller & fix constant names
May 28, 2025
d250c00
Revert LED name search
May 28, 2025
cd51cd8
Refresh status signals BEFORE acting on them
May 29, 2025
b4c6d1c
Remove test commands from DashboardBindings
May 29, 2025
bd878c7
Rename constant to match conventions
therekrab Jun 1, 2025
f371f25
Update with remote version
therekrab Jun 1, 2025
aff4d41
Extract beeline radius magic number to a real constant
therekrab Jun 1, 2025
b447740
Update method withReference to avoid confusion
therekrab Jun 2, 2025
85dac37
Fix errors and add testing path
therekrab Jun 2, 2025
8179644
Merge new updates
therekrab Jun 2, 2025
7577f20
Rename constants to match correct standards
Jun 2, 2025
f56277e
Use this modifier
Jun 2, 2025
9bf0e12
Improve documentation and naming for Autopilot
therekrab Jun 8, 2025
0fb42aa
Fully implement velocity limit
therekrab Jun 9, 2025
951737e
Add controller for advantage scope, still need joysticks
Jun 9, 2025
fdf5c1e
Reduce calls to Math.log in Autopilot swirly length computation
therekrab Jun 10, 2025
c04745f
Complete AdvantageScope custom controller config for dragon reins
therekrab Jun 10, 2025
64b01ab
Use alerts to show camera connection status
therekrab Jun 10, 2025
7f22e48
Add autopilot!!
therekrab Jun 13, 2025
4d41a0d
Extract Autopilot dependency to separate library
therekrab Jun 14, 2025
51e3cee
Remove leftover Autopilot class
therekrab Jun 14, 2025
30fdff7
Bump Autopilot to v1.2.0
therekrab Jun 15, 2025
6ce742f
bump autopilot -> 1.2.1
therekrab Jun 16, 2025
44b8ba0
Rewrite force field to be less general and easier to debug
therekrab Jun 18, 2025
95858fc
Apply formatting
therekrab Jun 18, 2025
a3db534
Modify Superstructure.enter() to always proxy its commands.
therekrab Jun 19, 2025
c5c4aef
Add more realistic elevator simulation
therekrab Jun 19, 2025
250656b
Add more realistic simulation for pivot
therekrab Jun 19, 2025
44db59a
Fix intake completion issue in auton
therekrab Jun 19, 2025
25959a2
Fix force field
therekrab Jun 19, 2025
a1377ac
Fix coordinate-frame bug with force field
therekrab Jun 20, 2025
7acb934
Rename states for consistency
therekrab Jun 20, 2025
80fa4e9
Rename Coral.holding to Coral.held
therekrab Jun 24, 2025
4cae782
remove Elevator and Coral SmartDashboard puts
therekrab Jun 25, 2025
c30b132
Make HighGroundAlgaeIntake intake at High ground height for elevator
therekrab Jun 25, 2025
749d3bb
Change format of high ground position to held drive team
therekrab Jun 25, 2025
15d3a18
Ensure elevator moves before pivot in algae intake
therekrab Jun 25, 2025
af7d7f1
Update UpperReefAlgaeIntake.java
therekrab Jun 25, 2025
44e6c1c
Add different angle for pivot for lollipop intake
therekrab Jun 25, 2025
88ebc9d
Use new angle
therekrab Jun 25, 2025
d26e5e4
Changes
Jun 25, 2025
6cb21d7
slow down sim elevator
therekrab Jun 25, 2025
994170c
Fix trigger bug breaking algae
therekrab Jun 26, 2025
840eb9d
Fix logback.xml
therekrab Jun 26, 2025
c3cfe30
Fix formatting
therekrab Jun 30, 2025
cda9341
Remove unused BargeTest.auto
therekrab Jun 30, 2025
5310da2
Clean up resolved todos, remove unused imports
therekrab Jun 30, 2025
e231abd
Only run command logging in simulation
therekrab Jun 30, 2025
1654d45
Add python auto builder from kettering branch
therekrab Jun 30, 2025
0b52d7e
Fix center auto, hopefully works.
therekrab Jun 30, 2025
2d55567
Implement basic algae tracking, via PhotonVision
therekrab Jun 30, 2025
16d7d89
add error
therekrab Jun 30, 2025
92cc356
Break vision and apriltag logic down into separate sections
therekrab Jun 30, 2025
6fca66a
Fix imports; move connection logging to CameraIOInputsLogger
therekrab Jun 30, 2025
3ad1474
improve code
therekrab Jun 30, 2025
bd0db19
Pose estimation for algae
therekrab Jul 1, 2025
f51918f
Organize imports
therekrab Jul 2, 2025
38a2bb6
Improve ability to disable bits
therekrab Jul 2, 2025
b782732
Disable algae tracking, for now
therekrab Jul 2, 2025
5390592
Disable wireframe in simulation
therekrab Jul 2, 2025
f3ea2c6
Add option to disable non-reef tags
therekrab Jul 2, 2025
8c1c74c
Add automatic climb prep
therekrab Jul 2, 2025
e7b758a
Add rotational speed limiting for m_veloRequest
therekrab Jul 3, 2025
18b7aeb
Algae present OR elevator up makes robot turn slowly in alignment
therekrab Jul 7, 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
314 changes: 314 additions & 0 deletions ThriftyTest/autons/auto-builder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,314 @@
# A script to generate pathplanner .auto files from a much more simple auto file.
"""
syntax:
Command names are written without quotes. Nontrivial spaces (between regular characters) will be
respected.
To join commands in a sequential command group, use the + operator.
To join commands in a parallel command group, use the & operator.
To join commands in a race group, use the * operator
To join commands in a deadline group, use the ? operator
To make sure that any nesting is done properly, use parens to explicity
define order of operations
Multiple lines in a file are different commands running in sequence

You can leave comments with the # sign. Anything after the # sign is ignored.
Comments MUST BE ON THEIR OWN LINE

Here's a command that runs A and B in parallel, then runs C:

(A & B) + C

This command runs A, B, and C in sequence, in a race group with D:

(A + B + C) * D

The outputted json is pathplanner-ready and can be saved to src/main/deploy/pathplanner/autos/<NAME>.auto
"""

from enum import Enum
from io import UnsupportedOperation
import sys

if len(sys.argv) != 2:
print(f"Usage: {sys.argv[0]} [filename]")
sys.exit(1)

filename = sys.argv[1]

file = open(filename, "r")
text = list(map(lambda s: s.strip(), file.readlines()))
file.close()

class Token(Enum):
OPEN_PAREN = "("
CLOSE_PAREN = ")"
PLUS = "+"
AND = "&"
DEADLINE = "?"
RACE = "*"

def __repr__(self):
return f"('{self.value}')"

TOKENS = [Token.OPEN_PAREN.value, Token.CLOSE_PAREN.value, Token.PLUS.value, Token.AND.value, Token.DEADLINE.value, Token.RACE.value]

class Scanner:
def __init__(self, source):
self.start = 0
self.current = 0
self.tokens = []
self.source = source

def scan(self):
while self.start < len(self.source):
self.scan_token()
self.start = self.current

def scan_token(self):
c = self.source[self.current]
self.current += 1
match c:
case Token.OPEN_PAREN.value:
self.tokens.append(Token.OPEN_PAREN)
case Token.CLOSE_PAREN.value:
self.tokens.append(Token.CLOSE_PAREN)
case Token.PLUS.value:
self.tokens.append(Token.PLUS)
case Token.AND.value:
self.tokens.append(Token.AND)
case Token.DEADLINE.value:
self.tokens.append(Token.DEADLINE)
case Token.RACE.value:
self.tokens.append(Token.RACE)
case '#':
self.comment()
case _:
# assume it's an identifier, so run ident
self.ident()

def comment(self):
# ignore the rest of the thing
self.current = len(self.source)

def ident(self):
while self.current < len(self.source) and self.source[self.current] not in TOKENS:
self.current += 1
# consume the last character
s = self.source[self.start:self.current].strip()
if s:
self.tokens.append(Named(s))

class Command:
def __init__(self, kind):
self.kind = kind

def andThen(self, other):
if other.kind == Sequential.kind:
return other.andThen(self)
return Sequential([self, other])

def alongWith(self, other):
if other.kind == Parallel.kind:
return other.alongWith(self)
return Parallel([self, other])

def deadlineFor(self, other):
if other.kind == Parallel.kind:
return Deadline([self] + other.inner)
return Deadline([self, other])

def raceWith(self, other):
if other.kind == Race.kind:
return other.raceWith(self)
cmds = []
if other.kind == Parallel.kind:
cmds += other.inner
else:
cmds.append(other)
cmds.append(self)
return Race(cmds)

def json(self):
raise NotImplementedError("json() method not implemented on general class type")

def __repr__(self):
return f"<{self.kind}>";

class GroupCommand(Command):
def __init__(self, cmds=[]):
self.inner = cmds

def json(self):
return f'{{"type":"{self.kind}","data":{{"commands":[{",".join(map(lambda c: c.json(), self.inner))}]}}}}'

def __repr__(self):
return f"[{self.kind[:3].upper()} {','.join(map(lambda c: str(c), self.inner))}]"

class Sequential(GroupCommand):
kind = "sequential"

def andThen(self, other):
if other.kind == Sequential.kind:
self.inner += other.inner
return self
self.inner.append(other)
return self

class Parallel(GroupCommand):
kind = "parallel"

def alongWith(self, other):
if other.kind == Parallel.kind:
self.inner += other.inner
return self
self.inner.append(other)
return self

def raceWith(self, other):
if other.kind == Race.kind:
return other.raceWith(self)
if other.kind == Parallel.kind:
return Race(self.inner + other.inner)
return Race([other] + self.inner)

class Race(GroupCommand):
kind = "race"

def raceWith(self, other):
if other.kind == Parallel.kind or other.kind == Race.kind:
self.inner += other.inner
self.inner.append(other)
return self

class Deadline(GroupCommand):
kind = "deadline"

def deadlineFor(self, other):
if other.kind == Deadline.kind:
raise UnsupportedOperation("Deadline cannot have two deadlines")
if other.kind == Parallel.kind:
self.inner += other.inner
else:
self.inner.append(other)
return self

class Named(Command):
kind = "named"

def __init__(self, name):
self.name = name

def __repr__(self):
return f"<{self.name}>"

def json(self):
return f'{{"type":"named","data":{{"name":"{self.name}"}}}}'

class Parser:
def __init__(self, tokens):
self.tokens = tokens
self.current = 0
self.tree = Sequential()

def find_groups(self, tokens):
# look for first parenthesis in the group.
i = 0
while i < len(tokens):
if tokens[i] == Token.OPEN_PAREN:
break;
i += 1
else:
# never left the loop, no parenthesis found
return self.condense(tokens)
# we now know that a parenthesis is found at index i.
j = i + 1
offset = 1 # +1 for open, -1 for close
while j < len(tokens):
if tokens[j] == Token.OPEN_PAREN:
offset += 1
elif tokens[j] == Token.CLOSE_PAREN:
offset -= 1
if offset < 0:
print("parenthesis parse error!")
print(tokens)
sys.exit(1)
elif offset == 0:
break
j += 1
else:
print("did not close parenthesis!")
print(tokens)
sys.exit(1)
inner = self.find_groups(tokens[i+1:j])
return self.condense(tokens[:i] + inner + self.find_groups(tokens[j + 1:]))

def condense(self, tokens):
# assumes tokens is a flat list. This will only work if tokens is a flat list.
return self.condenseRaces(self.condenseDeadline(self.condenseParallels(self.condenseSequentials(tokens))))

def condenseSequentials(self, tokens):
i = 1
while i < len(tokens) - 1:
if tokens[i] == Token.PLUS:
break
i += 1
else:
return tokens
prev = tokens[i - 1]
next = tokens[i + 1]
return self.condenseSequentials(tokens[:i-1] + [prev.andThen(next)] + tokens[i + 2:])

def condenseParallels(self, tokens):
i = 1
while i < len(tokens) - 1:
if tokens[i] == Token.AND:
break
i += 1
else:
return tokens
prev = tokens[i - 1]
next = tokens[i + 1]
return self.condenseParallels(tokens[:i-1] + [prev.alongWith(next)] + tokens[i + 2:])

def condenseDeadline(self, tokens):
i = 1
while i < len(tokens) - 1:
if tokens[i] == Token.DEADLINE:
break
i += 1
else:
return tokens
prev = tokens[i - 1]
next = tokens[i + 1]
return self.condenseDeadline(tokens[:i-1] + [prev.deadlineFor(next)] + tokens[i + 2:])

def condenseRaces(self, tokens):
i = 1
while i < len(tokens) - 1:
if tokens[i] == Token.RACE:
break
i += 1
else:
return tokens
prev = tokens[i - 1]
next = tokens[i + 1]
return self.condenseRaces(tokens[:i-1] + [prev.raceWith(next)] + tokens[i + 2:])

def parse(self):
return self.find_groups(self.tokens)[0]

def pp_json(json):
return f'{{"version":"2025.0","command":{json},"resetOdom":false,"folder":null,"choreoAuto":false}}'

lines = []
for line in text:
if not line:
continue
scanner = Scanner(line)
scanner.scan()
# now to group, but how?
parser = Parser(scanner.tokens)
lines.append(parser.parse())
cmd = Sequential(lines)

print(pp_json(cmd.json()))
9 changes: 9 additions & 0 deletions ThriftyTest/autons/center.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Align H
L4
Align GH & Lower Algae
Align Barge Center
Net
Upper Algae & Align IJ
Align Barge Left
Net
Align LIntake
12 changes: 12 additions & 0 deletions ThriftyTest/autons/center2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Align H
L4
Align Inside Lollipop & High Ground Algae
Beeline Barge Center
Net
Align Outside Lollipop & High Ground Algae
Beeline Barge Left
Net
Align IJ & High Ground Algae
Align Barge Left
Net
Beeline LIntake
12 changes: 12 additions & 0 deletions ThriftyTest/autons/left4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Align J
L4
Recalibrate & ((Coral Wait ? Align LIntake) + Align K)
Intake
L4
Recalibrate & ((Coral Wait ? Beeline LIntake) + Align L)
Intake
L4
Recalibrate & ((Coral Wait ? Beeline LIntake) + Align A)
Intake
L4
Recalibrate
12 changes: 12 additions & 0 deletions ThriftyTest/autons/right4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Align E
L4
Recalibrate & ((Coral Wait ? Align RIntake) + Align D)
Intake
L4
Recalibrate & ((Coral Wait ? Beeline RIntake) + Align C)
Intake
L4
Recalibrate & ((Coral Wait ? Beeline RIntake) + Align B)
Intake
L4
Recalibrate
11 changes: 11 additions & 0 deletions ThriftyTest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ deploy {
// getTargetTypeClass is a shortcut to get the class type using a string

frcJava(getArtifactTypeClass('FRCJavaArtifact')) {
jvmArgs.add("-XX:+UnlockExperimentalVMOptions")
jvmArgs.add("-XX:GCTimeRatio=5")
jvmArgs.add("-XX:+UseSerialGC")
jvmArgs.add("-XX:MaxGCPauseMillis=50")

// The options below may improve performance, but should only be enabled on the RIO 2
//
final MAX_JAVA_HEAP_SIZE_MB = 100;
jvmArgs.add("-Xmx" + MAX_JAVA_HEAP_SIZE_MB + "M")
jvmArgs.add("-Xms" + MAX_JAVA_HEAP_SIZE_MB + "M")
jvmArgs.add("-XX:+AlwaysPreTouch")
}

// Static files artifact
Expand Down
Loading