Go to Post For those of you that think the kit chassis is too weak... It is tough stuff. Those of you that say it is too weak, just do not know what you are talking about. - Paul Copioli [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 Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 16-02-2013, 10:23
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
 


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 08:27.

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