Go to Post IT ISN'T THE STUDENT'S JOB TO DISCIPLINE OTHER STUDENTS. That's why God invented mentors. Let them do their jobs. - Collin Fultz [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
  #16   Spotlight this post!  
Unread 31-03-2004, 02:29
10intheCrunch's Avatar
10intheCrunch 10intheCrunch is offline
Who's John V-Neun?
AKA: Alex Baxter
None #0254 (Cheesy Poofs)
Team Role: College Student
 
Join Date: Feb 2004
Rookie Year: 2004
Location: San Jose, CA
Posts: 129
10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough
Send a message via AIM to 10intheCrunch
Re: counting in seconds for the autonomous mode??

Well, we have had problems when using those generated PWMs, especially if they are called quickly. We've observed fluctuations in the motor we're trying to adjust as well as induced outputs on other PWMs that are generated. Switching to PWMs 1-12 solved these problems.

While it may not be a bad idea in theory to call G_PWMs quickly, for practical application with the robots we are building, its unnecessary and possibly detrimental. Do you really need to update your actual motor output at faster than 38hz?
__________________
~Alex Baxter
Programming, Arms operation, Team 254
  #17   Spotlight this post!  
Unread 31-03-2004, 07:48
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: counting in seconds for the autonomous mode??

Quote:
from TedP: Having interrupt-controlled timing that is triggered by an interrupt generated by the terminal count of a hardware timer timed fairly precisely to go off every 100th of a second (or even finer) seems much simpler than using a counter to do this timing...
setting up a hardware timer and writing an interrupt routine seems much simpler than putting
Code:
    auton_time++; 
in your code

?!

you gotta remember lots of students are struggling just to understand this stuff, and dont normally use uP hardware everyday :^)
  #18   Spotlight this post!  
Unread 31-03-2004, 08:32
Pattyta Pattyta is offline
Registered User
#1300
 
Join Date: Mar 2004
Location: oakville,canada
Posts: 8
Pattyta is on a distinguished road
Re: counting in seconds for the autonomous mode??

would this code work u think?? we're going to use a stopwatch to determine how long it actually takes us in average. the only think we are doing in autonomous mod is driving to the 10 pt ball and hopefully noking it down.

void User_Autonomous_Code(void)
{
/* Initialize all PWMs and Relays when entering Autonomous mode, or else it
will be stuck with the last values mapped from the joysticks. Remember,
even when Disabled it is reading inputs from the Operator Interface.
*/
pwm01 = pwm02 = pwm03 = pwm04 = pwm05 = pwm06 = pwm07 = pwm08 = 127;
pwm09 = pwm10 = pwm11 = pwm12 = pwm13 = pwm14 = pwm15 = pwm16 = 127;
relay1_fwd = relay1_rev = relay2_fwd = relay2_rev = 0;
relay3_fwd = relay3_rev = relay4_fwd = relay4_rev = 0;
relay5_fwd = relay5_rev = relay6_fwd = relay6_rev = 0;
relay7_fwd = relay7_rev = relay8_fwd = relay8_rev = 0;

while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
counter++;
Getdata(&rxdata); /* DO NOT DELETE, or you will be stuck here forever! */

/* Add your own autonomous code here. */

// counter calculated as (38*12)

if ( counter < 456 ) // still less than 12 seconds have elapsed
{


if (rc_dig_in01 == 0 && rc_dig_in02 == 0)
{
pwm13 = pwm14=137;
pwm15= pwm16= 137;
}

if (rc_dig_in01 == 1 && rc_dig_in02 ==0)
{
pwm13 = pwm14= 128;
pwm15= pwm16= 132;
}

if (rc_dig_in01 ==0 && rc_dig_in02 == 1)
{
pwm13 = pwm14=132;
pwm15= pwm16=128;
}

}


Generate_Pwms(pwm13,pwm14,pwm15,pwm16);

Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
}
}
}
  #19   Spotlight this post!  
Unread 31-03-2004, 08:41
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,867
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: counting in seconds for the autonomous mode??

Quote:
Originally Posted by TedP
You can Generate_Pwms() as fast as you can as well because those are the FAST PWMs. They can be handled specially.
Actually this is not true and is not a good idea to do blindly.
It isn't a matter of how fast our controller can spit out PWM updates, but a matter of how fast the device at the receiving end is designed to be updated. The victor speed controllers are not designed for a 2ms update rate. I believe they update at 60Hz or 17ms.

Use the Generate_Pwms() at the slow-loop 26ms rate or create a separate timing loop to update them at 17ms minimum for fastest updates.

[edit] I double checked and the victor does at least one type of update at 60Hz, but IFI notes imply a faster PWM update rate. I haven't been able to discover documentation on what that rate might be, other than 2ms is too fast.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 31-03-2004 at 14:17.
  #20   Spotlight this post!  
Unread 31-03-2004, 09:06
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,867
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: counting in seconds for the autonomous mode??

Quote:
Originally Posted by Pattyta
would this code work u think??
You can make counter local to this routine. Nowhere else does it have to be seen.

I might add an initialization for counter, e.g.,
Code:
void User_Autonomous_Code(void)
{
unsigned int counter=0;
...
while (autonomous_mode) /* DO NOT CHANGE! */
[edit] The following is not germane to this case you should just be aware of the pitfall.
Even if you initialized counter when you declare it, e.g., static unsigned int counter=0; You'll have trouble during the practice sessions when you run twice in a row. You'd have to be sure to reset the RC between runs. Explicitly setting it before the auto loop avoids this potential pitfall.

[edit]
Actually "static" isn't required in this case, since you never leave the routine. I only tend to use it as a matter of convention (Our functions aren't written to take control away from the main loop).
You can in this case declare "unsigned int counter=0;" in the local routine and be fine. I still prefer explicit initialization though.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 31-03-2004 at 11:49.
  #21   Spotlight this post!  
Unread 31-03-2004, 09:15
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: counting in seconds for the autonomous mode??

Quote:
Originally Posted by Pattyta
would this code work u think?? ...
looks like you got the right idea - I would punch up your pwm outputs higher when you want the motors on- they are just barely running the way you have it - start with maybe 1/4 or 1/3 power (pwm=170) and see what it does

BTW at most regionals they have a carpet setup in a back hallway where you can test your auton code - you usually have to sign up for a time slot, but it really helps to be able to test it, tweak your code, test it again...

it looks good - your on the right path.
  #22   Spotlight this post!  
Unread 31-03-2004, 10:12
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: counting in seconds for the autonomous mode??

Quote:
Originally Posted by TedP
See page 18 of:

http://www.innovationfirst.com/FIRST...10-29-2003.pdf

on IFI's website... It warns that devices connected to the PWM outputs may have trouble with the fast changing PWM outputs and to check those device specifications, but there's nothing about the RC that makes this a bad idea.
The RC is only one component of the system. The usual device connected to a PWM output is a Victor speed controller, and multiple teams have discovered that Victors don't handle fast updates very well.
Quote:
After all, aren't Putdata and Generate_Pwms called in the default fast routines anyway?
No, the only thing called in the default fast routine is Process_Data_From_Local_IO(), and that's empty. The Generate_Pwms() and Putdata() functions are called in the default slow routines, once per communication packet.
  #23   Spotlight this post!  
Unread 31-03-2004, 12:55
gnormhurst's Avatar
gnormhurst gnormhurst is offline
Norm Hurst
AKA: gnorm
#0381 (The Tornadoes)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Trenton, NJ
Posts: 138
gnormhurst will become famous soon enoughgnormhurst will become famous soon enough
Re: counting in seconds for the autonomous mode??

Regarding pwm13-16: See this thread, and see Kevin Watson's FAQ especially the first really long question.

I stay away from PWM13-16. 38 Hz is fast enough for me!
__________________
Trenton Tornadoes 381
2004 Philadelphia Regional Winners
2006 Xerox Creativity Award
---
My corner of the USPTO.
My favorite error message from gcc: main is usually a function
My favorite error message from Windows: There is not enough disk space available to delete this file.
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
Future of Autonomous Mode FadyS. Programming 41 24-05-2004 19:45
Simple Autonomous Mode Example deltacoder1020 Programming 5 08-03-2004 20:22
Initializing autonomous mode Mr. Lim Programming 7 02-02-2004 07:26
autonomous mode problem on field Chris_C Programming 17 26-03-2003 19:11
autonomous mode timer Don Programming 6 09-02-2003 22:16


All times are GMT -5. The time now is 02:28.

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