View unanswered posts | View active topics It is currently Thu Oct 30, 2014 1:01 pm






Reply to topic  [ 11 posts ] 
Servos!! Why wont they work!! 
Author Message
Novice

Joined: Tue Jan 13, 2009 5:22 pm
Posts: 72
Location: USA, Pennsylvania
Post 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
Profile WWW
Novice

Joined: Mon Oct 13, 2008 6:29 pm
Posts: 75
Location: Florida, USA
Post 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
Profile
Novice

Joined: Tue Jan 13, 2009 5:22 pm
Posts: 72
Location: USA, Pennsylvania
Post 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
Profile WWW
Novice

Joined: Fri Oct 24, 2008 8:58 am
Posts: 87
Post 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:
Code:
servo[ServoA] = 255;
servo[ServoB] = 0;


or like this in manual:
Code:
servo[ServoA] = joystick.joy1_y1 + 128;
servo[ServoB] = joystick.joy1_y2 + 128;


Fri Feb 06, 2009 5:44 pm
Profile
Novice

Joined: Tue Jan 13, 2009 5:22 pm
Posts: 72
Location: USA, Pennsylvania
Post 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
Profile WWW
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 613
Post 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
Profile
Novice

Joined: Tue Jan 13, 2009 5:22 pm
Posts: 72
Location: USA, Pennsylvania
Post 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
Profile WWW
Rookie
User avatar

Joined: Thu Feb 12, 2009 10:34 am
Posts: 3
Location: Fishersville, Virginia
Post Re: Servos!! Why wont they work!!
Team G-unit was able to get Servos working with the joystick and button commands with rate control. :bigthumb:
There are three key software prerequisites:
- :arrow: using Robot C 1.46
- :arrow: loading the 1.46 firmware onto the NXT
- :arrow: 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
Profile WWW
Novice

Joined: Tue Jan 13, 2009 5:22 pm
Posts: 72
Location: USA, Pennsylvania
Post 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
Profile WWW
Rookie
User avatar

Joined: Thu Feb 12, 2009 10:34 am
Posts: 3
Location: Fishersville, Virginia
Post 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
Profile WWW
Novice

Joined: Tue Jan 13, 2009 5:22 pm
Posts: 72
Location: USA, Pennsylvania
Post Re: Servos!! Why wont they work!!
READ :poke:
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
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ] 

Who is online

Users browsing this forum: Sillyprogrammer and 1 guest


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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.