Skip to content

Commit

Permalink
Exposed DriveComponent motors for easier access to individual motor p…
Browse files Browse the repository at this point in the history
…roperties
  • Loading branch information
amarcolini committed Apr 17, 2022
1 parent d0b8207 commit 1a43169
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.qualcomm.robotcore.hardware.HardwareMap
/**
* A class that runs multiple motors together as a unit.
*/
class MotorGroup(private vararg val motors: Motor) : Component {
class MotorGroup(vararg val motors: Motor) : Component {
/**
* Constructs a motor group out of several motor groups.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.amarcolini.joos.followers.TrajectoryFollower
import com.amarcolini.joos.geometry.Pose2d
import com.amarcolini.joos.hardware.Imu
import com.amarcolini.joos.hardware.Motor
import com.amarcolini.joos.hardware.MotorGroup
import com.amarcolini.joos.kinematics.DiffSwerveKinematics
import com.amarcolini.joos.localization.DiffSwerveLocalizer
import com.amarcolini.joos.localization.Localizer
Expand Down Expand Up @@ -40,6 +41,12 @@ open class DiffSwerveDrive(

private val gears = listOf(leftModule.first, leftModule.second, rightModule.first, rightModule.second)

/**
* All the motors in this drive.
*/
@JvmField
val motors: MotorGroup = MotorGroup(leftModule.first, leftModule.second, rightModule.first, rightModule.second)

override val trajectoryFollower: TrajectoryFollower = HolonomicPIDVAFollower(
translationalPID, translationalPID, headingPID, Pose2d(0.5, 0.5, 5.deg), 0.5
)
Expand Down

0 comments on commit 1a43169

Please sign in to comment.