View unanswered posts | View active topics It is currently Fri Oct 24, 2014 2:56 pm






Reply to topic  [ 5 posts ] 
Byte Code Interpretor Exception Error 
Author Message
Rookie

Joined: Mon Jun 11, 2012 11:32 am
Posts: 2
Post Byte Code Interpretor Exception Error
I've been using the Tetrix robots for the last several months in a highschool class. We've started getting the follow error from one robot:

Byte Code Interpretor Exception
Progrm Slot: 0, Task ID: main[0]
Error at PC: Task: main+0x0042
Task PC: Task offset start (0),
TaskState: 'Exception'
Exception Type: 'Servo out of range(34)'

We tried running code from past successful robots and we get this error too. We've tried restarting the system and redownloading firmware.

What should I try next?


Mon Jun 11, 2012 11:55 am
Profile
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post Re: Byte Code Interpretor Exception Error
It's kinda hard to tell you what's wrong without seeing your code. Oh, also, wild guess: Is it possible that your trying to assign a value to a servo that it doesn't support?

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.


Mon Jun 11, 2012 12:00 pm
Profile WWW
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 596
Post Re: Byte Code Interpretor Exception Error
I'd say post the code here so we can take a look at it (using the [code] tags) and see what's going on. You'll usually see this error when a servo is either pushed outside of its limits or if the code is referencing a servo that doesn't exist in the code (ServoA instead of Servo1, for example).

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Mon Jun 11, 2012 12:34 pm
Profile
Rookie

Joined: Mon Jun 11, 2012 11:32 am
Posts: 2
Post Re: Byte Code Interpretor Exception Error
#pragma config(Hubs, S1, HTMotor, HTServo, none, none)
#pragma config(Sensor, S2, light, sensorLightActive)
#pragma config(Sensor, S4, ultra, sensorSONAR)
#pragma config(Motor, motorA, A, tmotorNormal, PIDControl, encoder)
#pragma config(Motor, mtr_S1_C1_1, D, tmotorNormal, PIDControl, encoder)
#pragma config(Motor, mtr_S1_C1_2, E, tmotorNormal, PIDControl, reversed, encoder)
#pragma config(Servo, srvo_S1_C2_1, S1, tServoStandard)
#pragma config(Servo, srvo_S1_C2_2, S2, tServoStandard)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main
{
int mSpeed = 10;
int aPosition;
int gPosition;
while (SensorValue(ultra) > 10)
{
motor[D]=-mSpeed;
motor[E]=mSpeed;
}
motor[D]=-mSpeed;
motor[E]=mSpeed;
wait1Msec(235);
nMotorEncoder[A] = 0;
while (nMotorEncoder[A] < 90)
{
motor[A] = 30;
}
motor[A] = 0;

servo[S1]=255;
servo[S2]=0;
wait1Msec(1000);
for(aPosition = 255; aPosition > 60; aPosition--)
{
servo[S1]=aPosition;
}
for(gPosition = 0; gPosition < 60; gPosition++)
{
servo[S2]=gPosition;
}
wait1Msec(1000);
motor[D]=-mSpeed;
motor[E]=-mSpeed;
wait1Msec(500);
motor[D]=0;
motor[E]=0;
wait1Msec(1000);
while (SensorValue[light] > 50)
{
motor[D]=mSpeed;
motor[E]=mSpeed;
}
motor[D]=0;
motor[E]=0;
wait1Msec(1000);
motor[D]=-mSpeed;
motor[E]=-mSpeed;
wait1Msec(1000);
}


I've bolded the line that the error is happening at. We've tried writing various different forms of this code and the error seems to be listed after the first servo command.


Tue Jun 12, 2012 11:06 am
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 596
Post Re: Byte Code Interpretor Exception Error
I was able to replicate this for you, and I think I know what the problem is. You've named your servos S1 and S2 and that's confusing the program. It thinks you're trying to call your I2C controller and your light sensor (which is why it's giving you a mismatch error). To fix this, I went into Motor and Sensors Setup and changed the name of S1 and S2 to Servo1 and Servo2, then changed the instances of S1 and S2 in the code likewise. It compiled without error after that, so give it a shot and let us know if that fixed it or not.

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Tue Jun 12, 2012 11:35 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 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.