Teensy Script
The current control scheme that I use to control the robot is very basic and uses the Arduino framework. I used the ubiquitous AccelStepper stepper control library which offers acceleration and deceleration functionality, as well as independent concurrent stepping with multiple motors (crucially important!). The pseudocode below explains the core process of stepping the motors concurrently.
loop()
{
// Read analog value of each potentiometer
targets = analogRead(SENSORS);
// Assign a target value for the motors to step towards
MOTORS.moveTo( targets * multipliers );
// All motors perform a single step towards the target
MOTORS.run();
}
Each loop iteration reads the position of all the sensors within the joystick, updates the target position for the steppers, and performs a single step towards it. Each of the stepper motor objects have different acceleration characteristics.
Additionally, the limit switches are configured as INPUT_PULLUP and prevent overextension on each joint.
Filtering
When using cheap components to drive large state changes within this system, it is important the the sensor readings are consistent and predictable. In this case, the analog voltage of the potentiometers in the controller arm are directly used to move joints quickly in an application involving close contact with people. The potentiometers I used are robust, but often noisy devices. To reduce jitter I added a 0.1 uF ceramic capacitor between the analog voltage and ground on each of the potentiometers in the controller arm. This creates a low-pass filter for the control signal.
Exponential smoothing in software
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.