Skip to content
This repository was archived by the owner on Oct 8, 2019. It is now read-only.

WIllPower WikI

Rishabh Singh edited this page Sep 4, 2017 · 1 revision

Hello Everyone! Whether you are from the ends of the Earth or just another Positronic Panther ready to get started with Nease Robotic's c++ FRC Custom Class. This class is loaded with functions that will make your day easier and hey if you are looking to see a real world example of how FIRST's WPILib functions work you have come to the right place! So without further ado here you go:

So to start off we need a function to drive, WPILib C++ provides us with the function:

TankDrive()

since that function is not so hard to code we have our own shell function:

void drive(double Lval, double Rval)

Just call the "drive()" function and point it to your WillPower object and it should run! (For Example if I have a WillPower object named "will" I would run will.drive(double val, double val )).

The second function is actually two different functions they both allow you to set a start and finish time

void autoDrive(double Lval, double Rval, double start, double fin)

Allows the robot to automatically drive based on given value.

and

void AutoDrive(std::string dir, double start, double fin

Allows the robot to automatically drive based on direction.

The third set of functions involves lifting up a ramp or controlling two servos, this is pretty be useful but be careful while using it servos are expensive.

//function to set ramp to a certain angle. BE CAREFUL NOT TO BREAK THE SERVOS WITH THIS ONE
void ramp(int Langle, int Rangle){
		RServo.SetAngle(Rangle);
		LServo.SetAngle(Langle);
}
//another ramp function, CAUTION CAUTION CAUTION CAUTION!!!!!!! MAY BREAK SERVOS!!!
void ramp(std::string pos){
	if(pos == "up"){
		RServo.SetAngle(130);
		LServo.SetAngle(170);
	}
	if(pos == "down"){
		RServo.SetAngle(250);
		LServo.SetAngle(60);
	}
}

Here is the automatic servo one, be very very careful with this one

 //a third function for the ramp, just as dangerous as the others. this one can be used in auto mode though, so you 
  //have EVEN LESS CONTROL.
void autoRamp(std::string pos, double start, double fin){
	if((start < autoTimer.Get() ) && (autoTimer.Get() < fin)){
		if(pos == "up"){
			RServo.SetAngle(130);
			LServo.SetAngle(170);
			}
		if(pos == "down"){
			RServo.SetAngle(250);
			LServo.SetAngle(60);
			}
		}
	}

Again Be very Careful we are not responsible for the damages incurred...

Clone this wiki locally