Interface KartSetup
Kart setup interface
Interface to setup kart hardware settings and other parameters.
-
Method Summary
Modifier and TypeMethodDescriptiondefault KartSetup
Applies all parameters of the given Kart setup to this setup.default KartSetup
clearHwSetting
(KartHardwareSettings setting) Clears the given hardware setting flag.int
Returns the absolute value of the maximal speed a kart is allowed to drive in both directions.double
Returns the drive motor control block PWM frequency in Hz.Returns the Kart's actual hardware settings.default int
int
Returns the maximal step count at the opposite site of the stepper end contact switch.double
Returns the steering motor driver step frequency in Hz.default int
Returns the update interval of the Kart in milliseconds.default Boolean
isHWSettingSet
(KartHardwareSettings setting) Checks the given hardware setting flag.void
Loads the kart settings from the given name.void
Saves the kart settings under the given identifier.setDriveMaxSpeed
(int speed) Sets the absolute maximal speed a kart is allowed to drive in both directions.setDrivePwmFrequency
(double frequencyHz) Sets the drive motor control block PWM frequency in Hz.setHardwareSettings
(EnumSet<KartHardwareSettings> hardwareSettings) Changes all of the hardware settings flags to the given values.default KartSetup
setHwSetting
(KartHardwareSettings setting) Sets the given hardware setting flag.default KartSetup
setSteeringCenterPosition
(int position) Sets the steering motor central position.setSteeringMaxPosition
(int position) Sets the maximal step count of the steering motor.setSteeringStepFrequency
(double frequency) Sets the steering motor driver step frequency in Hz.default KartSetup
setUpdateInterval
(int interval) Sets the update interval of the Kart in milliseconds.
-
Method Details
-
getDrivePwmFrequency
double getDrivePwmFrequency()Returns the drive motor control block PWM frequency in Hz.
- Returns:
- Drive PWM frequency.
-
setDrivePwmFrequency
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
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
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
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
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
Returns the Kart's actual hardware settings. Default is all flags cleared.
- Returns:
- Kart's hardware settings.
-
setHardwareSettings
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
Checks the given hardware setting flag.
- Parameters:
setting
- Hardware setting flag to check.- Returns:
- True if set, false otherwise.
-
setHwSetting
Sets the given hardware setting flag.
- Parameters:
setting
- Hardware setting flag to set.- Returns:
- Reference to itself in order to chain method calls.
-
clearHwSetting
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
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
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
Saves the kart settings under the given identifier.
- Parameters:
identifier
- Name for the saved setup.activity
- Activity is needed to access file system.
-
load
Loads the kart settings from the given name.
- Parameters:
identifier
- Identifier of the setup to load.activity
- Activity is needed to access file system.
-