TankLocalizer

class TankLocalizer @JvmOverloads constructor(val hardwareMap: HardwareMap, var inPerTick: Double, val kinematics: TankKinematics, val leftEncoders: List<Encoder>, val rightEncoders: List<Encoder>, val initialPose: Pose2d = Pose2d.zero) : Localizer

Localizer based on tank drive encoders. This localizer is not recommended for use with dead wheels.

Parameters

hardwareMap

hardware map

inPerTick

inches per tick

kinematics

tank kinematics

leftEncoders

left encoders

rightEncoders

right encoders

initialPose

initial pose

Constructors

Link copied to clipboard
constructor(hardwareMap: HardwareMap, kinematics: TankKinematics, inPerTick: Double, leftNames: List<String> = listOf("leftFront", "leftBack"), rightNames: List<String> = listOf("rightFront", "rightBack"), leftDirections: List<DcMotorSimple.Direction> = listOf(DcMotorSimple.Direction.FORWARD, DcMotorSimple.Direction.FORWARD), rightDirections: List<DcMotorSimple.Direction> = listOf(DcMotorSimple.Direction.FORWARD, DcMotorSimple.Direction.FORWARD), initialPose: Pose2d = Pose2d.zero)

Creates a new localizer.

constructor(hardwareMap: HardwareMap, inPerTick: Double, kinematics: TankKinematics, leftEncoders: List<Encoder>, rightEncoders: List<Encoder>, initialPose: Pose2d = Pose2d.zero)

Properties

Link copied to clipboard
val hardwareMap: HardwareMap
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override var pose: Pose2d

The current robot pose.

Link copied to clipboard
open override val poseHistory: MutableList<Pose2d>

A list of recent poses.

Link copied to clipboard
Link copied to clipboard
open override var vel: PoseVelocity2d

The current robot velocity.

Functions

Link copied to clipboard
fun fromMotors(leftMotors: List<DcMotorEx>, rightMotors: List<DcMotorEx>): TankLocalizer

Returns a new localizer with the given motors.

Link copied to clipboard
open override fun update(): PoseVelocity2d

Updates the localizer and returns the new velocity.

Link copied to clipboard
fun withDirections(leftDirections: List<DcMotorSimple.Direction>, rightDirections: List<DcMotorSimple.Direction>): TankLocalizer

Returns a new localizer with the given motor directions.

Link copied to clipboard

Returns a new localizer with the given initial pose.

Link copied to clipboard
fun withNames(leftNames: List<String>, rightNames: List<String>): TankLocalizer

Returns a new localizer with the given motor names.