MotorCommand is just joystick position modified by MotorCompensation. Acceleration and Deceleration don't enter at all. Move the joystick quickly, and the curve will go up sharply, add the effect of motor compensation and it will be curved - rising faster (if not already vertical) when there's lots of current draw, following hand movement when there's not.
If you look very closely at your real curves from yesterday, not my drawing, you'll see that, although the horizontal (outside wheel) MotorPower line does not dip downwards, the two lines actually do curve a tiny bit at the end to join up with the final straight-ahead acceleration. Although the crudeness of my motor simulation doesn't actually let me demonstrate this, I think that the script I'm sending with this post will have a much more prominent curvature to those converging lines - but you'll have to tell me as I can't see that here.
With the script you've been using yesterday and today, the turn boost only works when speed is constant, the speed boost only works while turn rate is constant, and initial changes are exaggerated if both are changing, such as from decelerating to center stick from a fast forward curve. The new one lets turn boost work even if speed is changing, and speed boost work even if turn rate is changing, and partially evens out the difference in amount of boost when only one is changing vs. when both are changing (partially, because it's a fixed approximation to what's needed, rather than something that adjusts itself on the fly - that would be hard to code, and probably impossible for me to verify without a controller and motors).
Because there are a number of things to check out, I've added four TRUE or FALSE parameters to let you turn various behaviors on and off. They are:
- Code: Select all
SpeedBoost = TRUE
UseSpeedMixAdjust = FALSE
TurnBoost = TRUE
UseTurnMixAdjust = FALSE
and these particular TRUE/FALSE values make it behave exactly like the script you've been using. That is, there's speed boost at the start of acceleration and deceleration (as long as turn rate is 0 or otherwise constant), and there's turn boost (as long as speed is within the BoostLimit band and quite constant), but there's only the old mixing if both speed and turn rate are changing. You can turn off either or both of these by setting SpeedBoost and/or TurnBoost to FALSE, and with both of them off it will behave the way things were a few weeks ago before we started on all of this - just the mixing of acceleration and deceleration.
UseSpeedMixAdjust and UseTurnMixAdjust are set FALSE, but if you set one or both to TRUE you will get speed boost even when turning (which should be less aggressive than what you have now decelerating from a fast forward turn), and/or TurnBoost even when speed is changing (which should improve turn-in-place if the stick is not quite centered fore and aft).
My suggestion for testing is to start with these TRUE/FALSE parameters as set in the attached script, but adjust the other parameters to the values you've found most congenial in the "a" version you've been testing yesterday and today. Then change SpeedBoost and/or TurnBoost to FALSE, to see what changes with those procedures inactive, then turn them back on.
Finally, change UseSpeedMixAdjust to TRUE, leaving UseTurnMixAdjust at FALSE. Then do the reverse. Then change both of them to TRUE. Let me know how things behave in these three different conditions WITHOUT CHANGING ANY OF THE NUMERICAL PARAMETERS. If these cause problems, I may need to make coding changes before you can successfully tune the numerical settings, so I absolutely need to know what happens with these just turned on with the same parameters that were best when they were off. And, even if coding changes aren't needed, I may be able to take a look at how the various settings interact (they WILL interact) and suggest a particular order in which to make adjustments.
After checking behavior without changing values, and letting me know how that goes, feel free to adjust the values as you deem best. By now the routine should be pretty familiar (presuming there are no coding changes needed, and the interactions are manageable) -
Accel and Decel to set final acceleration and deceleration straight ahead,
PowerAccel and PowerDecel to get the initial acceleration and deceleration you want,
BoostLimit to avoid either spike or sag of acceleration just after setting out (will almost surely need to be changed when actually driving),
TurnAccel and TurnDecel during 0-throttle turn-in-place.
Then, adjust AccelMix and DecelMix to get good turn response while going at an intermediate speed.
Finally, describe what's happening as you start to accelerate into a forward turn, start to accelerate straight ahead out of a turn-in-place, start to decelerate from straight ahead into a turn, and start to decelerate from a forward turn to center stick. Any changes needed for these will have to be made in the code.
Have fun,
Lenny