View Single Post
  #7   Spotlight this post!  
Unread 10-02-2014, 12:52
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,062
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Is RobotDrive required ?

Quote:
Originally Posted by parsodark View Post
Basically, its a tank drive, with both x axis controlling the sideway movement.

Both joysticks up : move forward
Both joysticks down : move backward
One up, one down : rotation
Both left/right : sideway movement
There's no reason you cannot use WPILib with the Operator Interface you described:

First do this:

Code:
Y = (Yleft + Yright)/2

Rotation = (Yleft - Yright)/2

X = (Xleft + Xright)/2
... then send those X, Y, and Rotation values to the corresponding inputs to the RobotDrive::MecanumDrive_Cartesian() method in the RobotDrive class:

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.
 */
void RobotDrive::MecanumDrive_Cartesian(float x, float y, float rotation, float gyroAngle)
Reply With Quote