Go to Post Once this competition is over, we should donate all of these Poof balls to daycares, elementary schools, neighbors; all the little kids. It would make us look good like, "Here's our Toys for Toddlers gift from us upstanding citizens. And we build robots." - atomikitten [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-07-2005, 17:43
EricWilliams EricWilliams is offline
Registered User
FRC #2039 (Rockford Robotics)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2001
Location: Rockford, IL
Posts: 102
EricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of light
Question Limit_Mix() Function

I understand the Limit_Mix function combines the 2 joystick values (x,y) into a PWM value - one for each side of the drive. Can someone explain to me exactly how this function works. I see the code (obviously) and understand it, but how does the mathematical side work? Also, I remember we had some acceleration problems and a cubed value of the actual joystick input would work better (between a certain range). Any help would be greatly appreciated.

Thanks,
Eric
  #2   Spotlight this post!  
Unread 27-07-2005, 20:13
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,348
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Limit_Mix() Function

Quote:
Originally Posted by Ewilliams2006
I understand the Limit_Mix function combines the 2 joystick values (x,y) into a PWM value - one for each side of the drive. Can someone explain to me exactly how this function works. I see the code (obviously) and understand it, but how does the mathematical side work? Also, I remember we had some acceleration problems and a cubed value of the actual joystick input would work better (between a certain range). Any help would be greatly appreciated.

Thanks,
Eric
Not meaning to pick apart your understanding, but Limit_Mix quite literally only limits the values passed to it to so that the returned value, to the calling function, is between 0 and 254.
The actual calculation of PWM values is done by the line that calls the Limit_Mix function. The arguments that are sent to Limit_Mix are then limited to between 0 and 254, then returned.
So, "pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);" is used to calculate for the right side motor, and " pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);" if for the left. What each of these lines do is to take the p1_Y value and add or subtract from it the p1_x value and add or subtract 127 from that. (When you add p1_x you subtract 127 and vise verse.) These are the offset by 2000 for good measure then sent to Limit_Mix. Limit_Mix limits the values and then removes the 2000 offset and returns the limited value.

Now, if you are totally confused, get out a piece of paper and right down the values with the joystick in various positions, substituting in the values for p1_x and p1_y for the various positions. It will become clear very quickly what the functions do.
  #3   Spotlight this post!  
Unread 27-07-2005, 23:19
EricWilliams EricWilliams is offline
Registered User
FRC #2039 (Rockford Robotics)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2001
Location: Rockford, IL
Posts: 102
EricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of light
Re: Limit_Mix() Function

Thank you very much. Yes, I did understand that the actual mixing was don in the calling line, I just worded it wrong. Basically you said what I already knew, but somehow I feel I understand it more now, so... Thanks.
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
TTL port to a serial port on a demo board ImmortalAres Programming 16 09-07-2005 23:44
Example gyro code released. Kevin Watson Programming 60 17-03-2005 18:32
Auton + Functions ten3brousone Programming 0 27-02-2005 20:11
RoboEmu2(code simulator)--now with C! rbayer Programming 23 17-02-2005 09:17
heres the code. y this not working omega Programming 16 31-03-2004 15:18


All times are GMT -5. The time now is 10:57.

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