ROBOTC.net forums
http://robotc.net/forums/

ROBOTC Exception Voilation Report
http://robotc.net/forums/viewtopic.php?f=1&t=7533
Page 1 of 1

Author:  Lupin [ Sat Dec 28, 2013 11:46 am ]
Post subject:  ROBOTC Exception Voilation Report

I'm experiencing issues with my program. I'm getting an error when I "Start" on the Program Debug Window.

It reads:

ROBOTC Exception Violation Report
Byte Code Interpreter Exception:
Program Slot: 0. Task ID: main[0]
Error at PC: Task: main+0x0062
Task PC: Task:main+0x0000.
TaskState: 'Exception'
Exception Type: 'Motot out of range(2)'


This is on the computer. On the NXT it reads:

PgmCnt:000062
Type: 2


My task main() line is highlighted in yellow as well.

Here is the program:

Code:
#pragma config(Hubs,  S4, HTServo,  HTMotor,  HTMotor,  HTMotor)
#pragma config(Sensor, S4,     ,               sensorI2CMuxController)
#pragma config(Motor,  mtr_S4_C2_1,     motorD,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C2_2,     motorE,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C3_1,     motorF,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C3_2,     motorG,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C4_1,     motorH,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C4_2,     motorI,        tmotorTetrix, openLoop)
#pragma config(Servo,  srvo_S4_C1_1,    servo1,               tServoNone)
#pragma config(Servo,  srvo_S4_C1_2,    servo2,               tServoNone)
#pragma config(Servo,  srvo_S4_C1_3,    servo3,               tServoNone)
#pragma config(Servo,  srvo_S4_C1_4,    servo4,               tServoNone)
#pragma config(Servo,  srvo_S4_C1_5,    servo5,               tServoNone)
#pragma config(Servo,  srvo_S4_C1_6,    servo6,               tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c"

task main()
{
   int threshold = 15;
   while(true)
   {
   getJoystickSettings(joystick);

                                              //Joy1 Drive Train/Flag Rasier
    if (abs(joystick.joy1_y1) > threshold)
    {
       motor[motorH] = joystick.joy1_y1/2;
    }
    else
    {
       motor[motorH] = 0;
    }

    if (abs(joystick.joy1_y2) > threshold)
    {
       motor[motorI] = joystick.joy1_y2/2;
    }
    else
    {
       motor[motorI] = 0;
    }
                                      //Flag Raiser controls
                                     // Part 1 of flag rasier is full speed for fastest raising
    if (joy1Btn(5) == 1)
      {
         motor[motorD] = 100;
      }
    else
      {
         motor[motorD] = 0;
      }

                                     //Part 2 for adjusting flag rasier to match handle
    if (joy1Btn(6) == 1)
      {
         motor[motorD] = 15;
      }
    else
      {
         motor[motorD] = 0;
      }

                                              //Joy2  Arm movements Joints/cubeGrabber
                                                  // Joint 1
      if (abs(joystick.joy2_y1) > threshold)
      {
        motor[motorF] = joystick.joy2_y1/2;
      }
    else
      {
         motor[motorF] = 0;
      }
                                                 // Joint 2
    if (abs(joystick.joy2_y2) > threshold)
      {
         motor[motorG] = joystick.joy2_y2/2;
      }
    else
      {
         motor[motorG] = 0;
      }
                                                 // Joint 3

  /*  if (joy2Btn(5) == 1)
    {
       servo[servo1] = 225;
    }
    else
    {
       servo[servo1] = 0;
    }*/
                                                // cubeGrabber
    if (joy2Btn(6) == 1)
    {
       motor[motorE] = 50;
    }
    else
    {
       motor[motorE] = 0;
    }
  }

}


I'm not sure what this means and would be happy if someone could explain.
Help is always appreciated!

Author:  JohnWatson [ Thu Jan 09, 2014 1:39 pm ]
Post subject:  Re: ROBOTC Exception Voilation Report

Try running the HiTechnic controllers on another sensor port (and reconfigure your Motors and Sensors Setup page appropriately) in another copy of the program; this may be caused by a potential issue with 4 motor/servo controllers being used on port 4.

Also, which version of ROBOTC is being used? You can find this information under the 'Help -> About ROBOTC' menu option in ROBOTC. If it is a version older than 3.62, you may want to update to the latest version (3.62), which can be done by the 'Help -> Check for Updates' menu option.

Author:  Lupin [ Fri Jan 10, 2014 3:03 pm ]
Post subject:  Re: ROBOTC Exception Voilation Report

Hey,

Thanks for your suggestion. That could have been the problem. We're not sure what the problem was but we ended up writing a new program and going through all the wiring and ended up with a working program. But we didn't find what was messing it up.

Thanks for the suggestion though!

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/