View Single Post
  #4   Spotlight this post!  
Unread 01-13-2009, 06:50 PM
wt200999's Avatar
wt200999 wt200999 is offline
Texas Instruments
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 321
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Send a message via MSN to wt200999
Re: Need help in c++ and windriver

Read up on the documentation for different objects. You need to create objects for the different things you are using, then you need to define where they are plugged in, then just implement them in the operator control. I would suggest reading up, look in this folder for documentation
C:\windriver\docs\extensions\FRC\

here is an example adapted from the simple robot example:

Code:
class RobotDemo : public SimpleRobot
{
	RobotDrive* myRobot; // robot drive system
	Joystick* m_leftStick;
	Joystick* m_rightStick;

public:
	RobotDemo(void)
	{
		GetWatchdog().SetExpiration(100);
		//candidates are RobotDrive( LeftFront, LeftRear, RightFront, RightRear);
		myRobot = new RobotDrive(1,3,2,4); //adapt to what yours are
		m_leftStick = new Joystick(1); //once again adapt these to what you have
		m_rightStick = new Joystick(2);
	}

	void Autonomous(void)
	{
		while (IsAutonomous())
		{
			GetWatchdog().Feed();
			//auton code here
		}
	}

	void OperatorControl(void)
	{
		GetWatchdog().SetEnabled(true);
		while (IsOperatorControl())
		{
			GetWatchdog().Feed();
			myRobot->TankDrive(m_leftStick, m_rightStick);
		}
	}
};
__________________
Programming in LabVIEW? Try VI Snippets!

FIRST LEGO League 2004 - 2005
FRC Team 870 Student 2006 - 2009
FRC Team 3005 Mentor 2013 -
Reply With Quote