View Single Post
  #6   Spotlight this post!  
Unread 29-02-2012, 14:40
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Programming Mecanum Wheels - 4 Victors

No, your code just declared four Victor pointers but you did not instantiate them. Regarding the Attack3 joystick, can't help you on that since I am not familiar with it.
Code:
#include "WPILib.h"
class RobotDemo : public SimpleRobot
{
    Victor *leftFrontMotor;
    Victor *leftRearMotor;
    Victor *rightFrontMotor;
    Victor *rightRearMotor;
    RobotDrive *drive;
 
    Joystick *Attack1;
    Joystick *Attack2;
 
public:
    RobotDemo(void)
    {
        leftFrontMotor = new Victor(1);
        leftRearMotor = new Victor(2);
        rightFrontMotor = new Victor(3);
        rightRearMotor = new Victor(4);
        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);
__________________

Last edited by mikets : 29-02-2012 at 14:42.
Reply With Quote