Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   FIRST Tech Challenge (http://www.chiefdelphi.com/forums/forumdisplay.php?f=146)
-   -   [FTC]: Field Control System Not Working (http://www.chiefdelphi.com/forums/showthread.php?t=131374)

FRC Team CC 05-12-2014 21:19

[FTC]: Field Control System Not Working
 
Dear Chief Delphi,

We are the Charging Champions, a six-member rookie team from SoCal. Our teleop program works fine on the RobotC joystick function but when we tested our program on the Field Control System, the robot started to act quite weirdly - the right set of wheels started to move even when we did not move the joystick thumbstick.

Here is the program:
Code:

#pragma config(Hubs,  S1, HTMotor,  HTMotor,  HTServo,  HTMotor)
#pragma config(Motor,  mtr_S1_C1_1,    rightTopDrive, tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C1_2,    rightBottomDrive, tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_1,    brush,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_2,    pulley,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C4_1,    leftBottomDrive, tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C4_2,    leftTopDrive,  tmotorTetrix, openLoop, reversed)
#pragma config(Servo,  srvo_S1_C3_1,    basket,              tServoStandard)
#pragma config(Servo,  srvo_S1_C3_6,    brushUpAndDown,      tServoStandard)
//*!!Code automatically generated by 'ROBOTC' configuration wizard              !!*//

#include "JoystickDriver.c" //call joystick functions
task main()
{
  waitForStart();
        getJoystickSettings(joystick); //call the function
        servo[basket] = 15; // servo basket at 15 degrees
       
        while(true) //constantly check for the joystick input
        {
                if(abs(joystick.joy1_y1) > 10)// if the absolute value of the left joystick in Joystick 1 is greater than 10
          {
                  motor[leftBottomDrive] = joystick.joy1_y1 * 25/127;// the left-back wheel drives at power 50
                  motor[leftTopDrive] = joystick.joy1_y1 * 25/127;// the left-front wheel drives at power 50
          }
          else
          {
                  bFloatDuringInactiveMotorPWM = true;//start coasting
                  motor[leftBottomDrive] = 0;//left-back wheel does not move
                  bFloatDuringInactiveMotorPWM = true;//start coasting
                  motor[leftTopDrive] = 0;//left-front wheel does not move
          }
          if(abs(joystick.joy1_y2) > 10)// of the absolute value of the right joystick in Joystick 1 if greater than 10
          {
                  motor[rightBottomDrive] = joystick.joy1_y2 * 25/127 ;// the right-back wheel drives at power 50
                  motor[rightTopDrive] = joystick.joy1_y2 * 25/127;// the right-front wheel drives at power 50
          }
          else
          {
                  bFloatDuringInactiveMotorPWM = true;//start coasting
                  motor[rightBottomDrive] = 0;//right-back wheel does not move
                  bFloatDuringInactiveMotorPWM = true;//start coasting
                  motor[rightTopDrive] = 0;//right-front wheel does not move
          }
          if(joy2Btn(4) == 1 || joy1Btn(4) == 1) //if joystick button Y is pressed
          {
                  motor[brush] = 70;// brush will spin at power 70
          }
          else
          {
                  bFloatDuringInactiveMotorPWM = false;
                  motor[brush] = 0; //motor will not spin
          }
         
          if(joy2Btn(5) == 1) //if Joystick button LB is pressed
          {
                  servo[brushUpAndDown] = 255;// brush goes up the arm
          }
          else if(joy2Btn(6) == 1)// if Joystick button RB is pressed
          {
                  servo[brushUpAndDown] = 0;// brush goes down the arm
          }
          if(joystick.joy2_TopHat == 0)// if the "North" button on Tophat is pressed
          {
                  servo[basket] = 230;// basket lifts up
          }
          if(joystick.joy2_TopHat == 4)//if the "South" button on Tophat is pressed
          {
                  servo[basket] = 115;// basket drops down
          }
          if(abs(joystick.joy2_y1) > 5 && abs(joystick.joy2_y2) > 5)// if the absolute value of both joysticks in Joystick 2 is greater than 5
          {
                  motor[pulley] = (joystick.joy2_y1 + joystick.joy2_y2) * 25/128;//pulley goes up and down
          }
          else
          {
                  bFloatDuringInactiveMotorPWM = false;
                  motor[pulley] = 0;// pulley does not go up or down
          }
        }
}

Is it a problem with the FCS or is our program not correctly written?

All help is appreciated. Go FTC Teams!!

Thanks,
The Charging Champions

IceStorm 05-12-2014 21:35

What mode is the switch on the bottom of your joysticks in? We had a similar problem and it was because it was on the X not the D mode. It's not documented very well but I found the same answer on the FTC forums after quite a bit of digging.

FRC Team CC 05-12-2014 21:41

Re: [FTC]: Field Control System Not Working
 
Thanks! This worked.

IceStorm 06-12-2014 09:01

Glad I could help.


All times are GMT -5. The time now is 17:19.

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