|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Servo Help
I'm trying to write code that will cause a servo to move to one position for a certain amount of time and then move back to where it was. This is in a command based system. So far what I've tried are different functions for open, close, and done that are along the lines of this-
void GateServo::Open(){ gateTwo->Set(0); } and void GateServo::Close(){ gateTwo->Set(.5); and void GateServo::done(){ gateTwo->SetOffline(); } In this case gateTwo is the servo itself. I'm calling these functions in two different commands that are then put in a command group that calls the commands sequentially. The problem is that it doesn't do anything. Am I doing anything wrong and/or is there a better way of doing it? Any help is appreciated. Last edited by zackd97 : 02-17-2013 at 07:37 PM. Reason: Typo |
|
#2
|
|||||
|
|||||
|
Re: Servo Help
Is the servo power jumper installed on the PWM channel you're wired to?
|
|
#3
|
|||
|
|||
|
Re: Servo Help
Indeed it is.
|
|
#4
|
|||||
|
|||||
|
Re: Servo Help
Make sure your servo is working period first. Make yourself a MoveStick method, and ServoWithStick command to drive the servo with a Joystick. Then set that as the default command for the subsystem and check to make sure you can even move it to begin with. If it's not moving with that basic of code, you know your problem is electrical or really basic programming level.
|
|
#5
|
|||
|
|||
|
Re: Servo Help
Quote:
When the servo is plugged in and the robot is enabled, there's no reaction. If I switch the way the servo is plugged into the PWM it will lock into a position and attempt to maintain that position. It still does not react to my button pushes though. Last edited by zackd97 : 02-18-2013 at 03:14 PM. Reason: Additional Info |
|
#6
|
|||||
|
|||||
|
Re: Servo Help
Quote:
Quote:
|
|
#7
|
|||
|
|||
|
Re: Servo Help
Here's the code. It is command based and a bit too inconvenient to put in a post so I uploaded it to github.
https://github.com/zackd97/RobotProject5 The problem areas are in the subsystem GateServoTwo and the commands CloseGateTwo, OpenGateTwo, and the command group GateTwo. |
|
#8
|
|||||
|
|||||
|
Re: Servo Help
Where are you reading the button? I don't see where in the code the GateTwo command is invoked.
|
|
#9
|
|||
|
|||
|
Re: Servo Help
The association between the button and the command is in the OI.cpp in lines 37 and 38.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|