Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   How to make backwards forward? (http://www.chiefdelphi.com/forums/showthread.php?t=86437)

Rangel(kf7fdb) 29-07-2010 13:33

How to make backwards forward?
 
Hello, I am new to programming and on my robot we have 4 wheels. The only problem is that the front wheels are backwards so when we try and go forward with all 4 wheels, the front wheels go backwards while the back wheels go forward. How would we make the robot's front wheels go backwards while the back wheels go forward and vice versa. Here is what our code looks like. Sorry about the format.

#include

"WPILib.h"
/**

* This is a demo program showing the use of the RobotBase class.

* The SimpleRobot class is the base of a robot application that will automatically call your

* Autonomous and OperatorControl methods at the right time as controlled by the switches on

* the driver station or the field controls.

*/

class

RobotDemo : public SimpleRobot
{

RobotDrive myRobot; // robot drive system
Joystick stick; // only joystick
public

:
RobotDemo(

void):
myRobot(1, 2, 3, 4), // 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);
myRobot.Drive(0.5, 0.0); // drive forwards half speed
Wait(2.0); // for 2 seconds
myRobot.Drive(0.0, 0.0); // stop robot
}

/**
* Runs the motors with arcade steering.

*/

void OperatorControl(void)
{

GetWatchdog().SetEnabled(true);
while (IsOperatorControl())
{

GetWatchdog().Feed();
myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
Wait(0.005); // wait for a motor update time
}

}

};

START_ROBOT_CLASS(RobotDemo);

Alan Anderson 29-07-2010 13:52

Re: How to make backwards forward?
 
You can either reverse the wiring or invert the motor direction in software. This thread has the detailed answers you need.


All times are GMT -5. The time now is 13:51.

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