Go to Post If I can make one wish, it would be having Dean and Woodie read one of these writings of mine, so I can tell them "I get it! Give me time and give me inspiration, and one day I will be ready to take over the torch." - Ken Leung [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 27-03-2006, 02:37
ForgottenSalad's Avatar
ForgottenSalad ForgottenSalad is offline
In search of a home...
AKA: Michael Wessler
no team
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Bethlehem, NH
Posts: 136
ForgottenSalad will become famous soon enoughForgottenSalad will become famous soon enough
Send a message via AIM to ForgottenSalad
Scaling

Small question, as I've forgotten how to scale the PWM output for a half speed switch, quarter speed, etc. How would I have to modify the input assigned to the pwm for adjusting the speed?

By that I mean what I would have to add to the pwm01 = p1_y;

Thanks,
-Mike
__________________
You start with a bag full of luck and an empty bag of experience. The trick is to fill the bag of experience before you empty the bag of luck.
  #2   Spotlight this post!  
Unread 27-03-2006, 03:20
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Re: Scaling

Quote:
Originally Posted by ForgottenSalad
Small question, as I've forgotten how to scale the PWM output for a half speed switch, quarter speed, etc. How would I have to modify the input assigned to the pwm for adjusting the speed?

By that I mean what I would have to add to the pwm01 = p1_y;

Thanks,
-Mike
Try this:
pwm01 = ((int)p1_y - 127)/2 + 127

P.S.
I threw in the (int) because I don't remember if p1_y is defined as a signed or unsigned char. If it's unsigned, it wouldn't work without.
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me
  #3   Spotlight this post!  
Unread 27-03-2006, 10:05
Cuog's Avatar
Cuog Cuog is offline
Registered Linux User: 390661
AKA: Alex
FRC #0422
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2004
Location: Richmond, Virginia
Posts: 852
Cuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond repute
Send a message via AIM to Cuog
Re: Scaling

I would do the same thing as above but i would use (signed char) instead of int in the casting since it will be less memory intensive and faster(yes im all about optimizing code)
__________________
KK4KQO
http://voltair.us
Too many projects, too little time.
  #4   Spotlight this post!  
Unread 02-04-2006, 20:25
SoftwareBug2.0's Avatar
SoftwareBug2.0 SoftwareBug2.0 is offline
Registered User
AKA: Eric
FRC #1425 (Error Code Xero)
Team Role: Mentor
 
Join Date: Aug 2004
Rookie Year: 2004
Location: Tigard, Oregon
Posts: 486
SoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant future
Re: Scaling

Quote:
Originally Posted by Cuog
I would do the same thing as above but i would use (signed char) instead of int in the casting since it will be less memory intensive and faster(yes im all about optimizing code)
Wouldn't you need to change the 127's to 128's to make that work right?
  #5   Spotlight this post!  
Unread 02-04-2006, 21:57
TimCraig TimCraig is offline
Registered User
AKA: Tim Craig
no team
 
Join Date: Aug 2004
Rookie Year: 2003
Location: San Jose, CA
Posts: 221
TimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to behold
Re: Scaling

Quote:
Originally Posted by ForgottenSalad
By that I mean what I would have to add to the pwm01 = p1_y;
You need to provide a "transfer function" which will convert the joystick setting to PWM output for the Victor speed controller. It could look something like the following:

pwm01 = PctSpeedToPWM(p1_y);

Be advised that the response of the Victor speed controllers is HIGHLY nonlinear with respect to the PWM input values. From my tests, it's essentially exponential, that is, linear when plotted on semilog paper. The actual curve is dependent on robot weight, wheel friction, drive train friction, etc, so your mileage may vary. On our robot we get about 90% of speed at 44% of PWM range. I've attached a picture of the measured data.

On our robot, we use table of points forming a piecewise linear function that is interpolated. This allows much greater sensitivity under joystick control than using the straight IFI default code method you currently have. By playing with the transfer function, you can make the robot speed linear (or very nearly) with respect to the joystick. Biased so that it's less sensitive at low speed, for instance doing fine aiming in this year's game or tweaking putting a tetra on the goal in last year's game. Or it could be twitchy at low speed and have more sensitivity at high speed if you need it.
Attached Thumbnails
Click image for larger version

Name:	SpeedVsPWM.jpg
Views:	63
Size:	53.0 KB
ID:	4200  
  #6   Spotlight this post!  
Unread 02-04-2006, 22:08
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,590
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: Scaling

Quote:
Originally Posted by TimCraig
Be advised that the response of the Victor speed controllers is HIGHLY nonlinear with respect to the PWM input values. From my tests, it's essentially exponential, that is, linear when plotted on semilog paper. The actual curve is dependent on robot weight, wheel friction, drive train friction, etc, so your mileage may vary. On our robot we get about 90% of speed at 44% of PWM range. I've attached a picture of the measured data.
The following thread goes into a lot about why the graph looks like that. http://www.chiefdelphi.com/forums/sh...tor+non-linear

The following graph shows the response of the speed controller when connected to a purely resistive load (and is linked towards the end of the above thread). http://www.saratogarobotics.com/php-...showpage&pid=1. The response of the Victor speed controllers is linear in the range that IFI designed it for: http://ifirobotics.com/forum/viewtopic.php?t=317. The problem is that you are driving a non-linear system.
  #7   Spotlight this post!  
Unread 02-04-2006, 22:27
TimCraig TimCraig is offline
Registered User
AKA: Tim Craig
no team
 
Join Date: Aug 2004
Rookie Year: 2003
Location: San Jose, CA
Posts: 221
TimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to behold
Re: Scaling

We had intended to try the Victor with a purely resistive load but didn't have time before we had to go to "build" mode. Seeing that plot leads me to believe that the source of the nonlinearity is the back EMF from the motor. If your turn the shaft on a DC motor, it turns into a generator. When you drive it as a motor, it also acts like a generator, however, the sense of the voltage is inverse to the supplied voltage. This is why stall current is the maximum current the motor sees and then drops with speed. It could also be that speed is proportional to power and power it proportional to Voltage squared or Current squared.

I've also noticed a lag in seeing the motor start after an output is applied to the Victor and hence the motor. I've yet to do the experiments to determine if it's in the Victor repsonding to the input or if it's the rise time of the magnetic field in the motor.
  #8   Spotlight this post!  
Unread 02-04-2006, 23:22
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: Scaling

Quote:
Originally Posted by Joe Ross
The following thread goes into a lot about why the graph looks like that. http://www.chiefdelphi.com/forums/sh...tor+non-linear

....
Joe - you are cruel! I read through all 5 pages of that thread from last year, and my head is still spinning :^O

I think I can summarize and answer TimCraigs statement concerning the linearity of the Victors:

1. The Victors output a constant 12VDC that is pulse width modulated. The frequency of this variable duty cycle square wave is 120Hz.

2. You cannot measure the DC equivalent voltage level with a standard DMM or analog voltmeter - you need a true RMS meter (like a Fluke 87). Many people who experiment with free energy motors and generators fall into this trap - they created PWM square wave power circuits and then measure the voltage with a standard (averaging) DMM, and think they have invented perpetual motion. Average voltage is only equal to RMS voltage with a perfect sine wave. For anything else you need a true RMS meter.

3. The speed of the motor is dependant on several factors, including the load. If you measure input command against motor speed, you will get very different results if the motor is unloaded or fully loaded (to its spec'd HP output). Part of the reason is the 12V square wave PWM drive from the victor. The short pulse acts like its kicking the armature for a fraction of a millisecond at low output values. If the motor is not loaded that short kick gives it enough inertia to keep spinning until the next kick (8mS later).

So the bottom line is: if you want to measure output voltage of the Victor you need a true RMS meter, and if you want to plot Victor PWM input against motor speed, the motor must be fully loaded to get the most accurate result.

The duty cycle, and therefore the RMS output of the Victors is linear with the input PWM values. The thing you are really controlling when you vary the PWM command to the Victor is not the speed of the motor, you are controlling its torque (rotational force). The resulting speed from that torque depends on the load.

Last edited by KenWittlief : 02-04-2006 at 23:30.
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
Scaling algorithms rhobincu Computer Graphics 1 10-10-2005 13:25
VEX 2005 = Mini FRC 2004 Joe Johnson FIRST Tech Challenge 12 08-04-2005 17:22
Example gyro code released. Kevin Watson Programming 60 17-03-2005 18:32
Scaling Values in the Control Program archiver 2000 15 23-06-2002 22:24
Scaling on motors Jeff Waegelin Motors 2 13-01-2002 23:07


All times are GMT -5. The time now is 09:22.

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