Go to Post Keep arrogant, belittling and misspelled bragging off these boards. - Mike [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

 
 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 29-09-2014, 11:53
aweso_meme aweso_meme is offline
Registered User
FRC #4687
 
Join Date: Feb 2014
Location: Minnesota
Posts: 20
aweso_meme is an unknown quantity at this point
Mecanum Wheels & Encoders -- Java code

Hello all,

I am from team 4687, and I am having some trouble coding the encoders for a mecanum wheel robot. I currently have some code developed to read the encoder values, but I am unsure of how to change the speeds of the wheels based off of these values. Here is what I would like to do:
I would like to use 1 wheel and call it the master wheel. This wheel will provide me with an encoder value. This encoder value will then be used to "enslave" the other wheels, which will then match the master wheel's rpm. The only differences in the wheels will happen when I change the direction of the wheels to move in the directions I need them to move in.

If you guys have any other way to implement some encoder code into a mecanum wheel drive to get all the wheels to move the same speed all the time, it would be great if you could advise me on that too. I will leave you all with my current code, with encoders implemented but doing nothing.

Thank you all in advance for your help in this project.


Code:
//I do my brackets differently than most
//import statements
public class RobotTemplate extends SimpleRobot
{
RobotDrive drive =- new RobotDrive(1,2,3,4);
Joystick joystick = new Joystick(1);
Encoder wheelOne = new Encoder(8,7);
Encoder wheelTwo = new Encoder(4,3);
Encoder wheelThree = new Encoder(6,5);
Encoder wheelFour = new Encoder (2,1);

     public void OperatorControl()
     {
          while(true && isOperatorControl() && isEnabled())
          {
          drive.mecanumDrive_Cartesian(joystick.getX(), joystick.getY(), -1*joystick.getTwist(), 0);
          Timer.delay(0.001);
          int one = wheelOne.get();
          int two = wheelTwo.get();
          int three = wheelThree.get();
          int four = wheelFour.get();
          }
     }
}
Reply With Quote
 


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 12:23.

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