|
Page 1 of 1
|
[ 2 posts ] |
|
"Motor out of Range" Error
| Author |
Message |
|
mingdooley
Rookie
Joined: Wed Feb 22, 2012 4:23 am Posts: 10
|
 "Motor out of Range" Error
Hi, I recently took my tele-op program for controlling the drive train and combined it with the tele-op program used for controlling our arm. However, I keep getting the same error over and over again. The error is:
Byte Code Interpreter Exception: Program Slot: 0, Task ID: main[0] Error at PC: Task: main+0x005B Task PC: Task: main+0x0000 TaskState: 'Exception' Exception Type: 'Motor out of range(2)'
These two programs work separately but not when combined. Also, we have a Omni-wheel drive train. We have two custom libraries in the program that are attached to this message. Also, we are using ROBOTC version 3.54. Any help is appreciated. The code is below:
#pragma config(Hubs, S1, HTMotor, HTMotor, HTMotor, HTServo) #pragma config(Sensor, S1, , sensorI2CMuxController) #pragma config(Motor, mtr_S1_C1_1, motorD, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C1_2, motorE, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C2_1, motorF, tmotorTetrix, openLoop, reversed) #pragma config(Motor, mtr_S1_C2_2, motorG, tmotorTetrix, openLoop, reversed) #pragma config(Motor, mtr_S1_C3_1, motorH, tmotorTetrix, openLoop) #pragma config(Servo, srvo_S1_C4_1, servo1, tServoStandard) #pragma config(Servo, srvo_S1_C4_2, servo2, tServoStandard) #pragma config(Servo, srvo_S1_C4_3, servo3, tServoStandard) #pragma config(Servo, srvo_S1_C4_4, servo4, tServoNone) #pragma config(Servo, srvo_S1_C4_5, servo5, tServoNone) #pragma config(Servo, srvo_S1_C4_6, servo6, tServoNone) #include "ASCII_OmniDriverControlsTimeLibrary360.c" #include "ASCII_JoystickDriverExtension.c"
const int deadzone = 10; int jointServo1 = 181; int jointServo3 = 138; int claw = 138; const int mspeed = 40; int dir = 1; bool stuff = false;
void initializeRobot(){ servo[servo1] = 181; servo[servo2] = 138; servo[servo3] = 138; return; }
task main(){ initializeRobot(); while(true){ servo[servo1] = jointServo1; servo[servo2] = claw; servo[servo3] = jointServo3; getJoystickSettings(joystick); float degrees = JoystickDegrees(1, 1); //This finds the value for the degrees of the first joystick and assigns it to a float. float power = JoystickPower(1, 1); //This finds the value for how far the joystick is away from the center and assings it to a float. float power2 = JoystickPower(1, 2); //This does the same thing as line 15 but for the second joystick on controller one.
power = round(power / 1.27); //This and line 19 reduces the joystick values down to 100. power2 = round(power2 / 1.27);
if(joystick.joy1_y1 > deadzone || joystick.joy1_x1 > deadzone || joystick.joy1_y1 < -deadzone || joystick.joy1_x1 < -deadzone){ Move(degrees, power, 0); //This sets up the first joystick on controller 1. } if(joystick.joy1_x2 < -deadzone){ Turn(-1, power2, 0); //This sets up counterclockwise. } if(joystick.joy1_x2 > deadzone){ Turn(1, power2, 0); //This sets up clockwise. } if(joystick.joy1_x2 < deadzone && joystick.joy1_x2 > -deadzone){ Turn(1, 0, 0); //This stops rotation. } if(joystick.joy1_y1 < deadzone && joystick.joy1_y1 > -deadzone && joystick.joy1_x1 < deadzone && joystick.joy1_x1 > -deadzone){ Move(0, 0, 0); //This means that if the joystick is not held down, then the robot does not move. } if(joy2Btn(5) == 1){ claw--; wait1Msec(5); }
if(joy2Btn(6) == 1){ claw++; wait1Msec(5); }
if(joy2Btn(7) == 1){ jointServo1++; jointServo3++; wait1Msec(5); }
if(joy2Btn(8) == 1){ jointServo1--; jointServo3--; wait1Msec(5); }
if(joystick.joy2_y1 > deadzone){ dir = 1; motor[motorH] = dir * mspeed; stuff = true; }
if(joystick.joy2_y1 < -deadzone){ dir = -1; motor[motorH] = dir * mspeed; stuff = true; }
if(joystick.joy2_y1 > -deadzone && joystick.joy1_y1 < deadzone && stuff == true){ /*dir *= -1; motor[motorH] = dir * 20; wait1Msec(100); motor[motorH] = 0; stuff = false;*/ for(int m = mspeed; m == 0; m--){ motor[motorH] = dir * m; wait1Msec(8); } motor[motorH] = 0; } } }
|
| Fri Nov 30, 2012 10:17 pm |
|
 |
|
amcerbu
Novice
Joined: Sun Oct 21, 2012 10:01 pm Posts: 76
|
 Re: "Motor out of Range" Error
I believe the problem could be in your #pragmas. I'm not sure how RobotC handles the motor/servos pre-processor commands, but the second file you posted ("ASCII_OmniDriverControlsTimeLibrary360.c") has declarations for motors and servos. You define them in your code as well. Try removing these lines from the beginning of your program. Good luck!  |  |  |  | Code: #pragma config(Hubs, S1, HTMotor, HTMotor, HTMotor, HTServo) #pragma config(Sensor, S1, , sensorI2CMuxController) #pragma config(Motor, mtr_S1_C1_1, motorD, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C1_2, motorE, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C2_1, motorF, tmotorTetrix, openLoop, reversed) #pragma config(Motor, mtr_S1_C2_2, motorG, tmotorTetrix, openLoop, reversed) #pragma config(Motor, mtr_S1_C3_1, motorH, tmotorTetrix, openLoop) #pragma config(Servo, srvo_S1_C4_1, servo1, tServoStandard) #pragma config(Servo, srvo_S1_C4_2, servo2, tServoStandard) #pragma config(Servo, srvo_S1_C4_3, servo3, tServoStandard) #pragma config(Servo, srvo_S1_C4_4, servo4, tServoNone) #pragma config(Servo, srvo_S1_C4_5, servo5, tServoNone) #pragma config(Servo, srvo_S1_C4_6, servo6, tServoNone)
|  |  |  |  |
|
| Sat Dec 01, 2012 4:43 pm |
|
|
|
Page 1 of 1
|
[ 2 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 4 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
|
|