|
Billie276
Rookie
Joined: Fri Dec 05, 2008 2:05 pm Posts: 1
|
 Motor out of Range Errors
I have written code using RobotC for the FirstTech robot. When we compile the program we get no errors. We are set up to use two NXT motors through Motor A and Motor B ports on the NXT. We are driving four additional 12V motors through the Senor ports via motor controllers two through S1, two through S2, and are trying to run two servos through S4. We are getting power and some reaction from the servo and NXT motors from the program, but no reaction from the 12V motors at all. During the debug process we keep getting "Motor out of Range" and "Servo out of Range" errors. This happens before any input is recieved from the joystick. I need any help or input I can get. Thanks.
|
|
mrfixerupper
Rookie
Joined: Wed Dec 10, 2008 11:16 pm Posts: 1
|
 Re: Motor out of Range Errors
hi, we keep getting the error message
exception type: 'servo out of range(34) ------------------------------------------------------------------------------------------ #pragma config(Hubs, S1, HTMotor, HTServo, HTMotor, none) #pragma config(Sensor, S4, Compass, sensorI2CHiTechnicCompass) #pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, PIDControl) #pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, PIDControl) #pragma config(Motor, mtr_S1_C3_1, motorF, tmotorNone, openLoop) #pragma config(Motor, mtr_S1_C3_2, motorG, tmotorNone, openLoop) #pragma config(Servo, servo1, Servo1, tServoNormal) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c"
float jx; //joystick input for direction control float jy; //joystick input for speed control float sf; //speed factor float sl; //speed limit float lws; //left wheel speed float rws; //right wheel speed int lwsi; //left wheel speed int rwsi; //right wheel speed
task main() {
sl = 20; // set speed limit getJoystickSettings(joystick); //Update initial joystick/game values
while(joystick.StopPgm) //While the FMS says we're "disabled", keep looping { getJoystickSettings(joystick); //Update joystick/game values to see if enabled wait1Msec(50); //wait 50 milliseconds }
motor[motorD] = 100; motor[motorE] = 100;
wait1Msec(1500);
motor[motorD] = 0; motor[motorE] = 0;
while (true) { getJoystickSettings(joystick); //////------------ Drive Motor Speed Control--------------- // Control Speed of motor jx = joystick.joy1_x1; jy = joystick.joy1_y1; sf = jy/127; if (jy > 0) // go forward { if (jx > 0) // turn right { lws = sl * sf; rws = lws - (sl * (jx/127)); } else // turn left { rws = sl * sf; lws = rws - (sl * ((jx * -1)/127)); } } else // go backward { if (jx > 0) // turn right { lws = sl * sf; rws = lws + (sl * (jx/127)); } else // turn left { rws = sl * sf; lws = rws + (sl * ((jx * -1)/127)); } } lwsi = lws; rwsi = rws; motor[motorD] = lwsi; motor[motorE] = rwsi;
/// -- old -- // motor[motorD] = joystick.joy1_y1; // motor[motorE] = joystick.joy1_y1;
//////------------ Drive Motor Speed Control-------END--------
motor[motorA] = joystick.joy2_x2; motor[motorB] = joystick.joy2_x2; servoTarget[servo1] = joystick.joy2_x2 + 127; //servoTarget[servo3] = joystick.joy2_y1 + 127; }}
|
|
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Re: Motor out of Range Errors
What version of RobotC do you have installed? If you have upgraded from one version to another, did you completely uninstall the old version before installing the new version? What is the version number of the firmware on your NXT?
_________________ Jeff McBride Benson Robotics Club
|
|
hobbseltoff
Rookie
Joined: Thu Jan 08, 2009 7:51 pm Posts: 25
|
 Re: Motor out of Range Errors
In the Motor/Servo configuration page, you need to to open up the "FTC Servo/Motor Ctl" tab, click on the "Custom" radio button and adjust your setup accordingly. Each of the rows (S1, S2, etc..) represents a different sensor port on the NXT. I've included a screenshot that will show you how to configure it the way you want although I would recommend daisy-chaining the controllers together. Hope this helps. 
_________________ It must be user error.
|