Thread: Motor Code Help
View Single Post
  #4   Spotlight this post!  
Unread 14-02-2010, 14:55
odel's Avatar
odel odel is offline
Registered User
FRC #2990 (Hotwire Robotics)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Oregon
Posts: 8
odel is an unknown quantity at this point
Send a message via Yahoo to odel
Re: Motor Code Help

So now I have:
Code:
class RobotDemo : public SimpleRobot
{
	Jaguar frontLeftMotor(1);
	RobotDrive drivetrain(SpeedController *frontLeftMotor, SpeedController *rearLeftMotor, SpeedController *frontRightMotor, SpeedController *rearRightMotor, float sensitivity=0.5)
	Joystick stick; // only joystick

public:
	RobotDemo(void):
		myRobot(1, 2),	// these must be initialized in the same order
		stick(1)		// as they are declared above.
	{
		GetWatchdog().SetExpiration(0.1);
	}

	/**
	 * Drive left & right motors for 2 seconds then stop
	 */
	void Autonomous(void)
	{
		GetWatchdog().SetEnabled(false);
		drivetrain.Drive(0.5, 0.0); 	// drive forwards half speed
		Wait(2.0); 				//    for 2 seconds
		drivetrain.Drive(0.0, 0.0); 	// stop robot
	}

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		GetWatchdog().SetEnabled(true);
		while (IsOperatorControl())
		{
			GetWatchdog().Feed();
			robotDrive.TankDrive(stick1,stick2);
			Wait(0.005);				// wait for a motor update time
		}
	}
};

START_ROBOT_CLASS(RobotDemo);
I need help declaring the Jaguars now
__________________
Reply With Quote