[FTC]: RobotC Issue

So i learned RobotC pretty much in about 2 hours, at first everything was going decently but after a while, this message started popping up on my NXT followed by two beeps as well as not letting my code run:

PgmCnt: 000129
Type: 2

Here is my code

//Motor and Servo Hubs
#pragma config(Hubs, S1, HTMotor, HTMotor, HTMotor, none)
#pragma config(Hubs, S2, HTServo, none, none, none)
//Tetrix Motors
#pragma config(Motor, mtr_S1_C1_1, rightdrive, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C1_2, leftdrive, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C2_1, shooter1, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C2_2, helix, tmotorNormal, openLoop, reversed)
#pragma config(Motor, mtr_S1_C3_1, shooter2, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C3_2, roller, tmotorNormal, openLoop)
//Servos
#pragma config(Servo, srvo_S2_C1_1, blocker, tServoNormal)
#pragma config(Servo, srvo_S2_C1_2, ramp, tServoNormal)
#pragma config(Servo, srvo_S2_C1_3, leftarm, tServoNormal)
#pragma config(Servo, srvo_S2_C1_4, rightarm, tServoNormal)
//Lego Motors
#pragma config(Motor, motorA, , tmotorNormal, PIDControl)
#pragma config(Motor, motorB, , tmotorNormal, PIDControl)
#pragma config(Motor, motorC, , tmotorNormal, PIDControl)

#include "JoystickDriver.c"  //Include file to "handle" the Bluetooth messages.

void initializeRobot() //Initialize Servo Positions
{
  servo[blocker]=120;
  servo[ramp]=0;
  servo[leftarm]=255;
  servo[rightarm]=255;
  return;
}

task main()
{
  initializeRobot();

  waitForStart(); //Wait for start of tele-op phase
  //Set Global Variables
  int shooterpower=0;
  int rhlpower=0;
  bool ldzero=false;
  bool rdzero=false;
  bool rhlzero=false;
  while (true)
  {
    getJoystickSettings(joystick); //Update variables with current joystick values

    //Controller 1
    //Leftjoy = left motors
    //Rightjoy = right motors
    //Btn 8 = Roller 100, Helix 100, Lego 100

    //Controller 2
    //Btn2 = Shooter 80
    //Btn3 = Shooter 90
    //Btn4 = Shooter 100
    //Btn5 = Servo left arm to 0 (left arm starts at 255)
    //Btn6 = Servo right arm to 0 (right arm starts at 255)
    //Btn7 = Servo Ramp to 180 (Ramp starts at 0)
    //Btn8 = Servo Blocker to 160 (Blocker starts at 120)
    
    if((joystick.joy1_y1)>5) //Left Drive
    {
      motor[leftdrive]=joystick.joy1_y1;
      ldzero=false;
    }
    else if((joystick.joy1_y1<=5&&ldzero==false))
    {
      motor[leftdrive]=0;
      ldzero=true;
    }
    
    if ((joystick.joy1_y2)>5) //Right Drive
    {
      motor[rightdrive]=joystick.joy1_y2;
      rdzero=false;
    }
    else if((joystick.joy1_y2<=5&&rdzero==false))
    {
      motor[leftdrive]=0;
      rdzero=true;
    }

    if(joy1Btn(8)) //Roller, Helix, and Lego
    {
      rhlpower=100;
      motor[roller]=rhlpower;
      motor[helix]=rhlpower;
      motor[motorA]=rhlpower;
      motor[motorB]=rhlpower;
      motor[motorC]=rhlpower;
      rhlzero=false;
    }
    else if((joy1Btn(8))==false&&rhlzero==false)
    {
      rhlpower=0;
      motor[roller]=rhlpower;
      motor[helix]=rhlpower;
      motor[motorA]=rhlpower;
      motor[motorB]=rhlpower;
      motor[motorC]=rhlpower;
      rhlzero=true;
    }

    if(joy1Btn(4)) //Shooter
    {
      shooterpower=100;
      motor[shooter1]=shooterpower;
      motor[shooter2]=shooterpower;
    }
    else if(joy2Btn(3))
    {
      shooterpower=90;
      motor[shooter1]=shooterpower;
      motor[shooter2]=shooterpower;
    }
    else if(joy2Btn(2))
    {
      shooterpower=80;
      motor[shooter1]=shooterpower;
      motor[shooter2]=shooterpower;
    }

    if(joy2Btn(5)) //LeftArm
    {
      servo[leftarm]=0;
    }
    else
    {
      servo[leftarm]=255;
    }

    if(joy2Btn(6)) //RightArm
    {
      servo[rightarm]=0;
    }
    else
    {
      servo[rightarm]=255;
    }

    if(joy2Btn(7)) //Ramp
    {
      servo[ramp]=180;
    }
    else
    {
      servo[ramp]=0;
    }

    if(joy2Btn(8)) //Blocker
    {
      servo[blocker]=180;
    }
    else
    {
      servo[blocker]=120;
    }
  }
}

I have been working on this one issue for about 3 hours now so here’s thanks in advance to anyone willing to help

Update: April 10, 2010, 11:30pm GMT-7

The line

//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

doesn’t make any difference in the error

i have updated my code and from changing the servo config lines as suggested, i got a new message which i have updated above also.

  1. Verify that the settings in the ROBOTC “Motors and Sensors Setup” match the robot. A mismatch causes a similar response on the NXT display.

  2. The “#pragma config (Servo, servo1, blocker,. . .)” statements should look like: “#pragma config(Servo, srvo_S2_C1_1, blocker, . . .” Using the ROBOTC “Motors and Sensors Setup” referenced in item #1 above should correct this problem.

  3. The following text is missing [remove the " marks at the beginning and the end]:

“//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//”

The statement should directly follow the last “#pragma config(. . .” statement.

This text was required with the version of ROBOTC used last season. I assume it is also true for the current version of ROBOTC.

  1. There could be more issues, however, these items jumped out during a quick review of the code.

1st. Have you tried taking the int code out and doing it??
2nd. Reflash the Firmware?

That text is just a comment from RobotC saying it did it. It does not effect the code though yes your (short) code should be set up as names in the motor and sensors setup.

#pragma config(Servo, servo1, blocker, tServoNormal)
#pragma config(Servo, servo2, ramp, tServoNormal)
#pragma config(Servo, servo3, leftarm, tServoNormal)
#pragma config(Servo, servo4, rightarm, tServoNormal)

– Snip –

short blocker=0;
short ramp=0;
short leftarm=0;
short rightarm=0;

The obvious thing that I see is that you are creating shorts with the same name as the servos and you are setting them to zero. Since this is an index into an array, and it is an enum, you are, in essence, telling the controller that all the servos are at location 0… which unfortunately is attached to a Motor Controller…

Definitely use the setup tool (as Michale suggested) to rebuild the setup #PRAGMA information block. Then, since they’re already set up, delete the code declaring the shorts later.

Hope that helps