Go to Post I predict the champion drive teams at each event of the 2011 season will consist of vertebrates. - Taylor [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 15-01-2007, 16:47
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: PWM 13-16 Replacement Code Beta Test

Quote:
Originally Posted by AdamHeard View Post
So... is the legality of this confirmed?

-Adam
There are no rules preventing teams from using this code, so there is nothing to confirm. If you're thinking that this somehow gets around the ability to safe motors, it doesn't because IFI's mechanism for doing that is under the master microcontrollers control.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #17   Spotlight this post!  
Unread 15-01-2007, 17:33
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: PWM 13-16 Replacement Code Beta Test

Quote:
Originally Posted by Kevin Watson View Post
There are no rules preventing teams from using this code, so there is nothing to confirm. If you're thinking that this somehow gets around the ability to safe motors, it doesn't because IFI's mechanism for doing that is under the master microcontrollers control.

-Kevin
I'm curious how that works, since the pins are supposedly connected straight to the user processor, how would the master processor disable that?

Also, how did you get around the interrupt-glitch thing? I'm missing something obvious when I look at the code...
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
  #18   Spotlight this post!  
Unread 15-01-2007, 17:43
Dave Flowerday Dave Flowerday is offline
Software Engineer
VRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 1995
Location: North Barrington, IL
Posts: 1,366
Dave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond repute
Re: PWM 13-16 Replacement Code Beta Test

Quote:
Originally Posted by Matt Krass View Post
I'm curious how that works, since the pins are supposedly connected straight to the user processor, how would the master processor disable that?
Most likely the PWM outputs from the user processor run through a buffer with an enable line, and the master disables the buffers when the robot is to be disabled, which tri-states the buffer outputs.
  #19   Spotlight this post!  
Unread 15-01-2007, 18:01
JSonntag JSonntag is offline
Registered User
FRC #0486 (Positronic Panthers)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: United States
Posts: 16
JSonntag is on a distinguished road
Send a message via AIM to JSonntag
Re: PWM 13-16 Replacement Code Beta Test

Quote:
Originally Posted by Matt Krass View Post
Also, how did you get around the interrupt-glitch thing? I'm missing something obvious when I look at the code...
He disabled the interrupts when the pwm's transition from low to high
  #20   Spotlight this post!  
Unread 15-01-2007, 18:17
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: PWM 13-16 Replacement Code Beta Test

Quote:
Originally Posted by Matt Krass View Post
I'm curious how that works, since the pins are supposedly connected straight to the user processor, how would the master processor disable that?
They aren't connected directly (which is why you can't use them as inputs). There is a switch that is controlled by the master that determines which processor gets to send its output to the pin. The call to Setup_PWM_Output_Type() tells the master processor who's in the driver seat (icky pun intended). When your 'bot is disabled, the switch is flipped to the master, which provides the 1.5 ms neutral pulse.

Edit: Actually, Dave's explanation may be closer to the truth. If the master is capable of generating the PWM output, why do we have the Generate_Pwms() kludge to deal with. Still, the 1.5 ms PWM neutral pulse needs to get generated for safety reasons. If not the master, who?

Quote:
Originally Posted by Matt Krass View Post
Also, how did you get around the interrupt-glitch thing? I'm missing something obvious when I look at the code...
The pulse doesn't glitch because once software sets up the timer and CCP hardware and says go, everything is done in hardware, which is oblivious to the interrupts firing-off in the background.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org

Last edited by Kevin Watson : 15-01-2007 at 18:23.
  #21   Spotlight this post!  
Unread 15-01-2007, 18:27
Dave Flowerday Dave Flowerday is offline
Software Engineer
VRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 1995
Location: North Barrington, IL
Posts: 1,366
Dave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond repute
Re: PWM 13-16 Replacement Code Beta Test

Quote:
Originally Posted by Kevin Watson View Post
Still, the 1.5 ms PWM neutral pulse needs to get generated for safety reasons. If not the master, who?
If you're talking about when the robot is disabled, I'm pretty sure the PWM pins are left floating. We noticed a side effect of this last year when we ran some servo wires close to our RS232 for the camera, and when the robot was disabled the RS232 would generate enough noise on the (floating) PWM line to cause our camera servos to twitch. Actually, now that I think about it, if those PWM wires had been connected to a Victor, it could have been a dangerous situation. When the robot was enabled, the PWM output was being driven such that noise was not an issue.
  #22   Spotlight this post!  
Unread 15-01-2007, 18:32
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: PWM 13-16 Replacement Code Beta Test

Quote:
Originally Posted by Dave Flowerday View Post
If you're talking about when the robot is disabled, I'm pretty sure the PWM pins are left floating. We noticed a side effect of this last year when we ran some servo wires close to our RS232 for the camera, and when the robot was disabled the RS232 would generate enough noise on the (floating) PWM line to cause our camera servos to twitch. Actually, now that I think about it, if those PWM wires had been connected to a Victor, it could have been a dangerous situation. When the robot was enabled, the PWM output was being driven such that noise was not an issue.
Ugh, floating the PWM outputs doesn't seem like a good idea. Thanks, I stand corrected.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #23   Spotlight this post!  
Unread 20-01-2007, 13:38
maniac_2040's Avatar
maniac_2040 maniac_2040 is offline
Registered User
AKA: Matt
FRC #3302 (Turbo Trojans)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Clawson, Michigan
Posts: 34
maniac_2040 is infamous around these partsmaniac_2040 is infamous around these partsmaniac_2040 is infamous around these partsmaniac_2040 is infamous around these parts
Send a message via MSN to maniac_2040
Re: PWM 13-16 Replacement Code Beta Test

Quote:
Originally Posted by Dave Flowerday View Post
If you're talking about when the robot is disabled, I'm pretty sure the PWM pins are left floating. We noticed a side effect of this last year when we ran some servo wires close to our RS232 for the camera, and when the robot was disabled the RS232 would generate enough noise on the (floating) PWM line to cause our camera servos to twitch. Actually, now that I think about it, if those PWM wires had been connected to a Victor, it could have been a dangerous situation. When the robot was enabled, the PWM output was being driven such that noise was not an issue.
I've been seing something similar to this when testing on our robot. I was using some Vex Motor Modules to test some code. When I would put the controller in the program state to download, sometimes the motor would just randomly spin in all kinds of directions, and I would usually have to unplug the backup battery if it didn't stop. Does this pwm code fix that? I would like to know more about these "floating" pwms. When I start testing with our arm mechanism it will be very dangerous if the arm can just start randomly swinging around in the prog state...
  #24   Spotlight this post!  
Unread 21-01-2007, 16:31
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: PWM 13-16 Replacement Code

IMHO, one of the nice things about this software is the ability to define how the PWM range of 0-255 maps to the servo position range. So for fun, I decided that I'd like to wring-out as much pointing accuracy from my camera's tilt mechanism by mapping the entire 0-255 PWM range to the more useful 0 to 90 degree tilt range. These are the steps I took:

1) Moved the tilt PWM from PWM output 2 to 16. This is necessary because PWM() can only contol PWM outputs 13 through 16.

2) The first piece of information I needed was to find the PWM pulse width that caused the servo to rotate the camera to the 90 degree position. Using the camera software's interactive PWM adjustment menu to command the tilt mechanism to rotate the lens up, I found that the default gain of 5.0 us per PWM step wasn't high enough to rotate the camera to the 90 degree position. I opened up pwm.h and increased to gain on PWM output 16 to a value of 70 for a pulse step size of 7.0 us. I re-compiled and downloaded the code to the RC and found that I could command the servo to 90 degrees with a PWM value of 254. Using the inverse of the algorithm from PWM(), I calculated that PWM() was sending a PWM pulse width of 2.389 ms.

3) Using the same technique described above, I determined the pulse width I needed to send for 0 degrees to be 1.479 ms.

4) I then calculated the pulse width range that I needed to cover by subtracting the result of #2 from #3 for a range of 0.910 ms.

5) To calculate the gain, I just divided the pulse range needed by the available PWM range of 256 for a gain of 36 or 3.6 us per PWM step. This is the gain value that is needed to limit the range of servo motion to 90 degrees.

6) I now needed to calculate a new center point for the servo. If I leave it at 1.5 ms, the servo will rotate through a 90 degree range, but it will be -45 degrees to 45 degrees. I needed to change the center point to +45 degrees so the servo will rotate from 0 to 90 degrees. To calculate the new center point, I just divided the range (from #4) by 2 and added that to the 0 degree pulse width (from #3) for a value of 19340 (or 1.934 ms).

7) Plugging the values from #5 and #6 into pwm.h, re-compiling, loading the RC, and then testing, I found the range to be the desired 0 to 90 degree range!

8) I then changed the PWM value to angle code in terminal.c from:

printf("Tilt Angle (degrees) = %d\r\n", (((int)TILT_SERVO - 144) * 25)/50);

to:

printf("Tilt Angle (degrees) = %d\r\n", ((int)TILT_SERVO * 90)/250);

9) The tilt gain was then changed from 8 to 4 for faster tracking.

10) Because I now have better pointing ability, I was also able to change the TILT_ALLOWABLE_ERROR_DEFAULT value to 3 pixels.

11) Finally, I changed the min tilt PWM value to 0, the maximum to 250 (255 is a degree or two past 90), adjusted the mid-point to 50.

This new found pointing accuracy might come in handy if you're using the green tracking light for navigation.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #25   Spotlight this post!  
Unread 21-01-2007, 18:05
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: PWM 13-16 Replacement Code

Using the Bells & Whistles camera code, PMWs 13-16 twitch for a moment when data is stored to EEPROM. I can work around it easily, but it's definitely undesired operation.
  #26   Spotlight this post!  
Unread 21-01-2007, 19:58
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: PWM 13-16 Replacement Code

Quote:
Originally Posted by Alan Anderson View Post
Using the Bells & Whistles camera code, PMWs 13-16 twitch for a moment when data is stored to EEPROM. I can work around it easily, but it's definitely undesired operation.
Yeah, I noticed it this morning. I suspect the menu drawing code is using too much of the CPU and the servos are trying to return to the center position when they don't see a pulse for a while.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #27   Spotlight this post!  
Unread 21-01-2007, 22:36
gnirts gnirts is offline
Suspicious pointer conversion
AKA: Robinson Levin
FRC #1648 (The Gearbox Gangstaz)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: ATL
Posts: 116
gnirts will become famous soon enough
Re: PWM 13-16 Replacement Code

Can I now use the alltimers library and PWMs 13-16 at the same time?

Thanks in advance,
Robinson
  #28   Spotlight this post!  
Unread 21-01-2007, 22:56
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: PWM 13-16 Replacement Code

Quote:
Originally Posted by gnirts View Post
Can I now use the alltimers library and PWMs 13-16 at the same time?

Thanks in advance,
Robinson
Yes, shouldn't be a problem.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #29   Spotlight this post!  
Unread 25-01-2007, 10:05
pheadxdll pheadxdll is offline
Registered User
AKA: Alex
FRC #1225 (Amperage Robotics)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2006
Location: North Carolina
Posts: 168
pheadxdll has much to be proud ofpheadxdll has much to be proud ofpheadxdll has much to be proud ofpheadxdll has much to be proud ofpheadxdll has much to be proud ofpheadxdll has much to be proud ofpheadxdll has much to be proud ofpheadxdll has much to be proud ofpheadxdll has much to be proud of
Re: PWM 13-16 Replacement Code

Is this feature included in the default 2007 code?
__________________
Amperage Robotics Team 1225
Site under-going revamp. :/
  #30   Spotlight this post!  
Unread 29-01-2007, 02:21
ace123's Avatar
ace123 ace123 is offline
Registered User
AKA: Patrick Horn
FRC #0008 (Paly Robotics - http://robotics.paly.net/)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Palo Alto, CA
Posts: 50
ace123 has a spectacular aura aboutace123 has a spectacular aura about
Send a message via AIM to ace123
Re: PWM 13-16 Replacement Code

It's included in Kevin's camera codes at http://kevin.org/frc/
But it's not in the one you download at IFI (that still uses the old Generate_Pwms() function).
__________________
-Patrick Horn, Paly Robotics

Check out the space simulator called Vega Strike, modelled after the space simulator games Elite and Wing Commander. It's Open Source too!
If you have ever played Wing Commander, or especially Privateer, and had a feeling of nostalga derived from the you will enjoy these two Vega Strike mods: Privateer Gemini Gold and Privateer Remake!
I'm working on adding multiplayer support this year...
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
Vex start up code run PWM outputs without Rx intellec7 Programming 3 05-05-2006 23:29
Pwm 11, 12 and CMU code Chris Bright Programming 3 01-02-2005 19:34
Victor Replacement JamesCH95 Electrical 4 15-12-2004 20:12
Replacement Parts archiver 1999 0 23-06-2002 22:01
replacement gears joni_m Technical Discussion 1 22-01-2002 18:01


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

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