Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

constants to RobotConfig #47

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ import kotlin.math.sqrt
* Requires the [TriWheels] API.
*/
object TeleOpMovement : Component {
private const val ROTATION_GAIN = 0.6
private const val SLOW_MULTIPLIER = 0.4

override fun loop(opMode: OpMode) {
// alias gamepad1
val gamepad = opMode.gamepad1
val rotationPower = ROTATION_GAIN * -gamepad.right_stick_x.toDouble()
val rotationPower = RobotConfig.TeleOpMovement.ROTATION_GAIN * -gamepad.right_stick_x.toDouble()

// joystick input
val joyX = -gamepad.left_stick_x.toDouble()
Expand All @@ -32,7 +29,7 @@ object TeleOpMovement : Component {

// if the right bumper is pressed move slower
if (gamepad.right_bumper) {
joyMagnitude *= SLOW_MULTIPLIER
joyMagnitude *= RobotConfig.TeleOpMovement.SLOW_MULTIPLIER
}

// movement of all wheels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ object RobotConfig {

@JvmField
var ROTATE_SPEED: Double = 0.5

@JvmField
var ROTATION_GAIN: Double = 0.6

@JvmField
var SLOW_MULTIPLIER: Double = 0.4
}

/**
Expand Down