4.5.3. Joystick control¶
184.108.40.206. General information¶
Controller accepts an input from an analog joystick with voltage in 0-3 V range. Voltage in the equilibrium (central) position and voltage in minimum and maximum position can be set to any value from the working range, if the following condition holds: minimum position < central position < maximum position. Controller uses digital representation of joystick input values: 0 V corresponds to a value of 0 and 3 V corresponds to a value of 10000.
To stop movement in the central position a DeadZone option is available, which is counted from the central position and measured in percent. Any joystick position inside deadzone leads to the stopping of the movement by the controller. A larger than deadzone deviation of the stick starts controller movement with the speed which is calculated from the deviation. One can reverse the joystick with a reverse flag which can be useful to keep “right joystick offset means movement to the right” correspondence for any physical orientation of the joystick and the stage.
Movement speed has an exponential dependence on joystick deviation from the center. This enables one to reach high precision through small joystick shifts and high speed through large ones. Nonlinearity parameter can be varied. If the nonlinearity parameter is zero, then the motor speed will linearly depend on joystick position.
The following graph shows dependence of movement speed on joystick position for the following settings:
|Maximum movement speed||100|
Sometimes exponential joystick response which combines high accuracy and high speed is not enough. That’s why controller supports maximum speed table. User can switch between these speeds using “right”/”left” buttons. In case of right key press maximum speed is changed from Max speed[i] to Max speed[i+1]. In case of left key press maximum speed is changed from Max speed[i+1] to Max speed[i]. Controller starts with i=0. There are 10 values in the speed array. If both integer and fractional parts of Max speed[x] are equal to zero then it isn’t possible to switch to this speed from Max speed[x-1]. This is made so that a user can limit speed array size. An attempt to get out of array bounds will also lead to nothing.
Controller has contact debouncing on control buttons. For keypress to register button press should last longer than 3 ms.
If joystick sits within dead zone for more than 5 seconds it will be logically considered to be out of deadzone only when it has been physically out of deadzone for more than 100 ms. This allows user to release joystick and to be confident that even occasional noise on joystick output won’t lead to unnecessary motor motion. While joystick is within Dead zone the controller can receive any commands from computer including motion commands, home position calibration commands, etc. If during command execution joystick is brought of Dead zone the motion command is canceled and motor is switched to joystick control. This allows the user to turn on joystick control mode and use it only when necessary.
Everything that is related to movement under the control of controller commands is also applicable to joystick movement. This includes acceleration, maximum speed limit, windings poweroff delay, magnetic brake, backlash compensation, etc. For example, if you suddenly release joystick handle and let it return into the deadzone, then, if corresponding modes are on, controller will gradually slow the motor, make a backlash compensation motion, stop the motor, fix the motor shaft with the magnetic brake, smoothly reduce current and switch off windings power.
“Left”/”right” button connection is described in Left-Right buttons control.
MaxSpeed[i] and DeadZone parameter change is described in Settings of external control devices.
220.127.116.11. Connection diagram¶
Analog inputs for joystick connection are designed for a range of 0-3V. Be careful and do not exceed voltage for joystick contacts.