Car is running know. I only need to tweak some timings.
When i change the speed of forward or reverse, sometimes the ESC isn’t responding on reverse anymore.
Is use the following timings:
Where you able to find a datasheet or wave diagram or more details (i.e. forum post) on your ESC cmds?
It smells like it could be similar issue with this http://www.tinyclr.com/forum/1/2830/
If you interrupt the current signal for a new signal, depending on time, it can mean something else to the servo/controller. May also be a good excuse to invest in a logic prob http://www.sparkfun.com/products/8938
2)Not sure on the dist sensor thing. When I have a question like that, I get both :-). Use the other one for something else, like reverse or other project.
Forward to reverse often requires you to ramp between the two - for instance, setting full forward to full reverse may make the ESC assume the signal is not good. Try setting to 0 then pause (insert appropriate time here) and then move to reverse.
Based on this info, not sure where your Direction stuff is coming from?
// huh? What is timing_direction?
timings[0] = timing_direction; // timing_forward or timing_reverse or timing_stop
timings[1] = (100 - speed) * 1000;
oc.Set(true, timings, 0, 2, true);
It would seem to be more like:
uint fullReverse = 900;
uint fullForward = 2100;
uint neutral = 1500;
timings[0] = fullForward;
timings[1] = 20000; // at least a 20ms low time. Could also use a subtraction to get 20ms total high/low, but may not be needed.
oc.Set(true, timings, 0, 2, true);
Also remember, you can hook the signal pins direct to hw PWM pins to do this in hw instead of OC. You could also ask them if the period is indeed 20ms as we are assuming here. AFAIC, the period is not much important as high time is the critical factor as long as your at least 20ms period. But never know from vendor to vendor if something is critical. Also, if you concider sw OC variables such as scheduling, random GC, etc - you could have some spuratic ESC behavior.
The description does not really change anything in terms of driving the pwm afaict. I does, however conflict with what they told you in other email a bit. They said 900-1500 range. This says 1000 - 2000 range.
The one thing I might try is reduce 20000 to 15000 in the code. It looks like 20ms is upper bound so I would try something more in the middle of their required range. Does that change anything?
If not, I would try a real pwm pin before doing much more diag on current method. If that not work either can beg or borrow a logic analyser like a Saleae Logic to inspect how it works when controlled from RC hookup?
Don’t know if it helps, but some RC controlleres need full throtle and then full stop on startup. This is how they know full range. Maybe you need to do that in code?
I tried a couple of GPSes, but the one I was most happy with was the LS20031.
Regarding motor controllers, spare yourself the trouble and buy a pololu one - they’re really easy to interface with :). (One pwm pin which goes duty 0 - 100% (CMOS), and two control digital CMOS inputs for controlling direction/braking)
If you want to, I can send you the source for my project, it should work for you out of the box. Just plug a GPS, IMU (Or use gps data) and the motor controller.
I like the pololu stuff. But for $50 plus s/h, I think he should be able to get his existing stuff running. Did you try the 15000 in code? No effect? Any work on getting a logic prob from a friend? If all else fails, for the cost of SH back and forth, I could take a look at it.