Go to Post Fire and smoke are great if you're into Battlebots, but we like to avoid them in FIRST competitions. - [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 02-16-2013, 10:23 AM
normaldude8825 normaldude8825 is offline
Registered User
FRC #1872
 
Join Date: Jan 2012
Location: Puerto Rico
Posts: 8
normaldude8825 is an unknown quantity at this point
Help with Mecanum Code

Greeting, I am this year's programmer for the team I am part of and I am having some problems with the mecanum code. Could someone please help me out with the code or tell me the axis and button mapping for the Logitech Attack 3? The team wishes to use to Logitech Attack 3 joysticks to control the robot's movement. The first one to control the robot to move forward, back and sideways and the second joystick to make the robot rotate. The problem so far is the the joysticks move the robot in an undesired manner. By this I mean that the first joystick only controls if moved sideways and it causes the robot to rotate and the other joystick makes the robot try to move sideways activating only two motors with the X axis and rotate with moving the joystick forward only. Here is the mecanum code:
SpeedController frontLeftMotor =new Jaguar(1),
rearLeftMotor = new Jaguar (2),
frontRightMotor = new Jaguar (3),
rearRightMotor = new Jaguar (4);

RobotDrive drive=new RobotDrive(frontLeftMotor, rearLeftMotor, frontRightMotor, rearRightMotor);
Joystick leftStick=new Joystick(1);
Joystick rightStick=new Joystick(2);
drive.mecanumDrive_Cartesian(leftStick.getMagnitud e(), leftStick.getDirectionDegrees(), rightStick.getX(),0);

The only code I have gotten to work is with a Xbox 360 controller, but the team doesn't want to use an Xbox controller and I have seen in the forums that it is not highly recommended. Just in case here is the code for that:

RobotDrive chassis= new RobotDrive(1,2,3,4);
Joystick xboxController= new Joystick(1);
chassis.mecanumDrive_Cartesian(xboxController.getR awAxis(1), xboxController.getRawAxis(4), xboxController.getRawAxis(2), 0);
Reply With Quote
  #2   Spotlight this post!  
Unread 02-16-2013, 10:07 PM
twiggzee twiggzee is offline
Registered User
FRC #3502 (Octo-(PI)-Rates)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2011
Location: Tallahassee, FL
Posts: 55
twiggzee is an unknown quantity at this point
Re: Help with Mecanum Code

Quote:
Originally Posted by normaldude8825 View Post

drive.mecanumDrive_Cartesian(leftStick.getMagnitud e(), leftStick.getDirectionDegrees(), rightStick.getX(),0);
Try:
drive.mecanumDrive_Cartesian(leftStick.getX(), leftStick.getY(), rightStick.getX(),0);

Our team likes to use the Logitech Extreme 3D joystick for mecanum because it's a 3 axis joystick that has the normal X and Y movement as well as a twist capability that we use for rotating the robot instead of using a second joystick.

Good luck.
__________________
Wendy
Team 3502
Reply With Quote
  #3   Spotlight this post!  
Unread 02-16-2013, 10:13 PM
twiggzee twiggzee is offline
Registered User
FRC #3502 (Octo-(PI)-Rates)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2011
Location: Tallahassee, FL
Posts: 55
twiggzee is an unknown quantity at this point
Re: Help with Mecanum Code

Quote:
Originally Posted by normaldude8825 View Post
SpeedController frontLeftMotor =new Jaguar(1),
rearLeftMotor = new Jaguar (2),
frontRightMotor = new Jaguar (3),
rearRightMotor = new Jaguar (4);
Also, you don't need these SpeedController lines at all, just call the RobotDrive constructor class like this:
RobotDrive drive = new RobotDrive(1,2,3,4);
__________________
Wendy
Team 3502
Reply With Quote
  #4   Spotlight this post!  
Unread 02-16-2013, 10:14 PM
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Re: Help with Mecanum Code

Quote:
Originally Posted by twiggzee View Post
Also, you don't need these SpeedController lines at all, just call the RobotDrive constructor class like this:
RobotDrive drive = new RobotDrive(1,2,3,4);
True, but for anyone reading this, RobotDrive instantiates those ports as Jaguars, and using Jaguar timings. It is not correct to do this if you are using Victors, even if it still works.
__________________
All opinions are my own.
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 07:53 AM.

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