Skip to content

Commit

Permalink
Merge branch 'main' into debazel
Browse files Browse the repository at this point in the history
  • Loading branch information
jwbonner committed Nov 30, 2024
2 parents 1815d78 + 8b4075e commit a58745e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 47 deletions.
33 changes: 2 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ![AdvantageKit](/banner.png)
# ![AdvantageKit](/docs/docs/img/banner.png)

[![Build](https://github.com/Mechanical-Advantage/AdvantageKit/actions/workflows/build.yml/badge.svg?branch=main&event=push)](https://github.com/Mechanical-Advantage/AdvantageKit/actions/workflows/build.yml)

Expand All @@ -7,35 +7,6 @@ AdvantageKit is a logging, telemetry, and replay framework developed by [Team 63
- [AdvantageScope](https://github.com/Mechanical-Advantage/AdvantageScope), our robot telemetry application which **does not require AdvantageKit to use**.
- [WPILib Data Logging](https://docs.wpilib.org/en/stable/docs/software/telemetry/datalog.html), a simpler logging system included in WPILib (does not support log replay in simulation, but covers the needs of most teams).

**View the [online documentation](https://docs.advantagekit.org).**
**View the [online documentation](https://docs.advantagekit.org), or download example projects from the [latest release](https://github.com/Mechanical-Advantage/AdvantageKit/releases).**

Feedback, feature requests, and bug reports are welcome on the [issues page](https://github.com/Mechanical-Advantage/AdvantageKit/issues). For non-public inquires, please send a message to software@team6328.org.

## Sample Projects

Looking to get started quickly? **Check out the [AdvantageKit example projects](https://docs.advantagekit.org/installation/#new-projects).** There are versions for differential and swerve drives, from minimal to advanced (including a project designed for the [2024 FIRST KitBot](https://www.firstinspires.org/resource-library/frc/kitbot)). Zip files for each project are attached to the latest release.

Also take a look at the examples below of teams utilizing AdvantageKit in their competition code:

- [Team 6328's 2023 Code](https://github.com/Mechanical-Advantage/RobotCode2023) - Spark Max swerve with a triple jointed arm, pose estimation, and auto scoring ([TBA](https://www.thebluealliance.com/team/6328/2023)).
- [Team 2910's 2023 Code](https://github.com/FRCTeam2910/2023CompetitionRobot-Public) - Talon FX swerve with PathPlanner, vision, and a telescoping arm ([TBA](https://www.thebluealliance.com/team/2910/2023)).
- [Team 3476's 2023 Code](https://github.com/FRC3476/FRC-2023) - Swerve with pose estimation, custom superstructure management, and more ([TBA](https://www.thebluealliance.com/team/3476/2023)).
- [Team 5940's 2023 Code](https://github.com/BREAD5940/2023-Onseason) - Talon FX swerve with automated scoring/pickup and "Northstar" AprilTag vision system ([TBA](https://www.thebluealliance.com/team/5940/2023))
- [Team 4099's 2023 Code](https://github.com/team4099/ChargedUp-2023/tree/main) - Kotlin code with a swerve, elevator, pose estimation, etc ([TBA](https://www.thebluealliance.com/team/4099/2023)).
- [Team 6328's 2022 Code](https://github.com/Mechanical-Advantage/RobotCode2022) - Spark Max differential drive with pose estimation and auto aiming ([TBA](https://www.thebluealliance.com/team/6328/2022)).

## Repository Structure

### Logging

- [junction](/junction) - Primary component of logging, manages the flow of data between user code, WPILib, log files, network clients, etc. _Written in Java._
- [junction/core](/junction/core) - Central system for managing data, including reading and writing from log files and user code.
- [junction/shims](/junction/shims) - Replaces components of other libraries (WPILib) to interact directly with `junction`.
- [junction/shims/wpilib](/junction/shims/wpilib) - Replaces WPILib components to read data from `junction` instead of the HAL.
- [junction/autolog](/junction/autolog) - Annotation procesor for creating log input classes.
- [conduit](/conduit) - Transfers data between `junction` and the WPILib HAL efficiently. _Written in C++ and Java._

### General

- [build_tools](/build_tools) - Utilities to assist with building in Bazel and interfacing with WPILib and the roboRIO.
- [third_party](/third_party) - Tools for integrating third party libraries like WPILib.
13 changes: 7 additions & 6 deletions akit/src/main/java/org/littletonrobotics/junction/LogTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Objects;
import java.util.Set;

import org.littletonrobotics.junction.LogTable.LogValue;
import org.littletonrobotics.junction.inputs.LoggableInputs;

import edu.wpi.first.units.mutable.GenericMutableMeasureImpl;
Expand Down Expand Up @@ -576,9 +577,8 @@ public <T, MessageType extends ProtoMessage<?>> void put(String key, Protobuf<T,
// Warn about protobuf logging when enabled
if (DriverStation.isEnabled()) {
DriverStation.reportWarning(
"[AdvantageKit] Logging protobuf value with type \"" + proto.getTypeString()
+ "\" for the first time. Logging a protobuf type for the first time when the robot is enabled is likely to cause high loop overruns. Protobuf types should be always logged for the first time when the robot is disabled.",
false);
"[AdvantageKit] Logging protobuf value with type \"" + proto.getTypeString() + "\" for the first time. Logging a protobuf type for the first time when the robot is enabled is likely to cause high loop overruns. Protobuf types should be always logged for the first time when the robot is disabled.",
false);
}
}
ProtobufBuffer<T, MessageType> buffer = (ProtobufBuffer<T, MessageType>) protoBuffers.get(proto.getTypeString());
Expand Down Expand Up @@ -689,16 +689,16 @@ public <T extends StructSerializable> void put(String key, T[][] value) {
}
}

@SuppressWarnings("unchecked")
private Struct<?> findRecordStructType(Class<?> classObj) {
if (!structTypeCache.containsKey(classObj.getName())) {
structTypeCache.put(classObj.getName(), new RecordStruct(classObj));

// Warn about record logging when enabled
if (DriverStation.isEnabled()) {
DriverStation.reportWarning(
"[AdvantageKit] Logging record value with type \"" + classObj.getName()
+ "\" for the first time. Logging a record type for the first time when the robot is enabled is likely to cause high loop overruns. Record types should be always logged for the first time when the robot is disabled.",
false);
"[AdvantageKit] Logging record value with type \"" + classObj.getName() + "\" for the first time. Logging a record type for the first time when the robot is enabled is likely to cause high loop overruns. Record types should be always logged for the first time when the robot is disabled.",
false);
}
}
return structTypeCache.get(classObj.getName());
Expand Down Expand Up @@ -737,6 +737,7 @@ public <R extends Record> void put(String key, R... value) {
* Writes a new auto serialized 2D record array value to the table. Skipped if
* the key already exists as a different type.
*/
@SuppressWarnings("unchecked")
public <R extends Record> void put(String key, R[][] value) {
if (value == null)
return;
Expand Down
9 changes: 3 additions & 6 deletions akit/src/main/java/org/littletonrobotics/junction/Logger.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,9 @@ static void periodicBeforeUser() {
}

/**
* Periodic method to be called after the constructor of Robot and each loop
* cycle.
* Updates default log values and sends data to data receivers. Running this
* after user
* code allows IO operations to occur between cycles rather than interferring
* with the
* Periodic method to be called after the constructor of Robot and each loop cycle.
* Updates default log values and sends data to data receivers. Running this after user
* code allows IO operations to occur between cycles rather than interferring with the
* main thread.
*/
static void periodicAfterUser(long userCodeLength, long periodicBeforeLength) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

import org.littletonrobotics.junction.LogTable;
import org.littletonrobotics.junction.LogTable.LogValue;

class RadioLogger {
Expand Down Expand Up @@ -59,8 +58,8 @@ private static void start() {
statusURLBuilder.append(teamNumber % 100);
statusURLBuilder.append(".1/status");
try {
statusURL = new URI(statusURLBuilder.toString()).toURL();
} catch (URISyntaxException | MalformedURLException e) {
statusURL = new URL(statusURLBuilder.toString());
} catch (MalformedURLException e) {
return;
}

Expand Down Expand Up @@ -91,6 +90,7 @@ private static void start() {
}
});
notifier.setName("AdvantageKit_RadioLogger");
notifier.setHALThreadPriority(false, 0);
notifier.startPeriodic(requestPeriodSecs);
}
}
Binary file removed banner.png
Binary file not shown.

0 comments on commit a58745e

Please sign in to comment.