Skip to content

Commit c506098

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # TeamCode/src/main/kotlin/pioneer/Constants.kt # TeamCode/src/main/kotlin/pioneer/opmodes/auto/PathingTest.kt # TeamCode/src/main/kotlin/pioneer/opmodes/calibration/OdometerOffsetCalculation.kt # TeamCode/src/main/kotlin/pioneer/pathing/follower/Follower.kt # TeamCode/src/main/kotlin/pioneer/pathing/paths/CompoundPath.kt
2 parents 09ed554 + 80eea96 commit c506098

65 files changed

Lines changed: 1158 additions & 841 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.kt diff=kotlin
2+
*.java diff=java

.github/workflows/build.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,27 @@ jobs:
2121
java-version: '17'
2222
distribution: 'temurin'
2323

24+
- name: Cache Gradle
25+
uses: actions/cache@v4
26+
with:
27+
path: |
28+
~/.gradle/caches
29+
~/.gradle/wrapper
30+
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
31+
restore-keys: |
32+
gradle-${{ runner.os }}-
33+
2434
- name: Setup Gradle
2535
uses: gradle/actions/setup-gradle@v3
2636
with:
2737
cache-read-only: ${{ github.ref != 'refs/heads/master' }}
2838

2939
- name: Build and Test
30-
run: ./gradlew build --no-daemon
40+
run: ./gradlew build --info --stacktrace --no-daemon
3141

3242
- name: Build Debug APK
3343
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
34-
run: ./gradlew assembleDebug --no-daemon
44+
run: ./gradlew assembleDebug --info --stacktrace --no-daemon
3545

3646
- name: Upload APK
3747
if: github.event_name == 'push' && github.ref == 'refs/heads/master'

.github/workflows/ktlint.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
push:
7+
branches: [master]
8+
9+
jobs:
10+
ktlint:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
19+
ref: ${{ github.event.pull_request.head.ref || github.ref }}
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- uses: actions/setup-java@v4
23+
with:
24+
java-version: '17'
25+
distribution: 'temurin'
26+
27+
- uses: gradle/actions/setup-gradle@v3
28+
29+
- name: Format (non-fork) or check (fork)
30+
run: |
31+
if [[ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" && "${{ github.event_name }}" == "pull_request" ]]; then
32+
./gradlew ktlintCheck --no-daemon
33+
else
34+
./gradlew ktlintFormat --no-daemon
35+
fi
36+
37+
- name: Commit formatting changes
38+
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
39+
run: |
40+
if [[ -n $(git status --porcelain) ]]; then
41+
git config user.email "github-actions[bot]@users.noreply.github.com"
42+
git config user.name "github-actions[bot]"
43+
git add .
44+
git commit -m "style: apply ktlint formatting [bot]"
45+
git push
46+
fi

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ To stay aligned with the upstream FTC repository:
3434
Use `ktlint` to format your Kotlin files:
3535

3636
```bash
37-
ktlint -F <filename>
37+
./gradlew ktlintFormat
3838
```

TeamCode/build.gradle

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,27 @@
1111

1212
// Custom definitions may go here
1313

14+
// ktlint configuration - plugins block must come before apply statements
15+
plugins {
16+
id "org.jlleitschuh.gradle.ktlint" version "12.1.0"
17+
id 'org.jetbrains.kotlin.android' apply false
18+
}
19+
1420
// Include common definitions from above.
1521
apply from: '../build.common.gradle'
1622
apply from: '../build.dependencies.gradle'
1723
apply plugin: 'kotlin-android'
1824

25+
ktlint {
26+
android = true
27+
ignoreFailures = true // Allow build to succeed, but still show warnings
28+
reporters {
29+
reporter "plain"
30+
reporter "checkstyle"
31+
reporter "sarif"
32+
}
33+
}
34+
1935
android {
2036
namespace = 'pioneer'
2137
kotlinOptions {
@@ -33,4 +49,4 @@ dependencies {
3349

3450
//kotlin {
3551
// jvmToolchain(8)
36-
//}
52+
//}

TeamCode/src/main/kotlin/pioneer/Bot.kt

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
11
package pioneer
22

33
import com.qualcomm.robotcore.hardware.HardwareMap
4-
import pioneer.hardware.impl.AprilTagImpl
5-
import pioneer.hardware.impl.BatteryMonitorImpl
6-
import pioneer.hardware.impl.CameraImpl
7-
import pioneer.hardware.impl.FlywheelImpl
8-
import pioneer.hardware.impl.LaunchServosImpl
9-
import pioneer.hardware.impl.MecanumBaseImpl
10-
import pioneer.hardware.interfaces.BatteryMonitor
11-
import pioneer.hardware.interfaces.Camera
12-
import pioneer.hardware.interfaces.Flywheel
13-
import pioneer.hardware.interfaces.LaunchServos
14-
import pioneer.hardware.interfaces.MecanumBase
15-
import pioneer.hardware.mock.AprilTagMock
16-
import pioneer.hardware.mock.BatteryMonitorMock
17-
import pioneer.hardware.mock.CameraMock
18-
import pioneer.hardware.mock.FlywheelMock
19-
import pioneer.hardware.mock.LaunchServosMock
20-
import pioneer.hardware.mock.MecanumBaseMock
4+
import org.firstinspires.ftc.vision.apriltag.AprilTagProcessor
5+
import pioneer.hardware.AprilTag
6+
import pioneer.hardware.BatteryMonitor
7+
import pioneer.hardware.Camera
8+
import pioneer.hardware.Flywheel
9+
import pioneer.hardware.LaunchServos
10+
import pioneer.hardware.MecanumBase
11+
import pioneer.hardware.MockHardware
2112
import pioneer.localization.Localizer
2213
import pioneer.localization.localizers.LocalizerMock
2314
import pioneer.localization.localizers.Pinpoint
2415
import pioneer.pathing.follower.Follower
25-
import org.firstinspires.ftc.vision.apriltag.AprilTagProcessor
16+
import pioneer.constants.Camera as CameraConstants
2617

2718
enum class BotType(val supportsLocalizer: Boolean) {
2819
BASIC_MECANUM_BOT(false),
@@ -35,17 +26,17 @@ class Bot(
3526
hardwareMap: HardwareMap,
3627
) {
3728
// Basic hardware components
38-
var mecanumBase: MecanumBase = MecanumBaseMock()
29+
var mecanumBase: MecanumBase = MecanumBase(MockHardware())
3930
var localizer: Localizer = LocalizerMock()
40-
var batteryMonitor: BatteryMonitor = BatteryMonitorMock()
31+
var batteryMonitor: BatteryMonitor = BatteryMonitor(MockHardware())
4132

4233
// GoBilda starter bot specific components
43-
var flywheel: Flywheel = FlywheelMock()
44-
var launchServos: LaunchServos = LaunchServosMock()
34+
var flywheel: Flywheel = Flywheel(MockHardware())
35+
var launchServos: LaunchServos = LaunchServos(MockHardware())
4536

4637
// Other hardware components
47-
var aprilTagProcessor: AprilTagProcessor = AprilTagMock().processor
48-
var camera: Camera = CameraMock()
38+
var aprilTagProcessor: AprilTagProcessor = AprilTag().processor
39+
var camera: Camera = Camera(MockHardware())
4940

5041
// Path follower
5142
var follower = Follower(this)
@@ -54,8 +45,8 @@ class Bot(
5445
when (botType) {
5546
BotType.BASIC_MECANUM_BOT -> {
5647
// Initialize hardware components for Basic Mecanum Bot
57-
mecanumBase = MecanumBaseImpl(hardwareMap, Constants.Drive.MOTOR_CONFIG)
58-
batteryMonitor = BatteryMonitorImpl(hardwareMap)
48+
mecanumBase = MecanumBase(hardwareMap)
49+
batteryMonitor = BatteryMonitor(hardwareMap)
5950
}
6051

6152
BotType.MECANUM_BOT -> {
@@ -67,19 +58,19 @@ class Bot(
6758

6859
BotType.GOBILDA_STARTER_BOT -> {
6960
// Initialize hardware components for GoBilda Starter Bot
70-
mecanumBase = MecanumBaseImpl(hardwareMap, Constants.Drive.MOTOR_CONFIG)
61+
mecanumBase = MecanumBase(hardwareMap)
7162
localizer = Pinpoint(hardwareMap)
72-
batteryMonitor = BatteryMonitorImpl(hardwareMap)
73-
flywheel = FlywheelImpl(hardwareMap)
74-
launchServos = LaunchServosImpl(hardwareMap)
75-
aprilTagProcessor = AprilTagImpl(
76-
Constants.Camera.POSITION_CM,
77-
Constants.Camera.ORIENTATION_RAD
78-
).processor
63+
batteryMonitor = BatteryMonitor(hardwareMap)
64+
flywheel = Flywheel(hardwareMap)
65+
launchServos = LaunchServos(hardwareMap)
66+
aprilTagProcessor =
67+
AprilTag(
68+
CameraConstants.POSITION_CM,
69+
CameraConstants.ORIENTATION_RAD,
70+
).processor
7971
camera =
80-
CameraImpl(
72+
Camera(
8173
hardwareMap,
82-
Constants.HardwareNames.WEBCAM,
8374
processors = arrayOf(aprilTagProcessor),
8475
)
8576
}

0 commit comments

Comments
 (0)