Contribue joystick mappings

Discussions and questions about the Crazyflie Nano Quadcopter
marcus
Bitcraze
Posts: 599
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Contribue joystick mappings

Post by marcus » Thu May 02, 2013 8:07 am

Hi everyone!

Great to see that people are getting started with the kit :D

We have only been able to supply the mappings for the PS3 and XBOX360 controllers since those are the only devices we currently have. It would be great if you wanted to contribute with your device mappings for other devices so they can be included in the client by default. We are trying to compile a list of what devices are supported and on what OS. Also if there's any specific issues like using MotionJoy to get the PS3 controller working on Windows 7/8 .

If you want to contribute then either create a pull-request with the mapping on Bitbucket or attach the mapping here. Don't forget to include:
  • Device name
  • What OS you have tested on
  • If there's anything special need or it just works "out-of-the-box"
  • Rough mapping, like "Roll/pitch on left analog stick, Thrust/yaw on the right and trim on the digital key pad"
We will include the mappings and update input device page on the wiki.

Note: Currently there's a bug that makes the loading of a previous device mapping not work. So the best is to start fresh without loading anything. See this bug for more info. Also note that all the axis/buttons have to be configured to be able to save the configuration (see this issue) and that only digital buttons are supported for roll/pitch trim, app exit and emergency stop (see this issue)



Hoogle
Beginner
Posts: 1
Joined: Mon May 13, 2013 10:47 am

Re: Contribue joystick mappings

Post by Hoogle » Mon May 13, 2013 11:03 am

Hi,

After some trial and error I've figured out a PS3-controller mapping for Windows 7 and 8:
DS3-Tool needs to have the following settings under Profiles/DX-Default Playstation 3/==>Options
Image
The image-link doesn't seem to work. Therefore: http://imgur.com/dcTWTFp

Under %UserProfile%\AppData\Roaming\cfclient\input add the file PS3_Win7.json with the follwing content:

Code: Select all

{
  "inputconfig": {
    "inputdevice":
    {"name": "PS3-controller config for Win7/8", "updateperiod":10,
     "axis": [
          {"name":"Roll", "type":"Input.AXIS", "id":5, "scale":-1.0, "key":"roll"},
          {"name":"Pitch", "type":"Input.AXIS", "id":2, "scale":1.0, "key":"pitch"},
          {"name":"Yaw", "type":"Input.AXIS", "id":0, "scale":1.0, "key":"yaw"},
          {"name":"Thrust", "type":"Input.AXIS", "id":1, "scale":-1.0, "key":"thrust"},
          {"name":"Pitch Cal+", "type":"Input.BUTTON", "id":6, "scale":-1.0, "key":"pitchcal"},
          {"name":"Pitch Cal-", "type":"Input.BUTTON", "id":4, "scale":1.0, "key":"pitchcal"},
          {"name":"Roll Cal +", "type":"Input.BUTTON", "id":5, "scale":1.0, "key":"rollcal"},
          {"name":"Roll Cal -", "type":"Input.BUTTON", "id":7, "scale":-1.0, "key":"rollcal"},
          {"name":"Killswtich", "type":"Input.BUTTON", "id":14, "scale":-1.0, "key":"estop"},
          {"name":"Exit", "type":"Input.BUTTON", "id":12, "scale":1.0, "key":"exit"}
     ]}
  }
}
Start the CrazyFlie PC client and select the PS3_Win7 mapping.

I hope, someone can use this.

foosel
Expert
Posts: 175
Joined: Sat Feb 02, 2013 9:59 pm
Location: Obertshausen, Germany
Contact:

Re: Contribue joystick mappings

Post by foosel » Mon May 13, 2013 11:56 am

Here's mine for an XBox360 Wireless Controller using an USB receiver dongle -- two versions since the axis enumeration and directions seem to differentiate between Win7 and RasPi's xboxdrv (I have no idea why though):

Version for Win7

Version for RaspberryPi with xboxdrv

Mapping is as follows:
  • Left analog stick: pitch, roll
  • Right analog stick: yaw
  • Right analog trigger (shoulder button): thrust
  • Button pad: trimming for pitch and roll
  • Start: kill switch (not tested yet)
  • Back: exit app (not tested yet)
I find using the right analog shoulder trigger for regulating thrust instead of the analog stick to give me better control (since I don't have the risk of accidentally manipulating yaw when changing thrust and vice versa), but YMMV.
Last edited by foosel on Tue May 14, 2013 8:00 am, edited 1 time in total.
Image
Also: AR.Drone 2.0 (RC-enabled thanks to self-soldered MiruMod) and Hubsan X4 H107

atomicdog
Expert
Posts: 105
Joined: Tue Mar 12, 2013 2:50 am
Location: San Diego

Re: Contribue joystick mappings

Post by atomicdog » Tue May 14, 2013 4:39 am

foosel wrote:Here's mine for an XBox360 Wireless Controller (using an USB receiver dongle) on Raspberry Pi via xboxdrv:

Mapping is as follows:
  • Left analog stick: pitch, roll
  • Right analog stick: yaw
  • Right analog trigger (shoulder button): thrust
  • Button pad: trimming for pitch and roll
  • Start: kill switch (not tested yet)
  • Back: exit app (not tested yet)
I find using the right analog shoulder trigger for regulating thrust instead of the analog stick to give me better control (since I don't have the risk of accidentally manipulating yaw when changing thrust and vice versa), but YMMV.
Hi foosel,

I tried your mapping but for some reason the triggers control the yaw (but in reverse), the right joystick controls thrust by moving it right (+) and left (-). The start: kill switch and left joystick worked as described.
6-DOF CF | wireless xbox 360 controller

foosel
Expert
Posts: 175
Joined: Sat Feb 02, 2013 9:59 pm
Location: Obertshausen, Germany
Contact:

Re: Contribue joystick mappings

Post by foosel » Tue May 14, 2013 8:01 am

atomicdog wrote:I tried your mapping but for some reason the triggers control the yaw (but in reverse), the right joystick controls thrust by moving it right (+) and left (-). The start: kill switch and left joystick worked as described.
I just noticed that my mapping file for Win7 and on the RasPi are not the same and have different axis enumerations (and funnily enough also directions) for these two axes. I adjusted the post above to include both versions. I guess xboxdrv on RasPi and the Win7 driver just handle things slightly differently.
Image
Also: AR.Drone 2.0 (RC-enabled thanks to self-soldered MiruMod) and Hubsan X4 H107

atomicdog
Expert
Posts: 105
Joined: Tue Mar 12, 2013 2:50 am
Location: San Diego

Re: Contribue joystick mappings

Post by atomicdog » Tue May 14, 2013 9:04 am

foosel wrote:
atomicdog wrote:I tried your mapping but for some reason the triggers control the yaw (but in reverse), the right joystick controls thrust by moving it right (+) and left (-). The start: kill switch and left joystick worked as described.
I just noticed that my mapping file for Win7 and on the RasPi are not the same and have different axis enumerations (and funnily enough also directions) for these two axes. I adjusted the post above to include both versions. I guess xboxdrv on RasPi and the Win7 driver just handle things slightly differently.
Thanks, it works (win7 x64). It's a lot easier for me to control the thrust this way.
6-DOF CF | wireless xbox 360 controller

humblehacker
Member
Posts: 34
Joined: Thu May 16, 2013 7:42 pm

Re: Contribue joystick mappings

Post by humblehacker » Fri May 17, 2013 1:52 pm

While not a Button-Mapping per-se, I'll be tinkering around with two Arduino-based controllers- The DFRobot Wireless Gamepad 2.0 (http://www.dfrobot.com/wiki/index.php/W ... U:DFR0182)) and the Arduino Esplora (http://arduino.cc/en/Main/ArduinoBoardEsplora). The Esplora might be a bit of a stretch, but the DFRobot Gamepad is essentially an Arduino Leonardo+XBee footprint tucked into a Six-Axis form factor. The controller can be configured to send any commands one can imagine via wireless module fitting the "Bee" socket form such as XBee, BluetoothBee or RFBee.

bstott
Beginner
Posts: 25
Joined: Tue Mar 12, 2013 8:00 pm

Re: Contribue joystick mappings

Post by bstott » Sat May 18, 2013 6:02 am

Questions
1. Where are the mappings indicated and/or in what file?
2. Are they simply a config file change that is active when the CFclient application runs?
3. We can change the actions for the buttons on our particular game device to our preference?


Answers
1. Location: %UserProfile%\AppData\Roaming\cfclient\input add the file PS3_Win7.json by Hoogle
2. Yes - self deduced answer based on answer to question #1.
3. Yes - According to Foosel, above, the controller used was setup to the flyer's preferences.

--- Looks like I'm about to move Yaw off Thrust so I will stop crazy spinning into things. I think Yaw would be better paired with Pitch. Having Thrust and Roll on a control is a better pair too. This way one can get a good high speed bank going (Thrust & Roll) while Pitch & Yaw combine for turns. Would this be easy to fly?

SkyyPunk
Beginner
Posts: 14
Joined: Sat May 18, 2013 10:54 pm

Re: Contribue joystick mappings

Post by SkyyPunk » Sat May 18, 2013 11:00 pm

Configured my Ouya controller (bluetooth) and it seems to work fine in the app. My crazyflie isn't here to test with yet though :P

Win7 x64, worked out of the box. Just paired the controller over bluetooth and all seemed to just work!

Thrust: Right analog trigger
Yaw: Right analog stick
Pitch/Roll: Left analog stick
Trim: OUYA buttons
Kill: Right trigger
Exit: Left trigger

Mapping:

Code: Select all

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

beat
Beginner
Posts: 4
Joined: Thu May 23, 2013 4:52 pm

Re: Contribue joystick mappings

Post by beat » Thu May 23, 2013 5:19 pm

Hi

Here is a mapping for an E-Sky Simulator USB Remote Control device. These devices are sold in combination with software plane simulators for instance here: http://www.hobbypartz.com/e4chflsitrki.html.

Works out of the box.
Mapping: Thrust/yaw on the left stick, pitch/roll on the right stick.
Tested on Windows XP, 7/32bit, and 7/64bit.

For thrust only the upper half of the stick range can be used. An "offset" option in the mapping file would be needed to avoid that.

Mapping:

Code: Select all

{
  "inputconfig": {
    "inputdevice":
    {"name": "ESky Simulator USB Remote Control", "updateperiod":20,
     "axis": [
          {"name":"Roll", "type":"Input.AXIS", "id":0, "scale":-1.0, "key":"roll"},
          {"name":"Pitch", "type":"Input.AXIS", "id":2, "scale":-1.0, "key":"pitch"},
          {"name":"Yaw", "type":"Input.AXIS", "id":3, "scale":-1.0, "key":"yaw"},
          {"name":"Thrust", "type":"Input.AXIS", "id":1, "scale":-1.2, "key":"thrust"}
     ]}
  }
}
E_Sky.zip
E_Sky.json
(366 Bytes) Downloaded 161 times

Post Reply