Package com.marswars.data_structures
Class TunableDoubleMap
java.lang.Object
com.marswars.data_structures.TunableDoubleMap
A wrapper around InterpolatingDoubleTreeMap that automatically generates DogLog tunable entries
for the y-values in the map.
This allows runtime tuning of interpolation map values through DogLog without code changes.
Each y-value in the map gets a corresponding tunable entry in DogLog with the format:
<prefix>/<x_value>
The tunable values are automatically synchronized when changed via MwLog.
Example usage:
// Create a tunable map for hood angles
TunableDoubleMap hoodMap =
new TunableDoubleMap("LaunchCalculator/HoodAngle");
// Add initial values - these become tunable in DogLog
hoodMap.put(1.5, Math.toRadians(20.0));
hoodMap.put(2.0, Math.toRadians(25.0));
hoodMap.put(3.0, Math.toRadians(30.0));
// Use normally - values will automatically update from DogLog
double interpolatedAngle = hoodMap.get(2.5);
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
TunableDoubleMap
Creates a new TunableDoubleMap- Parameters:
log_prefix- The prefix for DogLog tunable entries (e.g., "Subsystem/MapName")
-
-
Method Details
-
put
public void put(double key, double value) Puts a key-value pair into the map and registers it as a DogLog tunableThe tunable will automatically update the map when changed via MwLog.
- Parameters:
key- The x-value (input)value- The y-value (output) - becomes tunable in DogLog
-
get
public double get(double key) Gets an interpolated value from the map- Parameters:
key- The x-value to interpolate at- Returns:
- The interpolated y-value, or NaN if the map is empty or key is out of range
-