Class TunableDoubleMap

java.lang.Object
com.marswars.data_structures.TunableDoubleMap

public class TunableDoubleMap extends Object
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
    Constructor
    Description
    Creates a new TunableDoubleMap
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    get(double key)
    Gets an interpolated value from the map
    void
    put(double key, double value)
    Puts a key-value pair into the map and registers it as a DogLog tunable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TunableDoubleMap

      public TunableDoubleMap(String log_prefix)
      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 tunable

      The 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