Go to Post Focus on solving the problem, not on being deliberately creative. If you effectively solve the problem, creativity is naturally leveraged as part of finding a great solution. - Jim Zondag [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 18-02-2002, 14:22
VanWEric VanWEric is offline
Registered User
#0250 (Dynamos)
 
Join Date: Feb 2002
Location: NY
Posts: 86
VanWEric is an unknown quantity at this point
One line power

I got the insane urge to eliminate if statements. Having done that, i had the urge to eliminate statements in general. The result? One line of code per track to make it flip and reverse, rescale the sticks, and ramp the speed to reduce motor wear and tear.
creepbit =creep.bit7
creep = abs(127-creep)
hold = lt
lt = (254-rt -lt *creepbit + lt)*creep/127-creep+127 min (lth-Ramp_Speed) max (lth+Ramp_Speed)
rt = (254-rt -hold *creepbit + rt)*creep/127-creep+127 min (rth-Ramp_Speed) max (rth+Ramp_Speed)
rth = rt max (254-Ramp_Speed-1) min (Ramp_Speed+1)
lth = lt max (254-Ramp_Speed-1) min (Ramp_Speed+1)
sure, it has some maintainance code before hand, but it works.
Creep is usually a wheel input. If it is full forward everything works normally. Full reverse will flip and reverse the tracks. Anything inbetween will rescale the tracks and possibly flip and reverse them too. Lastly, it will prvent motor burn. I got bored. So sue me
 


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
Sprockets and Roller Chain Models Madison Inventor 3 04-02-2003 11:51
iParts on firstcadlibrary.com Ed Sparks Inventor 3 08-01-2003 23:30
URGENT!! Need OI power brick specs for 7AM demo tomorrow!!! kmcclary Electrical 8 10-10-2002 10:56
power of globe motor with gear box? Ken Leung Motors 5 21-11-2001 13:43
Max mechanical power of motors, how is it useful? Ken Leung Motors 1 09-11-2001 14:15


All times are GMT -5. The time now is 00: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