View unanswered posts | View active topics It is currently Mon Dec 22, 2014 11:13 am






Reply to topic  [ 4 posts ] 
Servo Help 
Author Message
Rookie

Joined: Tue Nov 24, 2009 6:59 pm
Posts: 2
Post Servo Help
My programming team and I seem to be having issues with getting the Servo to be recognized. The program below (according to the computer) has no errors, and we have all the equipment set up as the diagrams show. If you would help with altering the code and or providing ways that you got yours to work so that we may work off of previous success that would be great. Thanks.


#pragma config(Hubs, S1, HTMotor, HTServo, none, none)
#pragma config(Sensor, S2, Touchy, sensorTouch)
#pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, openLoop)
#pragma config(Servo, srvo_S1_C2_1, ServoA, tServoNormal)
#pragma config(SrvoPosition, Position01, 128, 128, 128, 128, 128, 128, 128, 128)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main()
{
servoChangeRate[ServoA] = 10;
wait1Msec(7000);
servo[ServoA] = 255;
wait1Msec(2000);
servo[ServoA] = 127;
wait1Msec(2000);
servo[ServoA] = 0;
wait1Msec(2000);
}

_________________
Damn the torpedos! Full speed ahead!


Tue Nov 24, 2009 7:09 pm
Profile
Expert

Joined: Mon Oct 27, 2008 9:59 pm
Posts: 139
Post Re: Servo Help
Not sure how you got this pragma statement... but I'm fairly sure you don't need it. I'd try removing it and test again.
Mythic wrote:
#pragma config(SrvoPosition, Position01, 128, 128, 128, 128, 128, 128, 128, 128)

Other than that I do not see any real issues with your test code. Have you tried just running a simple forever loop and then using the servo debug window? You may have a hardware issue rather than a code issue. Make sure you have power getting to the servo controller (use a voltmeter) and double check that you plugged the servos into the servo controller with the yellow wire towards the comm ports.


Wed Nov 25, 2009 11:02 pm
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 615
Post Re: Servo Help
l0jec wrote:
Not sure how you got this pragma statement... but I'm fairly sure you don't need it. I'd try removing it and test again.
Mythic wrote:
#pragma config(SrvoPosition, Position01, 128, 128, 128, 128, 128, 128, 128, 128)

Other than that I do not see any real issues with your test code. Have you tried just running a simple forever loop and then using the servo debug window? You may have a hardware issue rather than a code issue. Make sure you have power getting to the servo controller (use a voltmeter) and double check that you plugged the servos into the servo controller with the yellow wire towards the comm ports.

Yes. You can safely remove this #pragma although it is benign and should have no impact on your program. It is generated by routines designed to support biped walking robots. There is a test mode where you can take a "snapshot" and have the current servo settings captured in one of these #pragmas. And then subsequently use the #pragma results to define servo positions to move to. Since you're not using biped walking robots you can delete or ignore this pragma.


Tue Dec 01, 2009 3:11 am
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 615
Post Re: Servo Help
To test your program and servo control look at the debugger window "Servo Control" and the Window "FTC Controllers". You may need to be in "Expert" mode (Menu command "Windows -> User Level -> Expert") to access these.

The "FTC Controllers" window has fields that will tell you if the servo controller is working correctly. HINT: If the count of "resets" is wildly incrementing then the hardware is misconfigured.

THe "Servo Control" window will tell you the current settings of the servos. And with the "More" button you can expand the window so that you can manually set the various positions of each servo.


Tue Dec 01, 2009 3:21 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 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

Search for:
Jump to:  



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