Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
73 changes: 38 additions & 35 deletions mirror-autos.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,53 +82,56 @@ def replace_outpost_with_depot(obj):

def main():
base_path = "src/main/deploy/pathplanner"

# Define outpost paths to mirror (based on the original outpost files)
outpost_paths = [
"1st outpost shoot",
"fast outpost shoot",
"outpost flex pickup",
"outpost flex bump",
"outpost flex center",
"2nd outpost cleanup",
"2nd outpost shoot",
"outpost center half neutral zone"
]

# Define outpost autos to mirror
outpost_autos = [
"outpost cleanup",
"outpost fast",
"outpost shoot",
"outpost flex",
"outpost center flex"
]


# Automatically find all files with "outpost" in the name
paths_dir = os.path.join(base_path, "paths")
autos_dir = os.path.join(base_path, "autos")

outpost_paths = []
outpost_autos = []

# Scan for all .path files containing "outpost"
if os.path.exists(paths_dir):
for filename in os.listdir(paths_dir):
if filename.endswith(".path") and "outpost" in filename:
# Remove the .path extension to get the path name
path_name = filename[:-5]
outpost_paths.append(path_name)

# Scan for all .auto files containing "outpost"
if os.path.exists(autos_dir):
for filename in os.listdir(autos_dir):
if filename.endswith(".auto") and "outpost" in filename:
# Remove the .auto extension to get the auto name
auto_name = filename[:-5]
outpost_autos.append(auto_name)

# Sort for consistent output
outpost_paths.sort()
outpost_autos.sort()

# Mirror paths
print(f"Mirroring outpost paths to depot paths (field width: {FIELD_WIDTH} m)...")
print(f"Found {len(outpost_paths)} outpost path(s) to mirror")
for path_name in outpost_paths:
input_file = os.path.join(base_path, "paths", f"{path_name}.path")
output_name = path_name.replace("outpost", "depot")
output_file = os.path.join(base_path, "paths", f"{output_name}.path")

if os.path.exists(input_file):
mirror_path(input_file, output_file)
else:
print(f"Warning: Input file not found: {input_file}")


mirror_path(input_file, output_file)
Comment thread
amzoeee marked this conversation as resolved.

# Mirror autos
print("\nMirroring outpost autos to depot autos...")
print(f"\nMirroring outpost autos to depot autos...")
print(f"Found {len(outpost_autos)} outpost auto(s) to mirror")
for auto_name in outpost_autos:
input_file = os.path.join(base_path, "autos", f"{auto_name}.auto")
output_name = auto_name.replace("outpost", "depot")
output_file = os.path.join(base_path, "autos", f"{output_name}.auto")

if os.path.exists(input_file):
mirror_auto(input_file, output_file)
else:
print(f"Warning: Input file not found: {input_file}")


mirror_auto(input_file, output_file)

print("\nMirroring complete!")
print(f"Total: {len(outpost_paths)} path(s) and {len(outpost_autos)} auto(s) mirrored")

if __name__ == "__main__":
main()
12 changes: 12 additions & 0 deletions src/main/deploy/pathplanner/autos/depot flex.auto
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
"data": {
"name": "snap to hub flex command"
}
},
{
"type": "path",
"data": {
"pathName": "depot flex end"
}
},
{
"type": "named",
"data": {
"name": "pointwheelsinx"
}
}
]
}
Expand Down
12 changes: 12 additions & 0 deletions src/main/deploy/pathplanner/autos/outpost flex.auto
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
"data": {
"name": "snap to hub flex command"
}
},
{
"type": "path",
"data": {
"pathName": "outpost flex end"
}
},
{
"type": "named",
"data": {
"name": "pointwheelsinx"
}
}
]
}
Expand Down
14 changes: 7 additions & 7 deletions src/main/deploy/pathplanner/paths/1st depot cleanup.path
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"waypoints": [
{
"anchor": {
"x": 3.6785093315972226,
"y": 5.450531394675927
"x": 3.679,
"y": 5.4510000000000005
},
"prevControl": null,
"nextControl": {
"x": 4.678509331597217,
"y": 5.450531394675927
"x": 4.678999999999995,
"y": 5.4510000000000005
},
"isLocked": false,
"linkedName": "depot neutral zone start"
Expand Down Expand Up @@ -112,11 +112,11 @@
},
{
"anchor": {
"x": 2.2582072610294124,
"x": 2.694548177083334,
"y": 5.450531394675927
},
"prevControl": {
"x": 2.784650735294118,
"x": 3.2209916513480397,
"y": 5.456189338235294
},
"nextControl": null,
Expand Down Expand Up @@ -209,7 +209,7 @@
},
"goalEndState": {
"velocity": 0,
"rotation": -29.500000000000004
"rotation": -36.37
},
"reversed": false,
"folder": null,
Expand Down
6 changes: 3 additions & 3 deletions src/main/deploy/pathplanner/paths/1st depot shoot.path
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@
},
{
"anchor": {
"x": 2.2582072610294124,
"x": 2.694548177083334,
"y": 5.450531394675927
},
"prevControl": {
"x": 2.784650735294118,
"x": 3.2209916513480397,
"y": 5.456189338235294
},
"nextControl": null,
Expand Down Expand Up @@ -209,7 +209,7 @@
},
"goalEndState": {
"velocity": 0,
"rotation": -29.500000000000004
"rotation": -36.37
},
"reversed": false,
"folder": null,
Expand Down
6 changes: 3 additions & 3 deletions src/main/deploy/pathplanner/paths/1st outpost cleanup.path
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@
},
{
"anchor": {
"x": 2.2582072610294124,
"x": 2.694548177083334,
"y": 2.618468605324074
},
"prevControl": {
"x": 2.784650735294118,
"x": 3.2209916513480397,
"y": 2.612810661764706
},
"nextControl": null,
Expand Down Expand Up @@ -209,7 +209,7 @@
},
"goalEndState": {
"velocity": 0,
"rotation": 29.500000000000004
"rotation": 36.37
},
"reversed": false,
"folder": null,
Expand Down
6 changes: 3 additions & 3 deletions src/main/deploy/pathplanner/paths/1st outpost shoot.path
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@
},
{
"anchor": {
"x": 2.2582072610294124,
"x": 2.694548177083334,
"y": 2.618468605324074
},
"prevControl": {
"x": 2.784650735294118,
"x": 3.2209916513480397,
"y": 2.612810661764706
},
"nextControl": null,
Expand Down Expand Up @@ -209,7 +209,7 @@
},
"goalEndState": {
"velocity": 0,
"rotation": 29.500000000000004
"rotation": 36.37
},
"reversed": false,
"folder": null,
Expand Down
16 changes: 8 additions & 8 deletions src/main/deploy/pathplanner/paths/2nd depot cleanup.path
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"waypoints": [
{
"anchor": {
"x": 2.2582072610294124,
"x": 2.694548177083334,
"y": 5.450531394675927
},
"prevControl": null,
"nextControl": {
"x": 2.7995968007915564,
"x": 3.235937716845478,
"y": 5.477166845316624
},
"isLocked": false,
Expand Down Expand Up @@ -112,11 +112,11 @@
},
{
"anchor": {
"x": 2.2582072610294124,
"x": 2.694548177083334,
"y": 5.450531394675927
},
"prevControl": {
"x": 2.499528231040933,
"x": 2.9358691470948544,
"y": 5.385230633327382
},
"nextControl": null,
Expand Down Expand Up @@ -179,8 +179,8 @@
},
{
"name": "intaking",
"minWaypointRelativePos": 2.07,
"maxWaypointRelativePos": 5.02,
"minWaypointRelativePos": 2.070397418478261,
"maxWaypointRelativePos": 5.023437499999998,
"constraints": {
"maxVelocity": 2.75,
"maxAcceleration": 3.0,
Expand Down Expand Up @@ -216,13 +216,13 @@
},
"goalEndState": {
"velocity": 0,
"rotation": -29.500000000000004
"rotation": -36.37
},
"reversed": false,
"folder": null,
"idealStartingState": {
"velocity": 0.0,
"rotation": -29.500000000000004
"rotation": -36.37
},
"useDefaultConstraints": true
}
12 changes: 6 additions & 6 deletions src/main/deploy/pathplanner/paths/2nd depot shoot.path
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"waypoints": [
{
"anchor": {
"x": 2.2582072610294124,
"x": 2.694548177083334,
"y": 5.450531394675927
},
"prevControl": null,
"nextControl": {
"x": 2.7995968007915564,
"x": 3.235937716845478,
"y": 5.477166845316624
},
"isLocked": false,
Expand Down Expand Up @@ -112,11 +112,11 @@
},
{
"anchor": {
"x": 2.2582072610294124,
"x": 2.694548177083334,
"y": 5.450531394675927
},
"prevControl": {
"x": 2.499528231040932,
"x": 2.9358691470948535,
"y": 5.385230633327382
},
"nextControl": null,
Expand Down Expand Up @@ -217,13 +217,13 @@
},
"goalEndState": {
"velocity": 0,
"rotation": -29.500000000000004
"rotation": -36.37
},
"reversed": false,
"folder": null,
"idealStartingState": {
"velocity": 0.0,
"rotation": -29.500000000000004
"rotation": -36.37
},
"useDefaultConstraints": true
}
12 changes: 6 additions & 6 deletions src/main/deploy/pathplanner/paths/2nd outpost cleanup.path
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"waypoints": [
{
"anchor": {
"x": 2.2582072610294124,
"x": 2.694548177083334,
"y": 2.618468605324074
},
"prevControl": null,
"nextControl": {
"x": 2.7995968007915564,
"x": 3.235937716845478,
"y": 2.591833154683377
},
"isLocked": false,
Expand Down Expand Up @@ -112,11 +112,11 @@
},
{
"anchor": {
"x": 2.2582072610294124,
"x": 2.694548177083334,
"y": 2.618468605324074
},
"prevControl": {
"x": 2.499528231040933,
"x": 2.9358691470948544,
"y": 2.683769366672619
},
"nextControl": null,
Expand Down Expand Up @@ -216,13 +216,13 @@
},
"goalEndState": {
"velocity": 0,
"rotation": 29.500000000000004
"rotation": 36.37
},
"reversed": false,
"folder": null,
"idealStartingState": {
"velocity": 0.0,
"rotation": 29.500000000000004
"rotation": 36.37
},
"useDefaultConstraints": true
}
Loading
Loading