Go to Post What isn't fun about watching a robot hang tubes? I love watching my team do it! - Michael Corsetto [more]
Home
Go Back   Chief Delphi > Technical > Motors
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 30-01-2012, 14:29
smigs smigs is offline
Registered User
FRC #3373
 
Join Date: Jan 2012
Location: Warrenton, VA
Posts: 3
smigs is an unknown quantity at this point
Problems running servos

Hi everyone,

I am a coach on Team 3373 out of Warrenton, VA. Recently, our programming team was writing some code for a generic servo (I didn't think it was necessary to label the part number) in order to make sure we know how to write the code.

Displaying only the relevant portions, we defined a joystick (in Module 1) and a servo instance. Then we initialized the servo instance. We physically connected it to Module 2, Port/Channel 9. Afterwards, we noted because the joystick GetRawAxis function assumes values from [-1,1] and the Servo Set function assumes values from [0,1] we did a little algebra on the Servo Set argument.

Lastly, I printed to the driver station the value of the Servo Set argument and I saw it change as I moved the Xbox joystick. HOWEVER, the servo itself does not move.

We do have other code written (not displayed) which moves a motor and gets camera feed etc. which all work fine. But for whatever reason we cannot get the Servo to work. There are a limited number of functions for the Servo class so between trying different things and looking on Google, we just need a fresh pair of eyes. Can anyone make any suggestions? The code compiles when we run it. We obtained the skeleton of it from the Simple Robot Template in Windriver.

Many thanks,
Brian

#####BEGIN CODE #####

#include “WPILib.h”
class RobotDemo : public SimpleRobot {

Joystick Xbox;
Servo Elevation;

public: RobotDemo()
Xbox(1),
Elevation(2,9)

{
/* GetWatchdog().SetEnabled(false); */
}

void Autonomous() {
/* commented out code */
}


void OperatorControl() {
while (IsOperatorControl())
{
Elevation.Set((Xbox.GetRawAxis(5)+1)/2);
}
}

};

START_ROBOT_CLASS(RobotDemo);

#####END CODE #####
  #2   Spotlight this post!  
Unread 30-01-2012, 14:35
Cecil's Avatar
Cecil Cecil is online now
Registered User
AKA: Alex Hummel
FRC #2010 (Lightning Bots)
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2006
Location: Champion
Posts: 343
Cecil is a splendid one to beholdCecil is a splendid one to beholdCecil is a splendid one to beholdCecil is a splendid one to beholdCecil is a splendid one to beholdCecil is a splendid one to beholdCecil is a splendid one to behold
Re: Problems running servos

I'm not fluent in that language at all, but the first thing I would check is to see if you have a jumper on the pins next to the servo output. Without that jumper, the servo will not get power to move at all.
__________________
I'm right 90% of the time, so why worry about the other 3%?
  #3   Spotlight this post!  
Unread 30-01-2012, 15:19
omalleyj omalleyj is offline
Registered User
AKA: Jim O'Malley
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: New Jersey
Posts: 132
omalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to behold
Re: Problems running servos

Quote:
Originally Posted by Cecil View Post
I'm not fluent in that language at all, but the first thing I would check is to see if you have a jumper on the pins next to the servo output. Without that jumper, the servo will not get power to move at all.
I would just add to that: make sure the DSC is getting power, showing the 6V indicator lit, not just the 5V.

Codewise:
Try hardcoding a value and verify that it is (or isn't) hardware. If the hardcoded value works and the code doesn't.
Good luck!

Last edited by omalleyj : 30-01-2012 at 15:22. Reason: I can't read :-(
  #4   Spotlight this post!  
Unread 30-01-2012, 15:42
slijin's Avatar
slijin slijin is offline
Pockets
AKA: Samuel Lijin
FRC #0694 (StuyPulse)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York City
Posts: 537
slijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to behold
Re: Problems running servos

One possible problem is that your servo is unusual and doesn't operate on the conventional signal range. We've encountered this problem before with Parallax servos. As a reference (I'm not sure about the actual DS output), since Hitec servos are the brand that FIRST recommends,

Quote:
Originally Posted by HITEC
All Hitec servos require 3-5V peak to peak square wave pulse. Pulse duration is from 0.9mS to 2.1mS with 1.5mS as center. The pulse refreshes at 50Hz (20mS).
__________________

2010-12 CT Chairman's
2011 Galileo 5th seed
2010 NY Regional Winners
  #5   Spotlight this post!  
Unread 30-01-2012, 15:49
feverittm's Avatar
feverittm feverittm is offline
Registered User
FRC #0997 (Spartans)
Team Role: Mentor
 
Join Date: Apr 2010
Rookie Year: 2010
Location: Corvallis, OR
Posts: 122
feverittm will become famous soon enoughfeverittm will become famous soon enough
Re: Problems running servos

Did you remember to connect the 6V jumper for Servo power on the Digital Sidecar?
__________________
Floyd Moore
Mentor Electrical and Pneumatics
Team 997 - Spartan Robotics
Corvallis High School, Corvallis Oregon
  #6   Spotlight this post!  
Unread 30-01-2012, 21:20
smigs smigs is offline
Registered User
FRC #3373
 
Join Date: Jan 2012
Location: Warrenton, VA
Posts: 3
smigs is an unknown quantity at this point
Re: Problems running servos

Hi everyone,

Thank you so much for your inputs (no pun intended

One thought I did have was to make sure the port we are using has a recorded 6 V difference on the DSC which it does. I also did hardcode a value in for the servo and no response. The DSC is also getting power since we have other hardware hooked into it and it is functioning properly with the correct C++ code.

I never thought about the servo not operating in the conventional signal range so that is something to look at. I am new to FRC so I am still learning where things go etc., but I do know some programming so I feel reasonably confident that the code is correct, especially since the analogous code for the motors work fine.

For feverittm: If the 6V jumper were not present, what would happen? In other words, would there still be a voltage difference across the leads?

Thanks everyone for your quick replies.
  #7   Spotlight this post!  
Unread 30-01-2012, 21:46
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,533
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Problems running servos

The jumper is what applies the 5 Volt power to the hot pin on the pwm / servo outputs. Without it, the servos get no power.
  #8   Spotlight this post!  
Unread 30-01-2012, 22:27
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,583
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Problems running servos

In your code, change the digital module to 1, instead of 2.
  #9   Spotlight this post!  
Unread 30-01-2012, 22:58
theprgramerdude theprgramerdude is offline
WPI Freshman
AKA: Alex
FRC #2503 (Warrior Robotics)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2008
Location: Brainerd, Minnesota
Posts: 347
theprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud of
Re: Problems running servos

What Joe said. Module numbers =/= Slot numbers, it's a semantics change this year that chokes people up who haven't followed everything. Once that changes, it should work fine.
__________________
Attending: MN Duluth Regional
  #10   Spotlight this post!  
Unread 31-01-2012, 23:18
smigs smigs is offline
Registered User
FRC #3373
 
Join Date: Jan 2012
Location: Warrenton, VA
Posts: 3
smigs is an unknown quantity at this point
Re: Problems running servos

Changing the module to 1 did work!! Thank you so much for the help!!
Closed Thread


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 22:37.

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