1. 4 months ago

    We are having problems with our robot jittering we have replaced everything that we think is an issue do y'all have any ideas? Here is a copy of my code :

  2. briancole

    Jan 10 Utah 4270C

    where's the code?

  3. Do you mean its running slow or its not moving???

  4. #pragma config(Sensor, in1, pot, sensorPotentiometer)
    #pragma config(Sensor, in2, pot2, sensorPotentiometer)
    #pragma config(Sensor, in3, pot3, sensorPotentiometer)
    #pragma config(Sensor, in4, pot4, sensorPotentiometer)
    #pragma config(Sensor, in8, pot8, sensorPotentiometer)
    #pragma config(Sensor, dgtl1, Lim1, sensorTouch)
    #pragma config(Sensor, dgtl8, Encoder1, sensorQuadEncoder)
    #pragma config(Motor, port1, Extr_R, tmotorVex393_HBridge, openLoop)
    #pragma config(Motor, port2, LF_Drive, tmotorVex393_MC29, openLoop, reversed)
    #pragma config(Motor, port3, LB_Drive, tmotorVex393_MC29, openLoop)
    #pragma config(Motor, port4, L_Lift, tmotorVex393_MC29, openLoop)
    #pragma config(Motor, port5, Claw, tmotorVex393_MC29, openLoop)
    #pragma config(Motor, port6, Chain_bar, tmotorVex393_MC29, openLoop)
    #pragma config(Motor, port7, R_Lift, tmotorVex393_MC29, openLoop)
    #pragma config(Motor, port8, RF_Drive, tmotorVex393_MC29, openLoop, reversed)
    #pragma config(Motor, port9, RB_Drive, tmotorVex393_MC29, openLoop, reversed)
    #pragma config(Motor, port10, Extr_L, tmotorVex393_HBridge, openLoop)
    //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
    // This code is for the VEX cortex platform
    #pragma platform(VEX2)

    // Select Download method as "competition"
    #pragma competitionControl(Competition)

    //Main competition background code...do not modify!
    #include "Vex_Competition_Includes.c"

    #define DB_THRESH 15 // Sets a deadband variable

    void Claw1(int power, int timex, int constant_power){
    motor(Claw) = power;
    wait1Msec(timex);
    motor(Claw) = constant_power;
    }

    void move(int power1, int power2, int timex) {
    motor[LF_Drive] = power1;
    motor[RF_Drive] = power1;
    motor[LB_Drive] = power2;
    motor[RB_Drive] = power2;
    wait1Msec(timex);
    motor[LF_Drive] = 0;
    motor[RF_Drive] = 0;
    motor[LB_Drive] = 0;
    motor[RB_Drive] = 0;
    }

    void lift(int power, int timex, int constant_power){
    motor[L_Lift] = power;
    motor[R_Lift] = power;
    wait1Msec(timex);
    motor[L_Lift] = constant_power;
    motor[R_Lift] = constant_power;
    }

    void extender(int power, int timex, int constant_power) {
    motor[Extr_R] = power;
    motor[Extr_L] = power;
    wait1Msec(timex);
    motor[Extr_L] = constant_power;
    motor[Extr_R] = constant_power;
    }

    void chainbar(int power, int timex, int constant_power) {
    motor[Chain_bar] = power;
    wait1Msec(timex);
    motor[Chain_bar] = constant_power;
    }

    void turn(int power1, int power2, int power3, int power4, int timex) {
    motor[LF_Drive] = power1;
    motor[RF_Drive] = power2;
    motor[LB_Drive] = power3;
    motor[RB_Drive] = power4;
    wait1Msec(timex);
    motor[LF_Drive] = 0;
    motor[RF_Drive] = 0;
    motor[LB_Drive] = 0;
    motor[RB_Drive] = 0;
    }

    void chainbar_lift(int power1, int power2, int timex, int constant_power1, int constant_power2, ){
    motor[L_Lift] = power1;
    motor[R_Lift] = power1;
    motor[Chain_bar] = power2;
    wait1Msec(timex);
    motor[L_Lift] = constant_power1;
    motor[R_Lift] = constant_power1;
    motor[Chain_bar] = constant_power2;
    }

    void move_adv(int power1, int power2, int distance, int constant_power) {
    // resetSensor(Encoder1);
    SensorValue(Encoder1) =0;

    while(abs(SensorValue(Encoder1)) < distance) {
    motor[LF_Drive] = power1;
    motor[RF_Drive] = power1;
    motor[LB_Drive] = power2;
    motor[RB_Drive] = power2;
    }
    motor[LF_Drive] = constant_power;
    motor[RF_Drive] = constant_power;
    motor[LB_Drive] = constant_power;
    motor[RB_Drive] = constant_power;
    }

    void put_cone_on_high(int timex) {
    // Initial WAIT in case we want to delay putting the cone on high... you have found the easter egg:) the easter bunny is happy for you
    wait1Msec(timex);

    // ########### MAIN AUTO PROGRAM ##############//
    //go forward
    //move_adv(60,-60,22,0);
    Claw1(127,10,10);
    move(67,-67, 525);
    //lift up
    lift(127,600,10);
    //move chainbar to position
    chainbar(-127,2000,0);
    //open claw
    Claw1(127,100,15);
    wait1Msec(500);
    lift(127,575,0);
    //go backwords
    move(-67,67, 485);
    //lift chainbar
    chainbar(127,1000,0);
    //lower extender
    lift(-127,1075,0);

    }
    void auton3(int timex) {
    wait1Msec(timex);
    chainbar(-100,1,-30); // CLAW holds cone
    //lift tower
    lift(100,900,0);
    //extend goal grabber
    extender(-127,1000,0);
    //move(-127,127,2750);
    move_adv(-55,55,1275,0); // Move forward
    //lift extender
    extender(127,1000,0);
    // go backwards
    move_adv(55,-55,1000,0);
    //turn
    turn(-60,60,60,-60,1695); // Turn Right
    //go forwards
    move_adv(-60,60,150,0);
    extender(-127,1000,0); // Extend
    move_adv(90,-90,275,0); // Move backward
    }
    void auton4(int timex) {
    wait1Msec(timex);
    chainbar(-100,1,-30); // CLAW holds cone
    //lift tower
    lift(100,500,0);
    //extend goal grabber
    extender(-127,1000,0);
    //move(-127,127,2750);
    move_adv(-55,55,1275,0); // Move forward
    //lift extender
    extender(127,1000,0);
    // go backwards
    move_adv(55,-55,1000,0);
    //turn
    turn(75,-75,-75,75,1695); // Turn left
    //go forwards
    move_adv(-60,60,150,0);
    extender(-127,1000,0); // Extend
    move_adv(90,-90,275,0); // Move backward

    }
    void auton5(int timex) { // 60 sec auton
    wait1Msec(timex);
    chainbar(-100,1,-30); // CLAW holds cone
    //lift tower
    lift(100,500,0);
    //extend goal grabber
    extender(-127,1000,0);
    //move(-127,127,2750);
    move_adv(-55,55,1275,0); // Move forward
    //lift extender
    extender(127,1000,0);
    // go backwards
    move_adv(55,-55,1000,0);
    //turn
    turn(75,-75,-75,75,1695); // Turn left
    //go forwards
    move_adv(-60,60,150,0);
    extender(-127,1000,0); // Extend
    move_adv(90,-90,275,0); // Move backward
    //turn
    //go forwards
    //turn
    //lower mogo
    //go forwards
    //raise mogo
    //go backwards
    //turn
    //go forwards
    //turn
    //go forwards

    }
    void pre_auton()
    {
    // Set bStopTasksBetweenModes to false if you want to keep user created tasks
    // running between Autonomous and Driver controlled modes. You will need to
    // manage all user created tasks if set to false.
    bStopTasksBetweenModes = true;

    // Set bDisplayCompetitionStatusOnLcd to false if you don't want the LCD
    // used by the competition include file, for example, you might want
    // to display your team name on the LCD in this function.
    // bDisplayCompetitionStatusOnLcd = false;

    }
    task autonomous()
    {
    // ..........................................................................
    // Insert user code here.
    // ..........................................................................

    // Remove this function call once you have "real" code.
    if(sensorvalue[Lim1]==1) {
    auton3(100); //Left Side -- going for 20
    //put_cone_on_high(100);
    } else {
    auton4(100); // Right Side -- going for 10
    }

    }
    task usercontrol()
    {
    // User control code here, inside the loop
    //int pauser = 0;

    while (true)
    {

    //Driving Controls
    if(abs(vexRT(Ch3)) >= DB_THRESH || abs(vexRT(Ch2)) >= DB_THRESH ){ // Checks to see if the joystick is beyond the deadband
    // allows motors to run since beyond the deadband arcade
    /*
    motor[LF_Drive] = vexRT[Ch3] + vexRT[Ch4];
    motor[LB_Drive] = - vexRT[Ch3] + vexRT[Ch4];
    motor[RF_Drive] = vexRT[Ch3] + vexRT[Ch4];
    motor[RB_Drive] = - vexRT[Ch3] + vexRT[Ch4];
    */
    //if(pauser < 1000){
    motor[LF_Drive] = - vexRT[Ch3];
    motor[LB_Drive] = + vexRT[Ch3];
    motor[RF_Drive] = - vexRT[Ch2];
    motor[RB_Drive] = + vexRT[Ch2];
    /*} else {

    motor[LF_Drive] = 0;
    motor[RF_Drive] = 0;
    motor[LB_Drive] = 0;
    motor[RB_Drive] = 0;
    wait10Msec(50);
    pauser=0;
    }
    */
    } else {
    // stop all drive motors within deadband, saves power and motors

    motor[LF_Drive] = 0;
    motor[RF_Drive] = 0;
    motor[LB_Drive] = 0;
    motor[RB_Drive] = 0;
    }

    if(vexRT[Btn5U]){ // cone grabber up
    extender(100,10,100);
    }
    else{
    extender(0,0,0);
    }

    if(vexRT[Btn5D]){ // cone grabber down
    extender(-100,10,-100);
    }
    else{
    extender(0,0,0);
    }
    if(vexRT[Btn6U]){ // lift up - extend up
    lift(127,20,10);
    }

    if(vexRT[Btn6D]){ // lift down extend down
    lift(-127,20,-10);
    }

    if(vexRT[Btn7D]){ // chainbar
    Claw1(127,10,127);
    }
    else{
    Claw1(0,0,0);
    }

    if(vexRT[Btn7U]){ // chainbar
    Claw1(-127,10,-127);
    }
    else{
    Claw1(0,0,0);
    }
    if(vexRT[Btn8D]){ // claw
    chainbar(100,10,100);
    }
    else{
    chainbar(0,0,0);
    }
    if(vexRT[Btn8U]){ // claw
    chainbar(-100,10,-100);
    }
    else{
    chainbar(0,0,-30);
    }
    //if(vexRT[Btn8R]){
    // chainbar_lift(100,-90,15,0,0);
    //}

    /*
    if(vexRT[Btn8R]){
    turn(-60,60,60,60,20);
    }

    if(vexRT[Btn8L]){
    turn(60,-60,60,60,20);
    }
    */
    //pauser=pauser++;

    /*bLCDBacklight = true; //turn on backlight
    string mainBattery, backupBattery;

    clearLCDLine(0); //clear screen
    clearLCDLine(1); //clear screen

    // battery voltage
    displayLCDString(0, 0, "Primary: ");
    sprintf(mainBattery, "%1.2f%c", nImmediateBatteryLevel/1000.0,'V');
    displayNextLCDString(mainBattery);

    displayLCDString(1, 0, "Secondary: ");
    sprintf(backupBattery, "%1.2f%c", BackupBatteryLevel/1000.0,'V');
    displayNextLCDString(backupBattery);

    //refresh rate
    wait1Msec(100);*/

    }
    }

  5. lelder

    Jan 10 Richmond, Virginia 177V

    From my experience, that is probably motors overheating. You likely either have too high of gear ratio or too much friction.

  6. ????

  7. I agree!!!

  8. briancole

    Jan 10 Utah 4270C

    Is that what PROS looks like?

  9. it stops and jitters (like shivering) then after awhile it works again

  10. briancole

    Jan 10 Utah 4270C

    I heard of a team in our class that had an issue where they were accidentally telling the robot to stop and go at the same time because they used two difference else if statements when they should have used it all in one string.

  11. You might need to check the ports or even replace the motors. That could Hurt your game in a competition.

  12. like i said we have replaced everything (power expander, motors, cortex)

  13. Have you checked the programming?

  14. and we replaced the motor controller

  15. briancole

    Jan 10 Utah 4270C

    Got to be something in code or you are gearing it with not enough torque.

  16. It maybe that the gears are not lined up.

  17. Dokkaebi

    Jan 10 Deal with it I like chocolate

    It might be cold

  18. briancole

    Jan 10 Utah 4270C

    What do you mean by that?

  19. ???????

  20. August (7842B)

    Jan 10 Comox Valley, BC 7842B

    @briancole I heard of a team in our class that had an issue where they were accidentally telling the robot to stop and go at the same time because they used two difference else if statements when they should have used it all in one string.

    This is a very common reason for jittering. We've had the same problem and it has always been the motors being told to do two different things at the same time.

  21. Newer ›
 

or Sign Up to reply!