Difference between revisions of "Joystick"

From PaparazziUAV
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:


A Joystick can be used to control your aircraft in the simulator or via the modem [[Subsystem/radio_control#Datalink|using radio_control type datalink]] in real flight using [[Input2Ivy]].
A Joystick can be used to control your aircraft in the simulator or via the modem [[Subsystem/radio_control#Datalink|using radio_control type datalink]] in real flight using [[Input2Ivy]].
'''Note:''' Currently (Feb 2016) [[Input2Ivy]] accesses Linux joystick drivers in a way that the sticks are read with deadband. Using [https://github.com/Grumbel/jstest-gtk jstest-gtk] shows the correct values without deadband. Having the deadband makes a flight with a quadcopter very difficult, because the micro-adjustments are not possible. Fixedwing should be fine, because it has slower dynamics. Tested with [https://github.com/opentx/opentx/wiki/OpenTX-USB-Joystick Taranis 9xd].


==Examples==
==Examples==
Line 91: Line 93:
   ...</nowiki>
   ...</nowiki>


=Virtual Joystick=
=Virtual Joystick (only for SIM targets)=


[[file:Sim_joystick.png|Virtual joystick]]
[[file:Sim_joystick.png|Virtual joystick]]

Latest revision as of 12:41, 15 April 2017

Introduction

A Joystick can be used to control your aircraft in the simulator or via the modem using radio_control type datalink in real flight using Input2Ivy.

Note: Currently (Feb 2016) Input2Ivy accesses Linux joystick drivers in a way that the sticks are read with deadband. Using jstest-gtk shows the correct values without deadband. Having the deadband makes a flight with a quadcopter very difficult, because the micro-adjustments are not possible. Fixedwing should be fine, because it has slower dynamics. Tested with Taranis 9xd.

Examples

Here a regular gaming pad, perfectly capable to control your aircraft when in manual or assisted flight

Here and example of an Joystick that looks like an RC transmitter, but is just an USB connected Joystick. Handy for quick tests, and for ER 13, why not add one to you Paparazzi toolset?

Here a real RC transmitter connected via trainer port to your PC to be used as a Joystick

Also supported are USB based Nintendo gamepad controllers useful when flying in NAV/GUIDED modes

Quick test

If plugged in, under Linux a quick test to see if the device is recognized via:

$ dmesg

Although the message is a little different for every joystick type, it should display something like this in last lines:

...
[ 8988.708567] usb 2-4.3: new low-speed USB device number 7 using ehci-pci
[ 8988.804672] usb 2-4.3: New USB device found, idVendor=0603, idProduct=1a13
[ 8988.804679] usb 2-4.3: New USB device strings: Mfr=0, Product=34, SerialNumber=0
[ 8988.804683] usb 2-4.3: Product: ART TECH GAME.  
[ 8988.808821] input: ART TECH GAME.   as /devices/pci0000:00/0000:00:06.1/usb2/2-4/2-4.3/2-4.3:1.0/input/input14
[ 8988.809007] hid-generic 0003:0603:1A13.0006: input,hidraw4: USB HID v1.00 Joystick [ART TECH GAME.  ] on usb-0000:00:06.1-4.3/input0
...

Joystick Calibration

You should always calibrate your joystick. By calibrating you make sure that your Joystick is not sending steering commanding values; while it should not when the steering sticks are in neutral position.

Linux

Install the joystick and the jstest-gtk packages via:

$ sudo apt-get install joystick jstest-gtk

Use the graphical jstest-gtk tool (or the commandline jstest) to view/edit your joystick calibration and axis/button mappings. Start it via:

$ jstest-gtk

Store the calibration

Your calibration and mapping will only be lost once you unplug the joystick, so store your configuration via:

$ sudo jscal-store /dev/input/js0

If you replug your joystick the next time, udev should take care of automatically loading the appropriate configuration.

OSX

Whether you are running on Mac OS X or Linux, the test_stick tool provides the ability to profile a joystick device.

$ ./sw/ground_segment/joystick/test_stick -h
Usage:
  ./test_stick <option> [<option>...]
Options:
  -d <string>  device name
  -h           display this help

The default device name is set to 0 if the -d option is not specified.

Here's a snippet of the tool output when a single USB enabled SNES gamepad is connected.

  $ ./sw/ground_segment/joystick/test_stick

  Available button: 11 (0xb)
  Available hats: 0 (0x0)
  Available axes: 2 (0x2)
  Axis 0 : parameters = [-32768,32768]
  Axis 1 : parameters = [-32768,32768]
  Input device name: "2Axes 11Keys Game  Pad" on SDL device "0"
  buttons 0 0 0 0 0 0 0 0 0 0 0 | hat 0 | axes -1 -1 
  buttons 0 0 0 0 0 0 0 0 0 0 0 | hat 0 | axes -1 -1 
  buttons 0 0 0 0 0 0 0 0 0 0 0 | hat 0 | axes -1 -1
  ...

Virtual Joystick (only for SIM targets)

Virtual joystick

To display this RC transmitter in a simulation session remove the default "--norc" option from the session commandline

Using the sliders you can give realtime steering input and switch modes while the aircraft flies it flightplan via the simulated flight.