Go to Post At this point (after shipping the robot), I'm really looking forward to doing laundry, eating a square meal, and getting to bed at a reasonable hour. - Emily Pease [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 02-02-2008, 20:12
steve d steve d is offline
Registered User
FRC #1277
 
Join Date: Jan 2007
Location: Groton, ma
Posts: 38
steve d is an unknown quantity at this point
we need help with PWM problem in autonomous

We're getting strange pwm trouble in Autonomous Mode. If I put pwm13 = pwm14 = 127 in User_Autonomous_Code(), the speed controller's LED are green and motors turn. If I use pwm13 = pwm14 = 0 or if I use pwm13 = pwm14 = 255, both make LEDs turn off and motors spin opposite. If I do this in the default routine, it works right: 127, LEDs are orange; 255,green and 0 red.
Can anyone tell my why the PWMs act different in Default and Autonomous?
here's the code in User_Autonomous_Code() :

...
/* Add your own autonomous code here. */

Remote_Controls();
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
...
}

void Remote_Controls()
{

// if Remote # 2 is pressed, stop
if (rc_dig_in02==0)
{
pwm13 = pwm14 = 127;
pwm15 = pwm16 = 127;
}

// if Remote # 3 is pressed, backup
if (rc_dig_in03==0)
{
pwm13 = pwm14 = 0;
pwm15 = pwm16 = 0;
}

// if Remote # 4 is pressed, fwd
if (rc_dig_in04==0)
{
pwm13 = pwm14 = 255;
pwm15 = pwm16 = 255;
}

}
  #2   Spotlight this post!  
Unread 02-02-2008, 20:23
Laaba 80 Laaba 80 is offline
Registered User
AKA: Joey
FRC #1714 (MORE Robotics)
Team Role: Alumni
 
Join Date: Dec 2007
Rookie Year: 2001
Location: San Jose, CA
Posts: 495
Laaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond reputeLaaba 80 has a reputation beyond repute
Re: we need help with PWM problem in autonomous

in your code where it says

if (rc_dig_in13==0)

You need to put == 1 If you are looking for 0 that means you never pressed a button. If you press the stop button with your code it makes it 1, so it skips the if statement you want it to go to, and goes to the reverse one. I think I explained it ok, if I didnt, ley me know.
Joey
__________________
Driving Record - 75-43-8
Coaching Record - 92-65
  #3   Spotlight this post!  
Unread 02-02-2008, 21:23
steve d steve d is offline
Registered User
FRC #1277
 
Join Date: Jan 2007
Location: Groton, ma
Posts: 38
steve d is an unknown quantity at this point
Re: we need help with PWM problem in autonomous

rc_dig_in13==0 means the switch is closed; on the robot controller's digital input/output port, the white and black lines are connecting.
But that has nothing to do with why pwm13=127 makes the speed controller go full forward, like I said above.
  #4   Spotlight this post!  
Unread 02-02-2008, 21:26
psy_wombats's Avatar
psy_wombats psy_wombats is offline
Registered User
AKA: A. King
FRC #0467 (Duct Tape Bandits)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Shrewsbury MA
Posts: 95
psy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura about
Re: we need help with PWM problem in autonomous

When you say pwm13=127, is that within one of the IR ifs or just a direct assignment? There should be no reason the code is different in the two functions, it is very strange.
  #5   Spotlight this post!  
Unread 02-02-2008, 21:39
steve d steve d is offline
Registered User
FRC #1277
 
Join Date: Jan 2007
Location: Groton, ma
Posts: 38
steve d is an unknown quantity at this point
Re: we need help with PWM problem in autonomous

At first in the IR ifs, but when it was acting strange,I began to try it everyway I could think of, finally even with direct assignments, printing out the values to make sure, and it always acted like that. I cut and paste it into Default_Routine() and it was fine. I wonder if somehow I'm generating PWMs to often or something, but I don't see where.
  #6   Spotlight this post!  
Unread 02-02-2008, 21:46
psy_wombats's Avatar
psy_wombats psy_wombats is offline
Registered User
AKA: A. King
FRC #0467 (Duct Tape Bandits)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Shrewsbury MA
Posts: 95
psy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura about
Re: we need help with PWM problem in autonomous

Oh, sorry I didn't notice before... Go look at the sticky topic about PWM 13-16 replacement code... Those ones are different from the rest, if you'll read. Or just change the PWMs to a lower value and see what happens. That's almost definitely the issue.
  #7   Spotlight this post!  
Unread 03-02-2008, 11:41
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: we need help with PWM problem in autonomous

Quote:
Originally Posted by steve d View Post
rc_dig_in13==0 means the switch is closed; on the robot controller's digital input/output port, the white and black lines are connecting.
The comments in the code seem to indicate that you're using the IR sensor board. That board doesn't provide a switch closure to ground. It provides a voltage output: 0 means the signal is not detected, and 1 means it is. If your digital inputs are coming from the IR board, you do have your tests backwards.
  #8   Spotlight this post!  
Unread 03-02-2008, 12:46
steve d steve d is offline
Registered User
FRC #1277
 
Join Date: Jan 2007
Location: Groton, ma
Posts: 38
steve d is an unknown quantity at this point
Re: we need help with PWM problem in autonomous

Thanks. No, for troubleshooting I was using a jumper on the inputs, no IR reciever connected. That's why if digtal in ==0.
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
Problem with PWM outputs on RC Adam Richards Control System 1 20-02-2007 06:37
I have a BIG problem with my controller, need help. razer Control System 7 12-01-2007 06:21
HELP needed, problem with streamling, need uploading space or diffrent solution... Nimmy General Forum 5 15-02-2006 11:18
need help with autonomous caderader Programming 3 14-02-2005 18:25
PWM problem in autonomous outofcontrol Programming 5 27-02-2004 11:58


All times are GMT -5. The time now is 20:51.

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