Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Need help in c++ and windriver (http://www.chiefdelphi.com/forums/showthread.php?t=72040)

jkjohnson 01-13-2009 04:53 PM

Need help in c++ and windriver
 
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 01-13-2009 05:27 PM

Re: Need help in c++ and windriver
 
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/sh...ad.php?t=71498

jkjohnson 01-13-2009 06:24 PM

Re: Need help in c++ and windriver
 
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 01-13-2009 06:50 PM

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);
                }
        }
};



All times are GMT -5. The time now is 10:34 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi