View unanswered posts | View active topics It is currently Wed Sep 17, 2014 1:45 pm






Reply to topic  [ 11 posts ] 
Robotc error 
Author Message
Rookie

Joined: Thu Feb 16, 2012 1:03 pm
Posts: 7
Post Robotc error
I was programming a robot in my pre-engineering class and this error popped up. I haven't seen it before and I need some help debugging it.

**Error**:Compile time constant array index '64' is outside of array bound '0..43'


Thu Feb 16, 2012 1:07 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3221
Location: Rotterdam, The Netherlands
Post Re: Robotc error
You may have a mistake in your code somewhere, where you are accessing an array with an index that is larger than the actual size of the array. If we could see your code it would probably make it easier to pinpoint the issue.

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Thu Feb 16, 2012 1:14 pm
Profile WWW
Rookie

Joined: Thu Feb 16, 2012 1:03 pm
Posts: 7
Post Re: Robotc error
Code:
task main()
{  while (vexRT[Btn7D]==0)
  {
  }

  ClearTimer (T1);
  while (time1[T1]<60000)
  {
    startMotor (rightMotor, 65);
    startMotor (leftMotor, 65);
    untilSonarLessThan(sensorSONAR_inch, 0.0625);
    startMotor (rightElbow, -65);
    startMotor (leftElbow, -65);
    startMotor (wrist, -35);
    wait (1);
    startMotor (leftMotor, -65
  }


  while (time1[T1]>60000)
  {
    motor(rightMotor) = vexRT (Ch2);
    motor(leftMotor) = vexRT (Ch3);
    if(vexRT [Btn6D] == 1)
    {
      motor [rightElbow] = 65;
    }
    else if(vexRT [Btn6U] == 1)
    {
      motor [rightElbow] = -65;
    }
    else
    {
      motor [rightElbow] = 0;
    }
    if(vexRT [Btn5D] == 1)
    {
      motor [leftElbow] = 65;
    }
    else if(vexRT [Btn5U] == 1)
    {
      motor [leftElbow] = -65;
    }
    else
    {
      motor [leftElbow] = 0;
    }
   ** if (vexRT[btn8U] ==1) **
    {
      motor [wrist] =60;
    }
    else if(vexRT [btn8D] ==1)
    {
      motor [wrist] =-60;
    }
    else
    {
      motor [wrist] =0;
    }
  }
}

** error


Thu Feb 16, 2012 1:37 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3221
Location: Rotterdam, The Netherlands
Post Re: Robotc error
Please attach the complete program so I can yang it through the compiler myself without needing to make pragmas and stuff.

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Thu Feb 16, 2012 2:13 pm
Profile WWW
Rookie

Joined: Thu Feb 16, 2012 1:03 pm
Posts: 7
Post Re: Robotc error
mightor wrote:
Please attach the complete program so I can yang it through the compiler myself without needing to make pragmas and stuff.

- Xander

I copy and pasted the program


Thu Feb 16, 2012 2:17 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3221
Location: Rotterdam, The Netherlands
Post Re: Robotc error
Where are the pragmas? This is not a complete program.

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Thu Feb 16, 2012 2:24 pm
Profile WWW
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: Robotc error
This program wouldn't even compile even if you did have the proper include files:
Code:
  wait (1);
  startMotor (leftMotor, -65
}

_________________
sudo rm -rf /


Thu Feb 16, 2012 5:15 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3221
Location: Rotterdam, The Netherlands
Post Re: Robotc error
I wasn't even going to try and parse that thing in my head before I had the complete thing. That's what compilers are for :)

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri Feb 17, 2012 3:59 am
Profile WWW
Rookie

Joined: Thu Feb 16, 2012 1:03 pm
Posts: 7
Post Re: Robotc error
mightor wrote:
I wasn't even going to try and parse that thing in my head before I had the complete thing. That's what compilers are for :)

- Xander


#pragma config(Sensor, in1, lineTrackerLeft, sensorLineFollower)
#pragma config(Sensor, in2, lineTrackerCenter, sensorLineFollower)
#pragma config(Sensor, in3, lineTrackerRight, sensorLineFollower)
#pragma config(Sensor, dgtl1, Sonar, sensorSONAR_inch)
#pragma config(Sensor, dgtl3, limitSwitch, sensorTouch)
#pragma config(Motor, port2, rightMotor, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port3, leftMotor, tmotorNormal, openLoop)
#pragma config(Motor, port4, rightElbow, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port5, leftElbow, tmotorNormal, openLoop)
#pragma config(Motor, port6, wrist, tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main()
{ while (vexRT[Btn7D]==0)
{
}

ClearTimer (T1);
int threshold;
threshold= 3013;
while (time1 [T1]<60000)
{
if (SensorValue (lineTrackerLeft) < threshold)
{
motor [leftMotor] = 0;
motor [rightMotor] = 65;
}
if (SensorValue (lineTrackerCenter) < threshold)
{
motor [leftMotor] = 65;
motor [rightMotor] =65;
}
if (SensorValue (lineTrackerRight) < threshold)
{
motor [leftMotor] = 65;
motor [rightMotor] = 0;
}
}
while (time1[T1]<60000)
{
startMotor (wrist, 60);
wait (.01);
startMotor (rightMotor, -65);
startMotor (leftMotor, -65);
wait (.5);
startMotor (rightElbow, 50);
startMotor (leftElbow, 50);
startMotor (wrist, -50);
untilButtonPress (limitSwitch);
startMotor (leftMotor, -65);
startMotor (rightMotor, 65);
wait (5);
startMotor (rightMotor, 65);
startMotor (leftMotor, 65);
untilSonarLessThan(0.0625);
startMotor (rightElbow, -65);
startMotor (leftElbow, -65);
startMotor (wrist, -35);
wait (1);
stopMotor (rightElbow);
stopMotor (leftElbow);
stopMotor (wrist);
startMotor (leftMotor, -65);
startMotor (rightMotor, 65);
wait(5);
stopMotor (leftMotor);
stopMotor (rightMotor);
wait(.01);
startMotor (rightMotor, 65);
startMotor (leftMotor, 65);
untilSonarLessThan (4);
startMotor (rightElbow, 30);
startMotor (leftElbow, 30);
startMotor (wrist, -30);
wait(.5);
stopMotor (rightElbow);
stopMotor (leftElbow);
startMotor (wrist, 50);
wait(.5);

}


while (time1[T1]>60000)
{
motor(rightMotor) = vexRT (Ch2);
motor(leftMotor) = vexRT (Ch3);
if(vexRT [Btn6D] == 1)
{
motor [rightElbow] = 65;
}
else if(vexRT [Btn6U] == 1)
{
motor [rightElbow] = -65;
}
else
{
motor [rightElbow] = 0;
}
if(vexRT [Btn5D] == 1)
{
motor [leftElbow] = 65;
}
else if(vexRT [Btn5U] == 1)
{
motor [leftElbow] = -65;
}
else
{
motor [leftElbow] = 0;
}
**** if (vexRT[btn8U] ==1)
{
motor [wrist] =60;
}
else if(vexRT [btn8D] ==1)
{
motor [wrist] =-60;
}
else
{
motor [wrist] =0;
}
}
}


Fri Feb 17, 2012 1:16 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3221
Location: Rotterdam, The Netherlands
Post Re: Robotc error
Change btn8U to Btn8U and btn8D Btn8D and it'll compile fine.

Next you paste code, could you put inside code tags like this:
Code:
[code]your code goes here[/code]

That makes it a lot more readable :)

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri Feb 17, 2012 1:32 pm
Profile WWW
Rookie

Joined: Thu Feb 16, 2012 1:03 pm
Posts: 7
Post Re: Robotc error
mightor wrote:
Change btn8U to Btn8U and btn8D Btn8D and it'll compile fine.

Next you paste code, could you put inside code tags like this:
Code:
[code]your code goes here[/code]

That makes it a lot more readable :)

- Xander


Yes. Thanks for the help!


Fri Feb 17, 2012 1:35 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.