Package ch.hevs.kart

Interface KartSetup


public interface KartSetup

Kart setup interface

Interface to setup kart hardware settings and other parameters.

  • Method Details

    • getDrivePwmFrequency

      double getDrivePwmFrequency()

      Returns the drive motor control block PWM frequency in Hz.

      Returns:
      Drive PWM frequency.
    • setDrivePwmFrequency

      @NonNull KartSetup setDrivePwmFrequency(double frequencyHz)

      Sets the drive motor control block PWM frequency in Hz.

      Parameters:
      frequencyHz - PWM frequency in Hz.
      Returns:
      Reference to itself in order to chain method calls.
    • getDriveMaxSpeed

      int getDriveMaxSpeed()

      Returns the absolute value of the maximal speed a kart is allowed to drive in both directions. Values are from 0 to 15.

      Returns:
      Maximal drive speed.
    • setDriveMaxSpeed

      @NonNull KartSetup setDriveMaxSpeed(int speed)

      Sets the absolute maximal speed a kart is allowed to drive in both directions. Valid values are in 0...15.

      Parameters:
      speed - Maximal allowed speed.
      Returns:
      Reference to itself in order to chain method calls.
    • getSteeringMaxPosition

      int getSteeringMaxPosition()

      Returns the maximal step count at the opposite site of the stepper end contact switch.

      Returns:
      Maximal stepper motor step count.
    • getSteeringCenterPosition

      default int getSteeringCenterPosition()
    • setSteeringMaxPosition

      @NonNull KartSetup setSteeringMaxPosition(int position)

      Sets the maximal step count of the steering motor. Default value is defined by Kart VHDL.

      Parameters:
      position - The value of the step counter at the opposite site of the end switch.
      Returns:
      Reference to itself in order to chain method calls.
    • setSteeringCenterPosition

      @NonNull default KartSetup setSteeringCenterPosition(int position)

      Sets the steering motor central position. Note that this method actually calls the method steeringMaxPosition with 2 times the center position.

      Parameters:
      position - The value of the step counter at the center.
      Returns:
      Reference to itself in order to chain method calls.
    • getSteeringStepFrequency

      double getSteeringStepFrequency()

      Returns the steering motor driver step frequency in Hz.

      Returns:
      Steering motor step period.
    • setSteeringStepFrequency

      @NonNull KartSetup setSteeringStepFrequency(double frequency)

      Sets the steering motor driver step frequency in Hz.

      Parameters:
      frequency - Steering motor step frequency in Hz.
      Returns:
      Reference to itself in order to chain method calls.
    • getHardwareSettings

      @NonNull EnumSet<KartHardwareSettings> getHardwareSettings()

      Returns the Kart's actual hardware settings. Default is all flags cleared.

      Returns:
      Kart's hardware settings.
    • setHardwareSettings

      @NonNull KartSetup setHardwareSettings(@NonNull EnumSet<KartHardwareSettings> hardwareSettings)

      Changes all of the hardware settings flags to the given values.

      Parameters:
      hardwareSettings - Hardware settings to apply.
      Returns:
      Reference to itself in order to chain method calls.
    • isHWSettingSet

      default Boolean isHWSettingSet(KartHardwareSettings setting)

      Checks the given hardware setting flag.

      Parameters:
      setting - Hardware setting flag to check.
      Returns:
      True if set, false otherwise.
    • setHwSetting

      @NonNull default KartSetup setHwSetting(KartHardwareSettings setting)

      Sets the given hardware setting flag.

      Parameters:
      setting - Hardware setting flag to set.
      Returns:
      Reference to itself in order to chain method calls.
    • clearHwSetting

      @NonNull default KartSetup clearHwSetting(KartHardwareSettings setting)

      Clears the given hardware setting flag.

      Parameters:
      setting - Hardware setting flag to clear.
      Returns:
      Reference to itself in order to chain method calls.
    • getUpdateInterval

      default int getUpdateInterval()

      Returns the update interval of the Kart in milliseconds. This interval is the time between each register update send from the Kart to the Android application if the protocol supports this interval, otherwise the value will be 0.

      Returns:
      Update interval in milliseconds.
    • setUpdateInterval

      @NonNull default KartSetup setUpdateInterval(int interval)

      Sets the update interval of the Kart in milliseconds. This interval is the time between each register update send from the Kart to the Android application. Note that not all kart models support this parameter, the one that do not just ignore this call.

      Parameters:
      interval - Update interval in milliseconds.
      Returns:
      Reference to itself in order to chain method calls.
    • apply

      @NonNull default KartSetup apply(KartSetup setup)

      Applies all parameters of the given Kart setup to this setup.

      Parameters:
      setup - Kart setup to apply to this kart setup object.
      Returns:
      Reference to itself in order to chain method calls.
    • save

      void save(@NonNull String identifier, @NonNull android.app.Activity activity)

      Saves the kart settings under the given identifier.

      Parameters:
      identifier - Name for the saved setup.
      activity - Activity is needed to access file system.
    • load

      void load(@NonNull String identifier, @NonNull android.app.Activity activity)

      Loads the kart settings from the given name.

      Parameters:
      identifier - Identifier of the setup to load.
      activity - Activity is needed to access file system.