Go to Post With one post, Mr. Miller joins the top 0.7% of Chief Delphi, reputation-wise. I think the community supports him. - Taylor [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-02-2015, 17:08
michaelyork michaelyork is offline
Registered User
FRC #3680 (Elemental Dragons)
Team Role: Programmer
 
Join Date: Mar 2014
Rookie Year: 2014
Location: Statesville, NC, United States
Posts: 18
michaelyork is an unknown quantity at this point
Question Programming Mecanum Wheels

I have tried searching CD and WPILib for a while now, and tried everything. How do you do mecanum wheel programming?
Reply With Quote
  #2   Spotlight this post!  
Unread 10-02-2015, 18:19
legts legts is offline
Autonomous Queen
FRC #2399 (The Fighting Unicorns)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2012
Location: Ohio
Posts: 73
legts is an unknown quantity at this point
Re: Programming Mecanum Wheels

Hi! I've dug up a few mechanum links from wpi located here: http://wpilib.screenstepslive.com/s/...botdrive-class and here: http://wpilib.screenstepslive.com/s/...-mecanum-drive.

I don't know if they particularly relate to your team's robot, but they will hopefully be useful! My team has done mechanum drivetrain for the two years I have been on the team, so let me know if you have any questions or need more explanation!
Reply With Quote
  #3   Spotlight this post!  
Unread 10-02-2015, 18:52
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
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: Programming Mecanum Wheels

Quote:
Originally Posted by michaelyork View Post
I have tried searching CD and WPILib for a while now, and tried everything. How do you do mecanum wheel programming?
WPILib RobotDrive.java

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;
        }
Reply With Quote
  #4   Spotlight this post!  
Unread 12-02-2015, 19:31
michaelyork michaelyork is offline
Registered User
FRC #3680 (Elemental Dragons)
Team Role: Programmer
 
Join Date: Mar 2014
Rookie Year: 2014
Location: Statesville, NC, United States
Posts: 18
michaelyork is an unknown quantity at this point
Question Re: Programming Mecanum Wheels

I have no idea why this code is not working, any ideas, I have been stressing about it for the past two hours.
Code:
        double magnitude = driveStick.getMagnitude();
        double direction = driveStick.getDirectionDegrees();
        double rotation = otherStick.getTwist();
        RobotDrive driveTrain = new RobotDrive(3,4,5,6);
        while (isEnabled() && isOperatorControl()) {
        	
        	driveTrain.mecanumDrive_Polar(magnitude, direction, rotation);
        	Timer.delay(0.005);
        }
This is located in teleopPeriodic() in Robot.java.

Any ideas?
Reply With Quote
  #5   Spotlight this post!  
Unread 12-02-2015, 22:43
cstelter cstelter is offline
Programming Mentor
AKA: Craig Stelter
FRC #3018 (Nordic Storm)
Team Role: Mentor
 
Join Date: Apr 2012
Rookie Year: 2012
Location: Mankato, MN
Posts: 77
cstelter will become famous soon enough
Re: Programming Mecanum Wheels

You probably want to fetch the current values from your joystick *inside* the while(isEnabled && isOperatorControl()) loop. Otherwise you take the reading once and keep sending them over and over.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:53.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi