Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Control System (http://www.chiefdelphi.com/forums/forumdisplay.php?f=177)
-   -   RoboRIO red comm light, not accepting code? (http://www.chiefdelphi.com/forums/showthread.php?t=133820)

thatprogrammer 01-02-2015 10:32

RoboRIO red comm light, not accepting code?
 
Our PDP is giving us an orange light, and our roboRIO is giving us a red comm light. When we deploy code, eclipse reports it as deployed, but the roboRIO does not seem to get the new code. The ni web browser does NOT report a sticky fault.
Technical Details:
RoboRIO is imaged
Can ID's are correct
No fuses appear to be blown
Driver station can connect, but does not report any code

Alan Anderson 01-02-2015 10:50

Re: RoboRIO red comm light, not accepting code?
 
Is the roboRIO perhaps set to not run the user program on startup?

thatprogrammer 01-02-2015 13:58

Re: RoboRIO red comm light, not accepting code?
 
Commenting out the auto code I had added fixed the red comm light. Does anyone mind reading through the code to see what might be causing the error?
Code:

void AutonomousInit()
        {

                //gyro->Reset();
        }

        void AutonomousPeriodic()
        {

/*
        SmartDashboard::PutNumber("Gyro Angle:", Angle);
if (automode == 1)
{
        gyro->GetAngle();
{
        if (Angle == 90)
        {
                robottime = false;
        } else {
                robottime = true;
        }
}
if(robottime == true)
{
        robot->Drive(0,-1);
}
if (robottime == false)
{
        robot->Drive(0,-1);
}
}
if (automode == 2)
{
        gyro->GetAngle();
        if (Angle == 45)
        {
                robottime = false;
        } else {
                robottime = true;
        }
        if (robottime == true)
        {
                robot->Drive(0, -.5);
        }
        if (robottime == false)
        {
                robot->Drive(0,0);
        }
}
*/
}

is using a selector based on joystick button during robotinit causing this?

RufflesRidge 01-02-2015 13:59

Re: RoboRIO red comm light, not accepting code?
 
I'd wager that either robot or gyro is an uninitialized pointer.

thatprogrammer 01-02-2015 21:51

Re: RoboRIO red comm light, not accepting code?
 
Quote:

Originally Posted by RufflesRidge (Post 1436978)
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))


RufflesRidge 01-02-2015 21:54

Re: RoboRIO red comm light, not accepting code?
 
The gyro constructor is commented out in the code you just posted, and your gyro appears to be on a channel that won't work. It needs to be on Channels 0 or 1.

thatprogrammer 01-02-2015 22:36

Re: RoboRIO red comm light, not accepting code?
 
Quote:

Originally Posted by RufflesRidge (Post 1437127)
The gyro constructor is commented out in the code you just posted, and your gyro appears to be on a channel that won't work. It needs to be on Channels 0 or 1.

Yeah, it was commented out after deploying, along with the auto code. Confused about the second sentence, doesn't the gyro have four ports it can plug into? Sorry for slow replies BTW, school WiFi does not let me post on chief Delphi, other than starting threads.

RufflesRidge 01-02-2015 23:03

Re: RoboRIO red comm light, not accepting code?
 
Quote:

Originally Posted by thatprogrammer (Post 1437142)
Yeah, it was commented out after deploying, along with the auto code. Confused about the second sentence, doesn't the gyro have four ports it can plug into? Sorry for slow replies BTW, school WiFi does not let me post on chief Delphi, other than starting threads.

The Analog Accumulators used for the gyro are only on channels 0 and 1.

See Gyro: http://first.wpi.edu/FRC/roborio/rel...classGyro.html
And AnalogInput kAccumulatorChannels : http://first.wpi.edu/FRC/roborio/rel...alogInput.html

TimTheGreat 01-02-2015 23:23

Re: RoboRIO red comm light, not accepting code?
 
Try looking at the logs on the Dashboard. Usually they'll give you an error.

thatprogrammer 04-02-2015 21:43

Re: RoboRIO red comm light, not accepting code?
 
Changing gyro port to 1 fixed it! Thanks. The only thing I can't figure out is how to have multiple auto modes without using the selectable chooser. It seems that only works with command based robot?


All times are GMT -5. The time now is 20:05.

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