pkossmann
Rookie
Joined: Mon Jun 11, 2012 11:32 am Posts: 2
|
 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?
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 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.
|
JohnWatson
Site Admin
Joined: Thu May 24, 2012 12:15 pm Posts: 722
|
 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 updated help documentation and the ROBOTC Forums.
|
pkossmann
Rookie
Joined: Mon Jun 11, 2012 11:32 am Posts: 2
|
 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.
|
JohnWatson
Site Admin
Joined: Thu May 24, 2012 12:15 pm Posts: 722
|
 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 updated help documentation and the ROBOTC Forums.
|