Quote:
Originally Posted by RufflesRidge
I'd wager that either robot or gyro is an uninitialized pointer.
|
That doesn't seem to be it. To clarify, eclipse doesn't give us any errors when we deploy or build; the roboRIO gives us a red comm light when we deploy it, and it gets no code. It gets code fine if auto is commented out. Here's a sample with the robotinit part to clarify that:
Code:
#include "WPILib.h"
class Robot: public IterativeRobot
{
private:
//Initializing livewindow
LiveWindow *lw;
//Initializing stick
Joystick *stick;
//Initializing the Chassis parts
Talon *kFrontLeftMotor;
Talon *kFrontRightMotor;
RobotDrive *robot;
Relay *Fan;
DoubleSolenoid *shifter;
Encoder *ChassisEnc;
Encoder *OtherEnc;
//Initializing the values for Cheesy Drive
float Rotation;
float Acceleration;
float rightMultiplier;
float leftMultiplier;
double automode;
Gyro *gyro;
bool robottime;
double Angle;
void RobotInit()
{
SmartDashboard::init();
lw = LiveWindow::GetInstance();
stick = new Joystick(0);
kFrontLeftMotor = new Talon(0);
kFrontRightMotor = new Talon(1);
robot = new RobotDrive(kFrontRightMotor, kFrontLeftMotor);
Fan = new Relay (3);
/* Setting the shifter as a DoubleSolenoid
* Because we're using both pistons off of
* one Double Solenoid
*/
shifter = new DoubleSolenoid (0,1);
ChassisEnc = new Encoder (0,1, false, Encoder::EncodingType::k4X);
OtherEnc= new Encoder (8,9, false, Encoder::EncodingType::k4X);
//Setting it so the fan is off by default
Fan->Set(Relay::kOff);
//Setting the Rotation and Accel values
Rotation = stick->GetRawAxis(1);
Acceleration = stick->GetRawAxis(3);
/*Setting the multipliers
* so that they don't allow
* a robot to go full forward
* while going full turn
*/
rightMultiplier = Rotation + Acceleration;
leftMultiplier = Rotation - Acceleration;
//Setting the shifter to Low Gear
shifter->Set(DoubleSolenoid::kReverse);
robot->SetInvertedMotor(RobotDrive::kFrontLeftMotor, true);
robot->SetInvertedMotor(RobotDrive::kFrontRightMotor, true);
ChassisEnc->SetDistancePerPulse(11.04);
OtherEnc->SetDistancePerPulse(11.04);
/*gyro = new Gyro (2);
Angle = gyro->GetAngle();
if (stick->GetRawButton(1))
{
automode = 1;
}
if (stick->GetRawButton(2))