Axis not setting using setState | Connect API V2

Hello, as the title suggests, I am having issues with setting axis (pitch, roll, yaw and throttle). I am coding in python and I have a function which packs all the data and returns the data to which I send to IF

For example:
b'\xcb\x02\x00\x00\x01\x00\x00 \xc1'

When I decode this I get:
b'\xcb\x02\x00\x00' = 715

b'\x01' = True

b'\x00\x00 \xc1' = -10.0

In this example, I am sending a setState request to IF for the following state: {'code': '715', 'dataType': '2', 'name': 'aircraft/0/systems/axes/yaw'} with the value of -10.0, the aircraft is a Ryan air B737-800. I do check the manifest each time to ensure I have got the correct code.
Note: The setState does work with for example: aircraft/0/systems/flaps/state and the other ones which you can set the state with.

If you know why then please do let me know.

Thanks,
Robin

If you’re sending this as a float or double, it won’t work. The API needs a 32-bit integer.

10 is a very small change, sending 1000 will make it more obvious if there’s been a change.

Make sure you wire up your controls correctly in Infinite Flight, under Settings > General

2 Likes

Hello, so when I was trying to set the pitch to 1000, I noticed there were 2 options in the manifest,
aircraft/0/pitch & aircraft/0/systems/axes/pitch

Which one of these should I use? Also in the manifest, it says both of these options have a data type of 2(float), but either way i tried using a data type of 1(int) and it doesn’t work, I know for sure the code is correct and I am doing a 32-bit integer of 1000 which comes out to be b'\xe8\x03\x00\x00'.

I can connect fine, it is just setting the axis, all other states work fine.

So if you know what is wrong then please do let me know.

Thanks,
Robin

Neither :) You’re looking for api_joystick/axes/0/value.

Let me add some more info: For this endpoint, you need to tell Infinite Flight to ignore the tilt input from the device, and listen to the input from the API. You do this by going to Settings > Controls, and selecting an axis. In your case “pitch”. Tap on Pitch [X%] Accelerometer. The app will now switch to the API for pitch input if you send a pitch command. Try sending your 32-bit little endian now.

1 Like

Ah ok, thanks this works now.

Thanks again :)
Robin

1 Like