View Single Post
  #5   Spotlight this post!  
Unread 29-02-2012, 14:33
Unforgiven_Hero Unforgiven_Hero is offline
Registered User
FRC #1989
 
Join Date: Feb 2012
Location: Vernon
Posts: 11
Unforgiven_Hero is an unknown quantity at this point
Re: Programming Mecanum Wheels - 4 Victors

Okay so here is where I stand, don't have a chance to test it on the practice bot today but will tomorrow. Anyone got any advice on the program and is there anything essential I should add or do to this program? Not totally sure how to do the twist part for the Mecanum wheels using an Attack3 joystick...

Here it is:

Code:
#include "WPILib.h"
class RobotDemo : public SimpleRobot
{
	RobotDrive *drive;
	
	Victor *leftFrontMotor;
	Victor *leftRearMotor;
	Victor *rightFrontMotor;
	Victor *rightRearMotor;
	
	Joystick *Attack1;
	Joystick *Attack2;
	
public:
	RobotDemo(void)
	{		
		drive = new RobotDrive(leftFrontMotor,leftRearMotor,rightFrontMotor,rightRearMotor);	
		Attack1 = new Joystick(1);		
		Attack2 = new Joystick(2);
		GetWatchdog().SetExpiration(0.1); 
		drive->SetExpiration(0.1);
	}
	void Autonomous(void)
	{
	}
	void OperatorControl(void)
	{
		GetWatchdog().SetEnabled(true);
		drive->SetSafetyEnabled(true);
		while (IsOperatorControl())
		{
			drive->MecanumDrive_Cartesian(Attack1->GetX(),Attack1->GetY(),Attack2->GetTwist());
			Wait(0.005);				
		}
	}
};

START_ROBOT_CLASS(RobotDemo);
Reply With Quote