Announcement

Collapse
No announcement yet.

RobotC says I have an error. I can't figure out whats wrong.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • RobotC says I have an error. I can't figure out whats wrong.

    So guys, I had the program done before the robot was done. I had to wait before I could actually test it out, so here I am, a week until our competition and our program doesn't work. So, can anyone figure out what is wrong with the program?

    Thanks,
    Eric A. 'Lectric Legends-Team-8417




    #pragma config(Hubs, S1, HTMotor, HTMotor, none, none)
    #pragma config(Sensor, S1, , sensorI2CMuxController)
    #pragma config(Motor, mtr_S1_C1_1, motorRight, tmotorTetrix, openLoop)
    #pragma config(Motor, mtr_S1_C1_2, motorLeft, tmotorTetrix, openLoop, reversed)
    #pragma config(Motor, mtr_S1_C2_1, motorScissor, tmotorTetrix, openLoop)
    #pragma config(Motor, mtr_S1_C2_2, motorConveyor, tmotorTetrix, openLoop)
    //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

    #include "joystickdriver.c"



    #define button1 0x01
    #define button2 0x02
    #define button3 0x04
    #define button4 0x08
    #define button5 0x10
    #define button6 0x20
    #define button7 0x40
    #define button8 0x80
    #define button9 0x100
    #define button10 0x200
    /*
    Program Name: 'LectricLegendsDriverControl_V2
    Coder's Name: Eric Adams
    Team Name: 'Lectric Legends
    Team Number: 8417


    Drive Motors = D, E
    Conveyor Belt Motor = F
    Scissor Lift = G
    Beater Bar = A

    Left Wheel = Left Joystick(joystick1) Y value .D motor Status: Completed
    Right Wheel = Right Joystick(joystick2) Y value .E Motor Status: Completed
    Conveyor Belt = Buttons 6, 8. 6 = up, down. 8 = stop Status: Completed
    Scissor Lift = TopHat 0,2,4,6. respectively +60cm, +30cm, -60cm,-30cm Status: Mostly Completed, Need Time Measurements For CM heights
    BeaterBar = RightTrigger(Button7) toggle button Status: Completed
    Emergency Stop = B Button(button3) Status: Completed
    25% Power = Y Button(button4) Status: Completed
    50% Power = X Button(button1) Status: Completed
    100% power = A Button(button2) Status: Completed

    */



    int conveyor = 0;
    int scissorLift = 0;
    int buttonSpeed = 50;
    int maxPower = .5;
    bool beaterBar = false;


    task main()

    {
    initializeRobot();
    waitForStart();
    while (true)
    {
    getJoystickSettings(joystick);

    // Turbo Mode
    if (joy1Btn(4)){
    buttonSpeed == 25;
    maxPower == .25;
    }

    if (joy1Btn(1)){
    buttonSpeed == 50;
    maxPower == .5;
    }

    if (joy1Btn(2)){
    buttonSpeed == 100;
    maxPower == 1;
    }

    // End Turbo Mode
    //Joystick Function
    motor[MotorRight] = joy1_y1;
    if(joy1_y1 > buttonSpeed) {
    joy1_y1 = (joy1_y1*maxPower);
    }

    motor[MotorLeft] = joy1_y2;
    if(joy1_y2 > buttonSpeed) {
    joy1_y2 = (joy1_y2*maxPower);
    }

    // End Joystick Function
    // Begin Conveyor belt function

    if((joy1Btn(6)) && (conveyor = 0))){
    conveyor = 1;
    }
    if((joy1Btn(6)) && (conveyor = 1)){
    conveyor = 0;
    }
    if(joy1Btn(5)){
    conveyor = -1;
    }

    motor[MotorConveyor] = (43.257 * conveyor);//43.257 was brandons Idea, not my fault if it breaks it.

    // End conveyor belt function

    // Begin Emergency Stop
    if(joy1Btn(3){
    motor[motorA] = 0;
    motor[motorRight] = 0;
    motor[motorLeft] = 0;
    motor[motorConveyor] = 0;
    motor[motorScissor] = 0;
    }
    // End Emergency Stop

    // Begin Scissor Lift
    if(joystick.joy1_TopHat == 0){
    motor[motorScissor] = 75;
    time1(200); //THIS LINE NEEDS TO BE ALTERED SO THE TIME IS RIGHT FOR +60 CM
    }
    if(joystick.joy1_TopHat == 2){
    motor[motorScissor] = 75;
    time1(200); //THIS LINE NEEDS TO BE ALTERED SO THE TIME IS RIGHT FOR +30 CM
    }
    if(joystick.joy1_TopHat == 4){
    motor[motorScissor] = -75;
    time1(200); //THIS LINE NEEDS TO BE ALTERED SO THE TIME IS RIGHT FOR -60 CM
    }
    if(joystick.joy1_TopHat == 6){
    motor[motorScissor] = -75;
    time1(200); //THIS LINE NEEDS TO BE ALTERED SO THE TIME IS RIGHT FOR -30 CM
    }







    // End Scissor Lift

    // Begin Beater Bar Function
    /* if(joy1Btn(7)) && (beaterBar = false){
    beaterBar = true;
    }
    if(joy1Btn(7)) && (beaterBar = true){
    beaterBar = false;
    }

    if(beaterBar = true){
    motor[motorA] = 100;
    }
    if(beaterBar = false){
    motor[motorA] = 0;
    }
    */
    // End Beater Bar Function Beater Bar Function Currently not in use.


    }


    }

  • #2
    Can you include the error RobotC was giving you?

    Comment


    • #3
      Originally posted by System42 View Post
      Can you include the error RobotC was giving you?

      "there were errors during complilation"
      That is what is says. It appears the error is on line 96. I don't understand what the error could be, though.

      edit: line 96 is the first line in the conveyor belt function
      Last edited by Electonic; 01-24-2015, 12:13 PM.

      Comment


      • #4
        Errors:

        1. You have an extra ")" on the first line of the conveyor function.
        2. You're assigning values like 0.5 to maxpower, which is an int and can only have integer values. You need to make maxpower a float.
        3. Lines like "buttonSpeed == 25;" should be "buttonSpeed = 25;" You use "==" to test if things are equal and you use "=" to set one thing equal to another.
        4. And conversely, lines like "if (beaterBar = true)" should be "if (beaterBar == true)" because here you ARE doing a test and want to use "==".
        Last edited by Cheer4FTC; 01-24-2015, 01:27 PM.

        Comment


        • #5
          Originally posted by Cheer4FTC View Post
          Errors:

          1. You have an extra ")" on the first line of the conveyor function.
          2. You're assigning values like 0.5 to maxpower, which is an int and can only have integer values. You need to make maxpower a float.
          3. Lines like "buttonSpeed == 25;" should be "buttonSpeed = 25;" You use "==" to test if things are equal and you use "=" to set one thing equal to another.
          4. And conversely, lines like "if (beaterBar = true)" should be "if (beaterBar == true)" because here you ARE doing a test and want to use "==".
          Thanks, that took care of those, but now there is an error on the initializeRobot();. Is that really an error?

          Comment


          • #6
            nope, no error. But when i start the match on the FCS, all the robot does is lock up. Doesn't respond to the controlls at all

            Comment


            • #7
              Well, initializeRobot() is a function that's being called, but doesn't exist in your code. Commenting that line out might help.
              Burning Lights Programming
              FLL Team 341 Brick Chick'N Boys - Programmer (2009-2010)
              FLL Team 263 Brainy Bricks - Programmer (2010-2011)
              FLL Team 5028 Fellowship of the Brick - Youth Mentor (2011-2012)
              FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
              FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
              FTC Team 7468 Blue Chariots of Fire - Mentor/Coach (2014-2017)

              Comment

              Working...
              X