How would I emulate a joystick on a touchscreen? A joystick generally has 2 directions (up/down, left / right). For each direction, probably a slider bar could be used, but do you have an example of how a operator could control both directions at the same time? Think of a x-y graph, the operator would move his finger in this graph to command 2 SAE J1939 commands.
Any help is appreciated.
Thanks,
Russell Tackett
HV-450, PV-780 emulate joystick
- rtackett
- Posts: 15
- Joined: Tue May 03, 2011 9:58 am
- ksaenz
- Enovation Controls Development
- Posts: 263
- Joined: Thu Aug 19, 2010 7:53 am
Re: HV-450, PV-780 emulate joystick
Hello Russell,
You can use the variables Touch.Current.X and Touch.Current.Y to calculate the values of the of joystick x and y positions.
If the values are 0-100% you can do somehing like this:
X-Axis = ( ( Touch.Current.X - OffsetX ) / TouchWidgetWidth ) * 100
Y-Axis = ( ( Touch.Current.Y - OffsetY ) / TouchWidgetHeight ) * 100
Where:
OffsetX = The X position of the touch widget on the screen.
TouchWidgetWidth = The Width of the touch widget.
OffsetY = The Y position of the touch widget on the screen.
TouchWidgetHeight = The Height of the touch widget.
Regards,
ksaenz
You can use the variables Touch.Current.X and Touch.Current.Y to calculate the values of the of joystick x and y positions.
If the values are 0-100% you can do somehing like this:
X-Axis = ( ( Touch.Current.X - OffsetX ) / TouchWidgetWidth ) * 100
Y-Axis = ( ( Touch.Current.Y - OffsetY ) / TouchWidgetHeight ) * 100
Where:
OffsetX = The X position of the touch widget on the screen.
TouchWidgetWidth = The Width of the touch widget.
OffsetY = The Y position of the touch widget on the screen.
TouchWidgetHeight = The Height of the touch widget.
Regards,
ksaenz
- CustomFP
- Posts: 41
- Joined: Thu Mar 22, 2012 4:12 pm
Re: HV-450, PV-780 emulate joystick
Hello,
I have implemented this after talking to Russell, but I am having an issue with Hysteresis. The "joystick" is working fantastically (with great precision) in either direction, however if you change direction you must "move" around 40 pixels before Touch.Current.Y actually changes. Is there any way to remove/reduce this limitation?
Thanks,
I have implemented this after talking to Russell, but I am having an issue with Hysteresis. The "joystick" is working fantastically (with great precision) in either direction, however if you change direction you must "move" around 40 pixels before Touch.Current.Y actually changes. Is there any way to remove/reduce this limitation?
Thanks,