2015-01-06 00:07:24 +00:00
|
|
|
#include "HHRobot.h"
|
|
|
|
#include "HHBase.h"
|
|
|
|
HHRobot::HHRobot():
|
2015-01-16 19:48:58 +00:00
|
|
|
DriveStick(new Extreme3dPro(0)),
|
2015-01-19 14:52:45 +00:00
|
|
|
AirCompressor(new Compressor(31)),
|
2015-01-17 12:28:12 +00:00
|
|
|
PowerDistPanel(new PowerDistributionPanel()),
|
2015-01-16 19:48:58 +00:00
|
|
|
//FrontRight,FrontLeft,RearRight,RearLeft
|
|
|
|
RobotDrive(new MecanumDrive(40,41,42,43)){
|
2015-01-06 00:07:24 +00:00
|
|
|
}
|
|
|
|
void HHRobot::Init(){
|
|
|
|
printf("Initing\n");
|
2015-01-18 09:54:36 +00:00
|
|
|
AirCompressor->Start();
|
2015-01-06 00:07:24 +00:00
|
|
|
}
|
|
|
|
//Main function used to handle periodic tasks on the robot
|
|
|
|
void HHRobot::Handler(){
|
2015-01-17 12:28:12 +00:00
|
|
|
//Code to lock the axis when driving
|
2015-01-16 21:01:39 +00:00
|
|
|
double x,y,z;
|
|
|
|
if (DriveStick->GetJoystickButton(1)){
|
2015-01-18 09:54:36 +00:00
|
|
|
x = DriveStick->GetJoystickAxis("x");
|
2015-01-16 21:01:39 +00:00
|
|
|
}else{
|
|
|
|
x = 0;
|
|
|
|
}
|
2015-01-18 09:54:36 +00:00
|
|
|
y = DriveStick->GetJoystickAxis("y");
|
|
|
|
z = DriveStick->GetJoystickAxis("z");
|
|
|
|
//X axis, Y axis, Z axis, sensitivity, mode threshold, gyro
|
|
|
|
RobotDrive->handler(x,y,z,0.95,DriveStick->GetThrottle(),0);
|
2015-01-19 14:52:45 +00:00
|
|
|
//Compressor Button assignment
|
|
|
|
if (DriveStick->GetJoystickButton(4)){
|
2015-01-17 12:28:12 +00:00
|
|
|
AirCompressor->Stop();
|
|
|
|
}
|
2015-01-06 00:07:24 +00:00
|
|
|
}
|
|
|
|
// vim: ts=2:sw=2:et
|