RCKit
|
Setter class cluster that controls 2 analog outputs based on 2 analog inputs so that a joystic can be used to control 2 motors like on a tank or bulldozer or concentric rotor helicopter. inputA controls forwars/reverse and inputB controls left/right. More...
#include <DifferentialSetter.h>
Public Member Functions | |
DifferentialSetter (Setter *targetA, Setter *targetB) | |
void | setTargets (Setter *targetA, Setter *targetB) |
virtual void | input (int value) |
virtual void | inputB (int value) |
virtual void | failsafe () |
Public Member Functions inherited from Setter | |
Setter () | |
Constructor. More... | |
Setter (Setter *target) | |
Constructor with setting the target. | |
virtual void | setTarget (Setter *target) |
void | setFailsafeValue (int failsafeValue) |
Sets the failsafeValue. | |
int | failsafeValue () |
Protected Member Functions | |
void | doOutput () |
Internal function that computes the two output vlaues based on themost recent input values. | |
Additional Inherited Members | |
Protected Attributes inherited from Setter | |
Setter * | _target |
This is the instance of Setter that will be given the transfotmed output value. | |
int | _failsafeValue |
Setter class cluster that controls 2 analog outputs based on 2 analog inputs so that a joystic can be used to control 2 motors like on a tank or bulldozer or concentric rotor helicopter. inputA controls forwars/reverse and inputB controls left/right.
A Differential is used to drive 2 motors in forward and reverse directions in response to the inputs from 2 joysticks.
It requires 2 HBridges as output: one to drive the left motor forward/reverse and one to drive the right motor forward/reverse.
It also requires 2 inputs, one for the fore-aft and one for the left-right. The 2 outputs drive 2 reversible motors that act like the motors on a tank or bulldozer, allowing forward, reverse and turning under the control of an x-Y joystick.
In general, the fore/aft input (inputA) is replicated on the 2 outputs, but if inputB varies either side of 127, outputA is increased/decreased and outputB in decreased/increased. The outputs are never permitted outside the range 0 - 255.
The standard input (inputA) to this Setter controls the forward/reverse. The left/right controls come through an instance of the DifferentialLRSetter class.
Typically the outputs would be two HBridgeSetter instances to control a pair of motors but could be ServoSetter, AccelStepperSpeedSetter or AccelStepperPositionSetter or any other combination.
|
virtual |
Called when the source of input data is lost, and the Setter is required to fail in a safe way. Calls the failsafes of targetA and targetB
Reimplemented from Setter.
References Setter::failsafe().
|
virtual |
Input the value to be used to set the 2 output Setters.
[in] | value | The fore/aft value. |
Reimplemented from Setter.
References doOutput().
|
virtual |
This is the B input, controlling left-right differential. It has to come from an instance of DifferentialLRSetter.
[in] | value | The input value to set. |
References doOutput().
Set or change the output pin
References Setter::setTarget().