|
Page 1 of 1
|
[ 11 posts ] |
|
Servos!! Why wont they work!!
| Author |
Message |
|
Emilhem
Novice
Joined: Tue Jan 13, 2009 5:22 pm Posts: 72 Location: USA, Pennsylvania
|
 Servos!! Why wont they work!!
I've tried to program servos for a while now without any success, how do you program a servo and make it work with a joystick and autonomous? I've checked the battery and all the wires three times but it seems that its not the problem. The "extra" battery symbol is shown on the LCD with full power and we have checked power with other instruments. I tried to use the servo debugger but it doesn't changing any numbers. The program I used was a sample program that is under this text  |  |  |  | Quote: #pragma config(Hubs, S1, HTMotor, HTServo, none, none) #pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, PIDControl) #pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, PIDControl) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c"
task main() { while (true) { getJoystickSettings(joystick); //Update Buttons and Joysticks
if(joy1Btn(1) != 0) //If Joy1-Button1 is pressed { servoTarget[servo1] = 240; // Move Servo1 to position '240' } else //If Joy1-Button1 is NOT pressed { servoTarget[servo1] = 50; // Move Servo1 to position '50' } } }
|  |  |  |  |
_________________ We need a Linux Version!
|
| Fri Feb 06, 2009 3:54 pm |
|
 |
|
10nisman94
Novice
Joined: Mon Oct 13, 2008 6:29 pm Posts: 75 Location: Florida, USA
|
 Re: Servos!! Why wont they work!!
you have no servos identified in motors and sensors setup, you should get a compiler error too.
EDIT: try getting rid of !=0 it works better that way
_________________ PHUHS Robotics Team 516 FTW
Daytona Robofest Winning Alliance Captain Daytona Robofest Inspire Award
Last edited by 10nisman94 on Fri Feb 06, 2009 5:12 pm, edited 1 time in total.
|
| Fri Feb 06, 2009 5:09 pm |
|
 |
|
Emilhem
Novice
Joined: Tue Jan 13, 2009 5:22 pm Posts: 72 Location: USA, Pennsylvania
|
 Re: Servos!! Why wont they work!!
That's not the problem I just copied the sample program.
_________________ We need a Linux Version!
|
| Fri Feb 06, 2009 5:10 pm |
|
 |
|
chadgeorge
Novice
Joined: Fri Oct 24, 2008 8:58 am Posts: 87
|
 Re: Servos!! Why wont they work!!
If you're using exactly the code you posted, then I think 10nisman94 is correct in saying you still need to fillout the servo configuration page. It should look something like this (assuming the servo controller is the only thing plugged into the NXT portA).  |  |  |  | Code: #pragma config(Hubs, S1, HTServo, none, none, none) #pragma config(Servo, srvo_S1_C1_1, ServoA, tServoNormal) #pragma config(Servo, srvo_S1_C1_2, ServoB, tServoNormal)
|  |  |  |  |
then you control the servos like this in autonomous: or like this in manual:
|
| Fri Feb 06, 2009 5:44 pm |
|
 |
|
Emilhem
Novice
Joined: Tue Jan 13, 2009 5:22 pm Posts: 72 Location: USA, Pennsylvania
|
 Re: Servos!! Why wont they work!!
Thanks for the help. Are going to try this on Tuesday. (I don't own the parts so at the next robotics meeting.)
_________________ We need a Linux Version!
|
| Fri Feb 06, 2009 6:00 pm |
|
 |
|
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 537
|
 Re: Servos!! Why wont they work!!
Servos are non-functional in 1.40... upgrade to 1.46 to get servo support. -> www.ftctraining.com
_________________Timothy Friez ROBOTC Developer - SW Engineer tfriez@robotc.net
|
| Wed Feb 11, 2009 1:58 pm |
|
 |
|
Emilhem
Novice
Joined: Tue Jan 13, 2009 5:22 pm Posts: 72 Location: USA, Pennsylvania
|
 Re: Servos!! Why wont they work!!
It worked but they was to weak so we have to buy another motor controller. I used 1.46 all the time. Someone know where to buy less expensive motor controllers? The only price I have seen so far is 79.90.
_________________ We need a Linux Version!
|
| Wed Feb 11, 2009 7:08 pm |
|
 |
|
G-Unit
Rookie
Joined: Thu Feb 12, 2009 10:34 am Posts: 3 Location: Fishersville, Virginia
|
 Re: Servos!! Why wont they work!!
Team G-unit was able to get Servos working with the joystick and button commands with rate control. There are three key software prerequisites: -  using Robot C 1.46 -  loading the 1.46 firmware onto the NXT -  ensuring that motors and servos are coded with channel designations : example: srvo_S1_C1_1, - ample potential, voltage, across the circuit, >12V
|
| Thu Feb 12, 2009 4:59 pm |
|
 |
|
Emilhem
Novice
Joined: Tue Jan 13, 2009 5:22 pm Posts: 72 Location: USA, Pennsylvania
|
 Re: Servos!! Why wont they work!!
This is probably finished already if no one have any questions. Read all the text...I have already had the issue between firmware but I fixed it my self before I even joined RobotC's forum.
_________________ We need a Linux Version!
|
| Thu Feb 12, 2009 5:04 pm |
|
 |
|
G-Unit
Rookie
Joined: Thu Feb 12, 2009 10:34 am Posts: 3 Location: Fishersville, Virginia
|
 Re: Servos!! Why wont they work!!
I don't know why yours still aren't working. I would recheck your wiring first. I've read some posts on here saying that the Servo Controllers are the problem but ours seems to be working fine. Don't really know what else to tell you. I'll let you see our code if you want.  |  |  |  | Code: #pragma config(Hubs, S1, HTMotor, HTServo, none, none) #pragma config(Motor, mtr_S1_C1_1, , tmotorNone, openLoop) #pragma config(Motor, mtr_S1_C1_2, , tmotorNone, openLoop) #pragma config(Servo, servo1, servoL, tServoNormal) #pragma config(Servo, servo2, servoR, tServoNormal) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c"
task main() { servo[servo1] = 100; servo[servo2] = 155;
wait1Msec(5000);
while(true) { getJoystickSettings(joystick);
servo[servo1] = joystick.joy1_y1 + 127; servo[servo2] = (255 - (joystick.joy1_y1 + 127)); } }
|  |  |  |  |
This is just a program that works our servo attached to our arm. Since the two servos are reversed you have to get oposite readings. It starts by moving our servo to a start position. If you have anyquestions please just ask.
_________________ SVGS Gerbil Unit
|
| Fri Feb 13, 2009 9:42 am |
|
 |
|
Emilhem
Novice
Joined: Tue Jan 13, 2009 5:22 pm Posts: 72 Location: USA, Pennsylvania
|
 Re: Servos!! Why wont they work!!
READ I have already fixed all the issues with help from many helpfully people in this forum. Thanks anyway.  (Wanted to see the differences between the two smiles that had the same code.)
_________________ We need a Linux Version!
|
| Fri Feb 13, 2009 3:55 pm |
|
|
|
Page 1 of 1
|
[ 11 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
|
|