MecanumDrive

class MecanumDrive @JvmOverloads constructor(val params: MecanumDrive.Parameters, hardwareMap: HardwareMap, pose: Pose2d = Pose2d.zero) : Drive

Mecanum drive implementation for FTC robots with holonomic movement capabilities.

This class provides a complete drive system for mecanum wheel robots, including:

  • Motor control with feedforward compensation

  • Pose estimation and tracking via localizer

  • Trajectory following with velocity and acceleration constraints

  • Holonomic control for omnidirectional movement

The drive system automatically configures motors, sensors, and control systems based on the provided parameters and hardware map.

Parameters

params

The drive parameters including PID gains and motion constraints

hardwareMap

The FTC hardware map containing motor and sensor configurations

pose

The initial pose of the robot (defaults to origin)

See also

Constructors

Link copied to clipboard
constructor(params: MecanumDrive.Parameters, hardwareMap: HardwareMap, pose: Pose2d = Pose2d.zero)

Types

Link copied to clipboard
data class Parameters(var axialGains: PosVelGain = PosVelGain(0.1), var lateralGains: PosVelGain = PosVelGain(0.1), var headingGains: PosVelGain = PosVelGain(0.1), var maxWheelVel: Double = 50.0, var minTransAccel: Double = -30.0, var maxTransAccel: Double = 50.0, var maxAngVel: Double = Math.PI, var maxAngAccel: Double = Math.PI)

Configuration parameters for the mecanum drive system.

Properties

Link copied to clipboard
open override val controller: HolonomicController

Holonomic controller for trajectory following

Link copied to clipboard

Default acceleration constraint for translational movement

Link copied to clipboard

Default constraints for turn-in-place movements

Link copied to clipboard

Default velocity constraint combining wheel and angular velocity limits

Link copied to clipboard

Motor feedforward controller for velocity and acceleration compensation

Link copied to clipboard
open override val followerParams: FollowerParams

Follower parameters used for trajectory following

Link copied to clipboard

Conversion factor from encoder ticks to inches

Link copied to clipboard

Mecanum kinematics calculator for converting robot velocities to wheel velocities

Link copied to clipboard
val leftBack: DcMotorEx

Left back drive motor

Link copied to clipboard
val leftFront: DcMotorEx

Left front drive motor

Link copied to clipboard
open override val localizer: Localizer

Localizer for pose estimation and tracking. Can be overridden with a custom localizer implementation.

Link copied to clipboard
Link copied to clipboard
val rightBack: DcMotorEx

Right back drive motor

Link copied to clipboard
val rightFront: DcMotorEx

Right front drive motor

Link copied to clipboard
val voltageSensor: VoltageSensor

Voltage sensor for feedforward compensation

Functions

Link copied to clipboard

Creates a trajectory action builder starting from the current robot pose.

Creates a trajectory action builder starting from a specified pose.

Link copied to clipboard

Creates and returns a time-optimal profile for the given path.

Link copied to clipboard

Creates and returns a time-optimal profile for the given path.

Link copied to clipboard
fun Drive.drawPoseHistory(canvas: Canvas)
Link copied to clipboard
Link copied to clipboard
open fun setDrivePowers(powers: PoseVelocity2d)

open override fun setDrivePowers(powers: PoseVelocity2dDual<Time>)

Sets drive motor powers based on desired robot velocities without feedforward.

Link copied to clipboard

open override fun setDrivePowersWithFF(powers: PoseVelocity2dDual<Time>)

Sets drive motor powers with feedforward compensation.

Link copied to clipboard
fun Drive.splineTo(target: Vector2d, tangent: Rotation2d): <Error class: unknown class>
Link copied to clipboard

Creates a trajectory builder starting from the current robot pose.

open override fun trajectoryBuilder(startPose: Pose2d): TrajectoryBuilder

Creates a trajectory builder starting from a specified pose.

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

Updates the robot's pose estimate using the localizer.