View Single Post
  #2   Spotlight this post!  
Unread 04-19-2015, 02:30 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,998
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: Getting Gyro Working w/ Mecanum Drive

Quote:
Originally Posted by WillNess View Post
One of the more difficult things (and something I struggled with implementing) during the build season was using a gyro to help the drivers.
What do you mean by help the drivers ?


If your goal is to use the gyro to provide a field-centric driver interface, that's already part of the Java WPILib:

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) {
        if(!kMecanumCartesian_Reported) {
            UsageReporting.report(tResourceType.kResourceType_RobotDrive, getNumMotors(), tInstances.kRobotDrive_MecanumCartesian);
            kMecanumCartesian_Reported = true;
        }

... Or if your goal is to make the bot drive straight when the driver is commanding zero rotation, you could do something like this:

http://www.chiefdelphi.com/forums/at...4&d=1420598437



...Or here's an interesting optional (button-press selectable) driver interface mode for mec that your drivers might like:

Quote:
Halo Auto-Rotate (Halo-AR) Driver interface

A single 2-axis joystick does field-centric control of forward/reverse
and strafe right/left motion, while the robot automatically and
simultaneously rotates to face the direction it is commanded.

http://www.chiefdelphi.com/media/papers/download/3721



Last edited by Ether : 04-19-2015 at 02:47 PM.
Reply With Quote