View Single Post
  #8   Spotlight this post!  
Unread 14-07-2013, 16:24
cad321 cad321 is offline
Jack of all trades, Master of none
AKA: Brian Wagg
FRC #2386 (Trojans)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Burlington, Ontario
Posts: 348
cad321 is just really nicecad321 is just really nicecad321 is just really nicecad321 is just really nice
Re: Arduino Mecanum drive using PWM?

Quote:
Originally Posted by Mike Bortfeldt View Post
My knowledge of the hardware you are using is limited, but You may also want to review your mixing algorithm as well. Again, assuming a standard servo input (1-2 ms pulse), the pulseIn should return values between 1000 and 2000 (usec). Adding all three together for FL (for example) would yield 3000 to 6000, or basically your maximum all the time.
I to realized this and based on mecanum drive code i have found and tried using Java for my team and through research for this, I am now taking all of the values and dividing by the highest or lowest absolute value if one of them is either above 2000ms or below 1000ms. I am learning this as I go and so am having my ups and downs. I have however just realized I can map my 1000 - 2000ms inputs to an equal negative - positive range such as (-255) - (255). This has helped me a great deal.

Quote:
Originally Posted by Mike Bortfeldt View Post
My guess, based on your original post of the 1 second delays, indicate that you are probably not reading at least two of the signals (Strafe & Rotate perhaps?), so you are adding zero (0) to your forward value and the calculations are doing what you expect. The 1 second delay is approximately the timeout for the default pulseIn when it doesn't see a pulse and no explicit timeout is passed.

Mike
This is exactly what was happening so I lowered the timeout value to be 30ms and it was responding virtually instantly (give or take the lag of the 30ms per input if I wasn't receiving a pulse).