Contribue joystick mappings

Discussions and questions about the Crazyflie Nano Quadcopter
allynbauer
Beginner
Posts: 12
Joined: Mon May 06, 2013 6:59 pm

Re: Contribue joystick mappings

Post by allynbauer »

beat wrote: For thrust only the upper half of the stick range can be used.
Why's that?
beat
Beginner
Posts: 4
Joined: Thu May 23, 2013 4:52 pm

Re: Contribue joystick mappings

Post by beat »

allynbauer wrote:
beat wrote: For thrust only the upper half of the stick range can be used.
Why's that?
The controller reports values between about 0x20 (right/up) and 0xE0 (left/down) on all axes. With a scale of -1 this works perfectly for pitch, roll, and yaw. For thrust, it seems the PC client does the same mapping to a signed value as for the other axes, but then only considers positive numbers as valid. All numbers reported for the lower half of the stick range (0x80 - 0xE0) are mapped to zero.
Using a scale of -1.2 stretches the upper half of the range enough to enable flying, but using the full range would allow more precise control.
An additional 'offset' option, similar to 'scale', would allow to map reported range to used range correctly in any case.
Rnold
Beginner
Posts: 4
Joined: Sun May 19, 2013 6:52 am

Re: Contribue joystick mappings

Post by Rnold »

Here are the settings for the Speedlink Strike FX. I had to reverse the Pitch (scale=-1.0). I wanted it to be compatible with my RC equipment so I swapped the pitch/roll and thrust/yaw buttons. I noticed that maximum thrust is about 80%. I set the "max thrust" to 100 in the config.json but that didn't help. Is there a way to set it at 100%?

Code: Select all

{
  "inputconfig": {
    "inputdevice": {
      "updateperiod": 10, 
      "name": "Generic_OS_X", 
      "axis": [
        {
          "scale": 1.0, 
          "type": "Input.AXIS", 
          "name": "yaw", 
          "key": "yaw", 
          "id": 0
        }, 
        {
          "scale": 1.0, 
          "type": "Input.AXIS", 
          "name": "thrust", 
          "key": "thrust", 
          "id": 1
        }, 
        {
          "scale": 0.5, 
          "type": "Input.AXIS", 
          "name": "roll", 
          "key": "roll", 
          "id": 2
        }, 
        {
          "scale": -0.5, 
          "type": "Input.AXIS", 
          "name": "pitch", 
          "key": "pitch", 
          "id": 3
        }, 
        {
          "scale": -1.0, 
          "type": "Input.BUTTON", 
          "id": 2, 
          "key": "pitchcal", 
          "name": "pitchNeg"
        }, 
        {
          "scale": 1.0, 
          "type": "Input.BUTTON", 
          "id": 0, 
          "key": "pitchcal", 
          "name": "pitchPos"
        }, 
        {
          "scale": 1.0, 
          "type": "Input.BUTTON", 
          "id": 9, 
          "key": "estop", 
          "name": "killswitch"
        }, 
        {
          "scale": -1.0, 
          "type": "Input.BUTTON", 
          "id": 3, 
          "key": "rollcal", 
          "name": "rollNeg"
        }, 
        {
          "scale": 1.0, 
          "type": "Input.BUTTON", 
          "id": 1, 
          "key": "rollcal", 
          "name": "rollPos"
        }, 
        {
          "scale": 1.0, 
          "type": "Input.BUTTON", 
          "id": 8, 
          "key": "exit", 
          "name": "exitapp"
        }
      ]
    }
  }
}
allynbauer
Beginner
Posts: 12
Joined: Mon May 06, 2013 6:59 pm

Re: Contribue joystick mappings

Post by allynbauer »

beat wrote:For thrust, it seems the PC client does the same mapping to a signed value as for the other axes, but then only considers positive numbers as valid.
Indeed. The existing client assumes several things. One is that axis values will be in the range -1 to 1. Another is that the user will be using a controller which has joysticks that 'reset' to neutral/0. Since negative thrust doesn't make much sense, it is thrown out.
beat wrote:The controller reports values between about 0x20 (right/up) and 0xE0 (left/down) on all axes.
So you are saying your controller returns axis values in the (decimal) range 32-224?
beat
Beginner
Posts: 4
Joined: Thu May 23, 2013 4:52 pm

Re: Contribue joystick mappings

Post by beat »

allynbauer wrote:So you are saying your controller returns axis values in the (decimal) range 32-224?
Yes.
The values are not exactly the same for all axes and they depend slightly on the (mechanical) trimming, but it is always about the given range.
863456346
Beginner
Posts: 16
Joined: Thu May 23, 2013 12:47 pm

Re: Contribue joystick mappings

Post by 863456346 »

Would it be possible to turn on the vibration of the controller as soon as the red LED indicates the battery is empty? This could be very useful when flying outdoors.
Smitty79
Beginner
Posts: 6
Joined: Thu May 30, 2013 9:58 pm

Re: Contribue joystick mappings

Post by Smitty79 »

Anyone tried using the Interlink Elite Controller by Futaba? It comes with the RealFlight R/C Flight Simulator.

http://www.realflight.com/interlink.html
10DOF Crazyflie, Wireless Xbox360 Controller
Raspberry Pi Base Station with ADAFRUIT INDUSTRIES RGB NEGATIVE 16X2 LCD + KEYPAD KIT
georg
Beginner
Posts: 1
Joined: Fri May 24, 2013 10:21 am

Re: Contribue joystick mappings

Post by georg »

I have obtained a Logitech F310 controller.
Successfully set it up on Ubuntu 13.04

My config file

Code: Select all

{
  "inputconfig": {
    "inputdevice": {
      "updateperiod": 10, 
      "name": "Logitech_F310", 
      "axis": [
        {
          "scale": -1.0, 
          "type": "Input.AXIS", 
          "name": "thrust", 
          "key": "thrust", 
          "id": 1
        }, 
        {
          "scale": 1.0, 
          "type": "Input.AXIS", 
          "name": "yaw", 
          "key": "yaw", 
          "id": 0
        }, 
        {
          "scale": 1.0, 
          "type": "Input.AXIS", 
          "name": "roll", 
          "key": "roll", 
          "id": 3
        }, 
        {
          "scale": -1.0, 
          "type": "Input.AXIS", 
          "name": "pitch", 
          "key": "pitch", 
          "id": 4
        }, 
        {
          "scale": -1.0, 
          "type": "Input.BUTTON", 
          "id": 0, 
          "key": "pitchcal", 
          "name": "pitchNeg"
        }, 
        {
          "scale": 1.0, 
          "type": "Input.BUTTON", 
          "id": 3, 
          "key": "pitchcal", 
          "name": "pitchPos"
        }, 
        {
          "scale": 1.0, 
          "type": "Input.BUTTON", 
          "id": 6, 
          "key": "estop", 
          "name": "killswitch"
        }, 
        {
          "scale": -1.0, 
          "type": "Input.BUTTON", 
          "id": 2, 
          "key": "rollcal", 
          "name": "rollNeg"
        }, 
        {
          "scale": 1.0, 
          "type": "Input.BUTTON", 
          "id": 1, 
          "key": "rollcal", 
          "name": "rollPos"
        }, 
        {
          "scale": 1.0, 
          "type": "Input.BUTTON", 
          "id": 7, 
          "key": "exit", 
          "name": "exitapp"
        }
      ]
    }
  }
}

Attachments
Logitech_F310.json.zip
(414 Bytes) Downloaded 280 times
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Contribue joystick mappings

Post by tobias »

Would it be possible to turn on the vibration of the controller as soon as the red LED indicates the battery is empty? This could be very useful when flying outdoors.
This is something we have also been asking. I think the problem is the gamepad driver layer which doesn't always have rumble support. Would be great to have though.
Post Reply