I've been trying to wrap my head around how this feedback system will work, at the simplest...
And somewhere in there I got lost with a *really* complicated scheme.
And then it finally hit me...
The deal, again, is there are two motors, one physically moves the drill up and down, the other provides the feedback through the lever.
Both motors have positional-encoders attached.
Let's neglect the fancy features, such as using the lever-motor to act as a "return-spring" and also accounting for gravity...
So, instead, in this really simple case, we basically have two unloaded motors (maybe the lever rotates horizontally, rather than vertically).
Then it can be quite simple...
The drill-positioning motor ('d') will have a simple function... something like:
PWM_d = (DesiredPosition_d - ActualPosition_d) * SomeConstant_d
The lever-motor ('l') will have a similarly simple function... something like:
PWM_l = (DesiredPosition_l - ActualPosition_l) * SomeConstant_l
(actually, they're identical)...
Then the two will be linked something like:
DesiredPosition_d = ActualPosition_l * SomeConstant_dl1
DesiredPosition_l = ActualPosition_d * SomeConstant_dl2(is that right? They're identical, again?!)
So, if I've got this straight, imagine two motors with no load on 'em at all...
(they're horizontal, no gravity, etc.)
Also, for now, imagine all the constants to be 1.
Doesn't matter which motor is which.
When you power 'em up, each motor's Desired and Actual positions will be identical (0), so their PWM values will be 0, causing no motion.
When you try to spin one by hand, it will attempt to hold its original position by upping the PWM power in the opposite direction of your spinning.
But your spinning of one motor has also changed the "DesiredPosition" of the other motor, so the other motor will up its PWM power, in the same direction of the spinning.
There's an inherent "lag" with PWM and motors... due to static-friction, etc. A *tiny* PWM-value won't actually cause the motor to spin. So, the other motor won't actually spin, immediately.
Thus, the DesiredPosition of the lever-motor won't be changed, and there will be a slight resistance felt when rotating the lever, as it attempts to hold its previous position.
But, at some point, when the lever's turned far-enough, the PWM applied to the drill-positioning motor will be enough to overcome static-friction, and it will begin to rotate.
The actual-position of the drill-positioning motor will advance in the direction the lever's being turned, which will change the desired-position of the lever-motor, reducing the resistance felt at the lever.
WARNING: Get those constants wrong, and it's entirely possible, if not *likely* your lever-motor will *slam* in the direction you're turning it, once the drill-positioning motor begins spinning! Best to start with small values for the constants (like 1). And BE CAREFUL!
So, in this *really simple* case, the effect should be something like...
two pulleys with a rubber-band between 'em.
Or, in terms of a drill-press with a lever, a bit like the lever is attached to the vertical-axis via a spring.
Not ideal, sure, but definitely with force-feedback... and that's what I'm wanting to experiment with... just to see how it "feels" and maybe improve over time, or maybe not.
Of course, a horizontal-lever doesn't make too much sense, so maybe, for now, use a physical spring to return it to the upright position and to fight gravity. Maybe felt-pads to make the rotation a little less "loose"...
And the effect of gravity on the vertical-axis...? Hmmm...
Well, that will cause the actual-position of the vertical-axis to *lead* the desired-position.
And *that* will cause the desired-position of the lever to *advance*...
(Good thing I'm adding a spring to it, eh?)
I think they should settle, just as a physically-linked system would.
The effect, then, is like the weight on the vertical-axis is pulling down the lever, slightly... That's normal.
And, similarly, note the effect when the vertical-axis "hits" the material to be drilled... (but before enough pressure is applied to actually begin cutting a hole)
Assuming the axis's weight, alone, isn't enough to begin cutting...
Now the vertical-axis's actual-position will *lag* its desired-position.
And that will cause the desired-position of the lever to be opposite the actual-position, it will attempt to pull the lever back up, in the direction of the spring...
And... we'll *feel* the resistance of the material.
(again, as though the lever is attached to the axis via a spring).
CAN such a system be built wherein it's *not* as though it's attached via a spring? Probably... I think that's where a full-on PID-algorithm would come into play. That's a bit beyond this project (and my skillset), at this point, but may develop in the future. I can't quite wrap my head around how the math would work out linking the two, though... There'd probably have to be some calculus involved.
And replacing those felt-pads and return-spring with motor-control...? Meh, too much for now.