Quote:
Originally Posted by mrklempae
So it's really that easy to drive like that? I assume that you must need encoders to ensure that the motors are spinning at exactly the same speed.
|
I assume you meant "each motor is spinning at the
correct speed".
Quote:
|
How about field-centric steering? Is that particularly difficult to program?
|
That's what a gyro is for.
The WPILib RoboDrive methods have an input for gyro angle.
Code:
/**
* Drive method for Mecanum wheeled robots.
*
* A method for driving with Mecanum wheeled robots. There are 4 wheels
* on the robot, arranged so that the front and back wheels are toed in 45 degrees.
* When looking at the wheels from the top, the roller axles should form an X across the robot.
*
* This is designed to be directly driven by joystick axes.
*
* @param x The speed that the robot should drive in the X direction. [-1.0..1.0]
* @param y The speed that the robot should drive in the Y direction.
* This input is inverted to match the forward == -1.0 that joysticks produce. [-1.0..1.0]
* @param rotation The rate of rotation for the robot that is completely independent of
* the translation. [-1.0..1.0]
* @param gyroAngle The current angle reading from the gyro. Use this to implement field-oriented controls.
*/
public void mecanumDrive_Cartesian(double x, double y, double rotation, double gyroAngle)