View Full Version : Need help in c++ and windriver
jkjohnson
13-01-2009, 16:53
Im new to programming in c++ and using the windriver enviornment. I was wondering if any one could post example drivecode (I read the simple robot code and it did not work when I downloaded it).
ThanK you in advance!!!
wt200999
13-01-2009, 17:27
Are you using the SimpleTemplate example? What kind of drive are you planning on? Arcade drive? Tank drive? How many motors, and do you have your control system all wired up? And have you looked at the documentation?
http://www.chiefdelphi.com/forums/showthread.php?t=71498
jkjohnson
13-01-2009, 18:24
yes we used the simple template.... we are planning on using tank drive... we have 4 motors...yes the control system is wired up
Thankyou
wt200999
13-01-2009, 18:50
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:
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);
}
}
};
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.