Go to Post Facebook for FIRST already exists. It's called Facebook :) - dcarr [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 17-02-2013, 17:57
zackd97 zackd97 is offline
Registered User
FRC #4102
 
Join Date: Feb 2013
Rookie Year: 2013
Location: New Mexico
Posts: 16
zackd97 is an unknown quantity at this point
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 : 17-02-2013 at 19:37. Reason: Typo
Reply With Quote
  #2   Spotlight this post!  
Unread 17-02-2013, 22:26
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Servo Help

Is the servo power jumper installed on the PWM channel you're wired to?
Reply With Quote
  #3   Spotlight this post!  
Unread 18-02-2013, 13:11
zackd97 zackd97 is offline
Registered User
FRC #4102
 
Join Date: Feb 2013
Rookie Year: 2013
Location: New Mexico
Posts: 16
zackd97 is an unknown quantity at this point
Re: Servo Help

Quote:
Originally Posted by Alan Anderson View Post
Is the servo power jumper installed on the PWM channel you're wired to?
Indeed it is.
Reply With Quote
  #4   Spotlight this post!  
Unread 18-02-2013, 13:24
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,622
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
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.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
Reply With Quote
  #5   Spotlight this post!  
Unread 18-02-2013, 14:42
zackd97 zackd97 is offline
Registered User
FRC #4102
 
Join Date: Feb 2013
Rookie Year: 2013
Location: New Mexico
Posts: 16
zackd97 is an unknown quantity at this point
Re: Servo Help

Quote:
Originally Posted by Kevin Sevcik View Post
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.
The servo is definitely working. I'm 99% positive the problem is my programming.

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 : 18-02-2013 at 15:14. Reason: Additional Info
Reply With Quote
  #6   Spotlight this post!  
Unread 18-02-2013, 16:47
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Servo Help

Quote:
Originally Posted by zackd97 View Post
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.
A properly operating servo will "lock into a position and attempt to maintain that position." It sounds like your servo had been connected backwards before.

Quote:
It still does not react to my button pushes though.
You should probably show us the code that reads and reacts to button pushes.
Reply With Quote
  #7   Spotlight this post!  
Unread 18-02-2013, 17:19
zackd97 zackd97 is offline
Registered User
FRC #4102
 
Join Date: Feb 2013
Rookie Year: 2013
Location: New Mexico
Posts: 16
zackd97 is an unknown quantity at this point
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.
Reply With Quote
  #8   Spotlight this post!  
Unread 18-02-2013, 22:00
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Servo Help

Where are you reading the button? I don't see where in the code the GateTwo command is invoked.
Reply With Quote
  #9   Spotlight this post!  
Unread 18-02-2013, 22:23
zackd97 zackd97 is offline
Registered User
FRC #4102
 
Join Date: Feb 2013
Rookie Year: 2013
Location: New Mexico
Posts: 16
zackd97 is an unknown quantity at this point
Re: Servo Help

Quote:
Originally Posted by Alan Anderson View Post
Where are you reading the button? I don't see where in the code the GateTwo command is invoked.
The association between the button and the command is in the OI.cpp in lines 37 and 38.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:39.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi