|
Page 1 of 1
|
[ 7 posts ] |
|
servo motor not responding
| Author |
Message |
|
Athenian
Rookie
Joined: Thu Dec 11, 2008 8:33 pm Posts: 3
|
 servo motor not responding
we are having trouble with getting the servo motors to move. it is getting power and centers out to zero but when we hit the buttons on the controller it does not resond. if anyone has any comments please help.
#pragma config(Hubs, S1, HTMotor, HTServo, HTMotor, none) #pragma config(Motor, motorC, wheellegomotor, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C1_1, rightdrivemotor, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C1_2, leftdrivemotor, tmotorNormal, openLoop, reversed) #pragma config(Motor, mtr_S1_C3_1, rightarmmotor, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C3_2, leftarmmotor, tmotorNormal, openLoop, reversed) #pragma config(Servo, servo2, leftbucketservo, tServoNormal) #pragma config(Servo, servo3, rightbucketservo, tServoNormal) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c" //Include file to "handle" the BT messages.
task main() { while (true) //Loop forever { getJoystickSettings(joystick); //Update variables with current joystick values motor[rightdrivemotor] = joystick.joy1_y1; //dirve motor[leftdrivemotor] = joystick.joy1_y2;
getJoystickSettings(joystick); //Update variables with current joystick values motor[rightarmmotor] = joystick.joy2_y1; //lift and lower arms with first joystick on second controller motor[leftarmmotor] = joystick.joy2_y1;
getJoystickSettings(joystick); if(joy2Btn(3)) //If Joystick Button #3 is pressed { servoTarget[leftbucketservo] = -50; //dump bucket servoTarget[rightbucketservo] = -50; } else //If Joystick Button #3 is not pressed { servoTarget[leftbucketservo] = 0; //collecting position servoTarget[rightbucketservo] = 0; }
getJoystickSettings(joystick); if(joy2Btn(1) != 0) //If Joystick Button #1 is pressed { motor[motorC] = 100; //wheels are collecting } else { motor[motorC] = 0; }
|
| Tue Jan 20, 2009 6:19 pm |
|
 |
|
Sunny1261
Novice
Joined: Thu Oct 09, 2008 7:58 pm Posts: 79
|
 Re: servo motor not responding
Servo values can only be between 0 and 225.
So servoTarget[Servo1] = -50; won't work.
|
| Tue Jan 20, 2009 10:09 pm |
|
 |
|
Athenian
Rookie
Joined: Thu Dec 11, 2008 8:33 pm Posts: 3
|
 Re: servo motor not responding
changed it to 50, 100, 200, and nothing happened.
|
| Wed Jan 21, 2009 12:01 am |
|
 |
|
hobbseltoff
Rookie
Joined: Thu Jan 08, 2009 7:51 pm Posts: 25
|
 Re: servo motor not responding
Try using servo[Servo1] = 100 instead of servoTarget[Servo1] = 100.
_________________ It must be user error.
|
| Wed Jan 21, 2009 9:51 am |
|
 |
|
Sunny1261
Novice
Joined: Thu Oct 09, 2008 7:58 pm Posts: 79
|
 Re: servo motor not responding
Hm... not sure, but tell me. How are your servos mounted? Are they mounted facing towards each other or are they facing in the same direction?
Because if they are mounted facing towards each other, like []- -[]. Then you need to understand that the values have been flipped. 255 is up for one motor and down for the other. So they will center to 127, but after that, they won't move because they are resisting each other. So where one is 255, you'll have to make the other one 0 to make sure it's the same.
If not, then respond back and let us know.
|
| Wed Jan 21, 2009 8:36 pm |
|
 |
|
david fort
Rookie
Joined: Sun Nov 16, 2008 3:07 pm Posts: 45
|
 Re: servo motor not responding
yeah, I'm going to agree with the others: 1. servo[left] is the thing to use, not servoTarget[left]. 2. make sure you don't have the 2 servos working against each other. and I'll add #3 at the risk of pointing out the obvious: 3. you are looking at game console #2, not the one with the motor control joysticks. Make sure you have "dual joysticks" checked on the Joystick Control.
and fwiw, unrelated to your question, you don't need to getJoystickSettings(joystick); more than once per time through your while loop as you posted it. That isn't going to hurt anything, but isn't necessary.
|
| Wed Jan 21, 2009 11:01 pm |
|
 |
|
Athenian
Rookie
Joined: Thu Dec 11, 2008 8:33 pm Posts: 3
|
 Re: servo motor not responding
thanks guys, the kids got it working with your suggestions.
|
| Thu Jan 22, 2009 3:46 pm |
|
|
|
Page 1 of 1
|
[ 7 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
|
|