Hi!lgenzelis wrote:I attached the json file corresponding to the controller configuration, because there's something odd about it. Notice that the id correponding to "althold" is the same as the id corresponding to "pitch". If I change the id (manually, from the file) to something different, the althold button doesn't do anything.

The button id numbers being the same for both pitch and althold is not an issue. The INPUT.axis and INPUT.button inputs are different and between the two, some will have the same ID. INPUT.axis correspond to your analog controls (right and left thumbs) whereas INPUT.button IDs correspond to specific buttons on your controller. For a Sony branded PS3 controller, the button IDs are as follows. I'm not sure if other brands are the same or if other controllers (ie. Xbox or PS4) are the same because I don't use those controllers. I expect all PS3 "type" controllers are likely the same but I have nothing to back that statement up!
0 = Select
1 = L3
2 = R3
3 = Start
4 = Digital Up
5 = Digital Right
6 = Digital Down
7 = Digitial Left
8 = L2 (digital mode)
9 = R2 (digital mode)
10 = L1
11 = R1
12 = Triangle
13 = Circle
14 = X
15 = Square
16 = PS
In my config, althold is mapped to the L1 button which is "10" as you can see here.
Since you're looking at the JSON file, you've probably deciphered it a bit, so you can edit the file directly. I made a copy of one and edited to my liking then called it something different (Custom_PS3.json for example). Once you've done that, make sure it's selected as the input device input map in the client. This way, you can set-up the button mapping without using the GUI.
Here's what mine looks like for my PS3 controller:
Code: Select all
{
"inputconfig": {
"inputdevice": {
"updateperiod": 10,
"name": "PS3_ECS3",
"axis": [
{
"scale": 1.0,
"type": "Input.BUTTON",
"ids": [
7,
5
],
"key": "rollcal",
"name": "rollcal"
},
{
"scale": 1.0,
"type": "Input.AXIS",
"id": 0,
"key": "yaw",
"name": "yaw"
},
{
"scale": 1.0,
"type": "Input.BUTTON",
"id": 9,
"key": "alt1",
"name": "alt1"
},
{
"scale": 1.0,
"type": "Input.BUTTON",
"id": 8,
"key": "alt2",
"name": "alt2"
},
{
"scale": 1.0,
"type": "Input.BUTTON",
"id": 12,
"key": "exit",
"name": "exit"
},
{
"scale": 1.0,
"type": "Input.BUTTON",
"id": 11,
"key": "ring_effect",
"name": "ring_effect"
},
{
"scale": 1.0,
"type": "Input.BUTTON",
"id": 14,
"key": "estop",
"name": "estop"
},
{
"scale": -1.0,
"type": "Input.AXIS",
"id": 3,
"key": "pitch",
"name": "pitch"
},
{
"scale": -1.0,
"type": "Input.AXIS",
"id": 1,
"key": "thrust",
"name": "thrust"
},
{
"scale": 1.0,
"type": "Input.BUTTON",
"id": 10,
"key": "althold",
"name": "althold"
},
{
"scale": 1.0,
"type": "Input.AXIS",
"id": 2,
"key": "roll",
"name": "roll"
},
{
"scale": -1.0,
"type": "Input.BUTTON",
"ids": [
6,
4
],
"key": "pitchcal",
"name": "pitchcal"
}
]
}
}
}
Be aware that the althold feature uses the barometer and it is not precise. Furthermore, direct sunlight on the baro can cause major fluctuations so flying by a window on a sunny day can wreak havoc on your alt-holding!
To see if the barometer is detecting changes in height, you can open a "Log blocks" tab in your client GUI and check the box next to "Baro" to log the values and check the box to log to a file as well (for later plotting if you wish). The file ends up in crazyflie-clients-python/conf/logdata. Also, open up a "Plotter" tab and select Baro to see the values graphed in real time. Do you baro values reflect the rising and falling of your Crazyflie?
Hope this helps!