Go to Post If all you've seen of an event is the three days of the competition, you've missed 99% of the work that made it happen. - Madison [more]
Home
Go Back   Chief Delphi > Technical > Programming
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 10-02-2007, 19:45
brennerator brennerator is offline
Registered User
#1560
 
Join Date: Jan 2005
Location: Silicon Valley
Posts: 75
brennerator is an unknown quantity at this point
Rotating Servo HS322 over 90 degrees

Basically I have this servo and I want to rotate it along its entire range of motion. I have the default code, and I set pwm 11 for this servo.

if (p1_sw_trig ==1)
{
pwm11 = 255;
}
if (p1_sw_top == 1)
{
pwm11 = 0;

This is so that we can upshift and downshift....

Thanks.
  #2   Spotlight this post!  
Unread 10-02-2007, 20:23
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: Rotating Servo HS322 over 90 degrees

Quote:
Originally Posted by brennerator View Post
Basically I have this servo and I want to rotate it along its entire range of motion. I have the default code, and I set pwm 11 for this servo.

if (p1_sw_trig ==1)
{
pwm11 = 255;
}
if (p1_sw_top == 1)
{
pwm11 = 0;

This is so that we can upshift and downshift....

Thanks.
Ummm...was there a question in there? I can't find one...

JBot
__________________
Aren't signatures a bit outdated?
  #3   Spotlight this post!  
Unread 10-02-2007, 20:39
brennerator brennerator is offline
Registered User
#1560
 
Join Date: Jan 2005
Location: Silicon Valley
Posts: 75
brennerator is an unknown quantity at this point
Re: Rotating Servo HS322 over 90 degrees

The code in the post does not work. Any help?
  #4   Spotlight this post!  
Unread 10-02-2007, 20:43
fimmel's Avatar
fimmel fimmel is offline
Founding Mentor, Team 2370
AKA: Forest Immel
FRC #2370 (iBots 2370)
Team Role: Mentor
 
Join Date: Dec 2005
Rookie Year: 2005
Location: Castleton, Vermont
Posts: 325
fimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond repute
Re: Rotating Servo HS322 over 90 degrees

you have 2 if statements you need an else statement

here is an example:
Code:
 if (p1_sw_trig ==1)
{
pwm11 = 255;
}
if else (p1_sw_top == 1)
{
pwm11 = 0;
}
else {
}
hope that works.....im sorta new to programming

/forest
__________________



  #5   Spotlight this post!  
Unread 10-02-2007, 20:56
chris31 chris31 is offline
Team 2021 Captain
AKA: Chris Davidson
FRC #2021 (FA Robotics)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2006
Location: Atlanta, GA/ Fredericksburg,VA
Posts: 949
chris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond repute
Send a message via AIM to chris31
Re: Rotating Servo HS322 over 90 degrees

Quote:
Originally Posted by fimmel View Post
you have 2 if statements you need an else statement

here is an example:
Code:
 if (p1_sw_trig ==1)
{
pwm11 = 255;
}
if else (p1_sw_top == 1)
{
pwm11 = 0;
}
else {
}
hope that works.....im sorta new to programming

/forest
It should be an "else if" not "if else". Also the last "else" doesnt need to be there as you arent using it for anything.
  #6   Spotlight this post!  
Unread 10-02-2007, 21:09
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,113
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: Rotating Servo HS322 over 90 degrees

Quote:
Originally Posted by brennerator View Post
The code in the post does not work. Any help?
What do you want it to do? What does it do instead?

Is another part of the code setting pwm11 to something else later?
  #7   Spotlight this post!  
Unread 10-02-2007, 21:49
fimmel's Avatar
fimmel fimmel is offline
Founding Mentor, Team 2370
AKA: Forest Immel
FRC #2370 (iBots 2370)
Team Role: Mentor
 
Join Date: Dec 2005
Rookie Year: 2005
Location: Castleton, Vermont
Posts: 325
fimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond repute
Re: Rotating Servo HS322 over 90 degrees

Quote:
Originally Posted by chris31 View Post
It should be an "else if" not "if else". Also the last "else" doesnt need to be there as you arent using it for anything.
thanks....im still learning as well

/forest
__________________



  #8   Spotlight this post!  
Unread 10-02-2007, 22:58
brennerator brennerator is offline
Registered User
#1560
 
Join Date: Jan 2005
Location: Silicon Valley
Posts: 75
brennerator is an unknown quantity at this point
Re: Rotating Servo HS322 over 90 degrees

I dont really know what happens; the servo does not move!! do I have t odefine pwm11 just like the default code did for 13-16?

Can anyone shed some light?

Im just using the stock default code and added in the code from post #1
  #9   Spotlight this post!  
Unread 10-02-2007, 23:06
NOV8R's Avatar
NOV8R NOV8R is offline
Registered User
AKA: Chuck Brant
FRC #1583
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Centennial, Colorado
Posts: 209
NOV8R has much to be proud ofNOV8R has much to be proud ofNOV8R has much to be proud ofNOV8R has much to be proud ofNOV8R has much to be proud ofNOV8R has much to be proud ofNOV8R has much to be proud ofNOV8R has much to be proud of
Re: Rotating Servo HS322 over 90 degrees

To get the Hitec HS322HD servos to rotate more than 90 degress takes a hardware modification of the servo. It's not a software issue. Check out Hitec's website.
  #10   Spotlight this post!  
Unread 10-02-2007, 23:11
brennerator brennerator is offline
Registered User
#1560
 
Join Date: Jan 2005
Location: Silicon Valley
Posts: 75
brennerator is an unknown quantity at this point
Re: Rotating Servo HS322 over 90 degrees

I just want them to rotate 90 degrees! It has to be my program right? Its just the default code with the lines from post #1 slapped on.
  #11   Spotlight this post!  
Unread 11-02-2007, 08:56
Ken Streeter's Avatar
Ken Streeter Ken Streeter is offline
Let the MAYHEM begin!
FRC #1519 (Mechanical Mayhem)
Team Role: Engineer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Team: Milford, NH; Me: Bedford, NH
Posts: 471
Ken Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond repute
Re: Rotating Servo HS322 over 90 degrees

Quote:
Originally Posted by brennerator View Post
I just want them to rotate 90 degrees! It has to be my program right? Its just the default code with the lines from post #1 slapped on.
When you said earlier, "the servo doesn't even move," when you run the program, does the servo ever move at all? How about if you try to force it (with your finger) to go to a different position? When you try to turn the servo shaft to a different position, does it want to "fight back"?

If the servo doesn't seem to be doing anything at all (i.e. when you try to turn it to a different position, it doesn't "fight back") then I would speculate that the problem is that either the servo is not properly wired to the correct PWM output, or a charged 7.2V backup battery isn't connected to the RC. The servo motors get their power from the backup battery (not the main 12V battery) so a 7.2V battery needs to be connected to the RC for the servos to function at all.

Best Regards,

--ken
__________________
Ken Streeter - Team 1519 - Mechanical Mayhem (Milford Area Youth Homeschoolers Enriching Minds)
2015 NE District Winners with 195 & 2067, 125 & 1786, 230 & 4908, and 95 & 1307
2013 World Finalists & Archimedes Division Winners with 33 & 469
2013 & 2012 North Carolina Regional Winners with teams 435 & 4828 and 1311 & 2642
2011, 2010, 2006 Granite State Regional Winners with teams 175 & 176, 1073 & 1058, and 1276 & 133
Team 1519 Video Gallery - including Chairman's Video, and the infamous "Speed Racer!"
  #12   Spotlight this post!  
Unread 11-02-2007, 13:23
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,113
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: Rotating Servo HS322 over 90 degrees

Quote:
Originally Posted by brennerator View Post
...Im just using the stock default code and added in the code from post #1
Near the beginning of Default_Routine you will find this line:
Code:
  pwm11 = p3_wheel;
If it's still there, it might be undoing whatever your code is setting pwm11 to.

Use a Dashboard Viewer program to see what value pwm11 is actually being set to on the robot. That'll help narrow it down between software and hardware issues.
  #13   Spotlight this post!  
Unread 12-02-2007, 17:21
Vashts6583's Avatar
Vashts6583 Vashts6583 is offline
The sleepless
AKA: Rob Metzger
FRC #0007 (Team 007)
Team Role: Leadership
 
Join Date: Dec 2004
Rookie Year: 2005
Location: Parkville
Posts: 79
Vashts6583 is a name known to allVashts6583 is a name known to allVashts6583 is a name known to allVashts6583 is a name known to allVashts6583 is a name known to allVashts6583 is a name known to all
Send a message via ICQ to Vashts6583 Send a message via AIM to Vashts6583 Send a message via MSN to Vashts6583 Send a message via Yahoo to Vashts6583
Re: Rotating Servo HS322 over 90 degrees

What I did to test-move some servos was remap joystick buttons to the PWM in which the servo was plugged. Basically, I deleted the original mapping (as mentioned above) and instead added code for two buttons, and it worked like a charm.

Also, try using the values 254 and 0, instead of 255, k?
__________________
/*********************
2005: Software Assistant
2006: Software Head
2007: President/Driver/Software Head/Temporary Safety Captain
*********************/

//2005: Chesapeake Regional - Finalist


Life is what you do outside of FIRST. No wonder it's so short.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Servo Values to Degrees... How? mogunus Programming 16 11-04-2007 02:03
How do you get servo numbers into Angle Degrees Cow Bell Solo Programming 3 18-02-2007 12:16
engineering degrees sciguy125 Career 18 17-03-2006 23:44
Turn 90 Degrees Mike Math and Science 16 05-12-2004 22:22
Rotating Light - not rotating :-/ MrB Technical Discussion 17 08-02-2002 20:36


All times are GMT -5. The time now is 00:24.

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