In Log #5 I discussed wireless vs wired control input, and eventually decided on a simpler wired input system.
I have now assembled all the mechanical and electrical components to produce a working Joystick controlled hoverboard. Next I needed to decide on an initial motion control strategy.
My first concern was that if a fragile child would be directing the drive system, the resulting motions needed to gentle yet responsive. My first thoughts were that I needed to control acceleration and deceleration, more so than just speed or power. I also felt that the drive needed to stop more quickly than it started simply to prevent running into things.
My initial code established a strategy for applying an acceleration limit, based on target speed and elapsed cycle time. I tweaked this strategy to allow for a larger acceleration when starting movement than for stopping (eg, if the desired speed was zero, then a larger acceleration limit would be applied).
I then chose different speed and acceleration constants for the axial (fwd/rev) and yaw (left and right) motions.
Needless to say I did a lot of testing with my "make-shift" adaptive platform to get my best "initial" values.
As I was experimenting with the drive, I realized that the final version was probably going to need to be a lot slower, so I would be using a pretty small portion of the full speed range. From my experience with youth robotics teams I know that once you start dropping the voltage on motors using Pulse Width Modulation (PWM), you also reduce the torque available to the motor to overcome things like friction and inertia. So starting to move from a stopped position smoothly can be tough.
So I decided to implement closed loop control for the motor drive. This essentially means that instead of requesting a certain Power for the drive, you are actually requesting a speed (or velocity if you consider moving forward and backwards). Then, it's up to the controller to measure the speed, compare it with the requested speed, and then automatically adjust the power to make the actual match the requested. Thus the control loop is "Closed" using feedback.
I had already implemented speed measurement in the hoverboard code, but I stepped it up a notch by counting individual phase steps, rather than full phases. This gave me 90 "encoder" counts per revolution.
I then implemented a simple Proportional controller with Feed-Forward added. Testing showed that this method ensures that even if I only ask for 1% speed, I get a solid motion.
I was finally ready to try adding the Hoverboard to a REAL assistive device. The challenge was now going to be combining two mechanical systems that were never meant to be combined.