Board index FlightGear Support Interfacing

Arduino - Python - FG in/out - status LED's Win7/10

Connecting two computers, using generic protocol, connecting with Matlab?

Re: Arduino - Python - FG in/out - status LED's Win7/10

Postby Volador » Thu Dec 17, 2020 8:56 pm

wkitty42 wrote in Wed Dec 16, 2020 10:49 pm:i think if it says "display" in it, it is read-only but i'm really guessing at that... to me that means writing to /autopilot/settings/alt-display-ft is incorrect... there's gotta be another one to write to to set your desired target altitude in the AP...


autopilot/settings/alt-display-ft

is the only property that changes when the ALT dial is turned (interface disconnected) both in the property inspector and in the cockpit display. Only when VS ot FLCH are pressed does autopilot/settings/altitude-setting-ft update to match autopilot/settings/alt-display-ft and continues to match after a very short delay if alt-display is changed further
User avatar
Volador
 
Posts: 1140
Joined: Tue Sep 01, 2020 4:58 pm
Callsign: Volador, G-VLDR
Version: 2020.4
OS: Windows 10, 64 bit

Re: Arduino - Python - FG in/out - status LED's Win7/10

Postby wkitty42 » Fri Dec 18, 2020 2:15 am

Volador wrote in Thu Dec 17, 2020 7:23 pm:...just a thought, if the property is listed in FG as a double and I'm outputting an int (d) from the xml definition will that cause issues?

it could, yes... AFAIK, you need to use the proper format so i would change it to a float in your stuff and see if that helps...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Arduino - Python - FG in/out - status LED's Win7/10

Postby Volador » Sun Dec 20, 2020 3:26 pm

Hi wkitty and the collective,
I changed big value variables like Alt target indicated alt and VS to float (doubles) in the output .xml and set them as double in the arduino code but this didn't make any difference that I could detect. I thought that perhaps I was approaching saturation of the input buffer/speed etc on the arduino as I progress and test I'm adding more variables to the output xml so I increased the baud rate to 192000 and reduced the frequency of transmissions to 8Hz - the reduction in frequency alone did impact the FPS and when VS was engaged the hit was not as bad but it still points to a conflict I can't see.

Further investigation studying the property instrumentation/afds/settings/flch-mode I noticed that without the interface, pressing VS made this true or false but with the interface connected FG was not updating this boolean internally for some reason unlike the interface button for FLCH which, once pressed does cause FG to update instrumentation/afds/settings/flch-mode internally. I'm coding the interface to force this update to the boolean for the VS operation condition.

As for all the floats or doubles I set all these back to integer and in the process I did spot an error in my input.xml for display altitude (where I'd included a character as a start marker where it wasn't needed) which probably wasn't helping.

Conclusion at this point, VS is still a source of frame hit when triggered from the interface so I'm going to observe the property changes under no interface conditions then duplicate these in the code.

Just a reminder to other windows interface builders, having two arduinos overcomes the com port limitation, one can be set to input the other to output and using Wire or SoftEasyTransfer you can actually update variables across the two (for things that FG updates internally that need checking against any current variable values)
User avatar
Volador
 
Posts: 1140
Joined: Tue Sep 01, 2020 4:58 pm
Callsign: Volador, G-VLDR
Version: 2020.4
OS: Windows 10, 64 bit

Re: Arduino - Python - FG in/out - status LED's Win7/10

Postby Volador » Tue Dec 29, 2020 8:32 pm

Update: I've managed to get VS to behave by comparing the indicated Alt and the target alt - the clever 747 autopilot switches to FLCH when within 500ft of the target alt but I've had to replicate this in the code and it seems to be working so far although it is now not possible to enable VS mode when in Alt Hold mode, I have to change the target Alt to be outside the range of indicated alt+/-500 - there is a bool for 'FLCH enabled' which I thought could be used to test for the condition (if that makes any sense to the reader) but it does not seem possible. Anyway, also to improve the fps I'm now running both arduinos at 56000 baud and that seems to be having benefits for the fps.
Next challenge will be the SPD and THR buttons, Tikibar suggested that just changing the value of the thrust mode would not be enough in all circumstances due to Nasal stuff going on under the hood, so I'll have to test and report back.
User avatar
Volador
 
Posts: 1140
Joined: Tue Sep 01, 2020 4:58 pm
Callsign: Volador, G-VLDR
Version: 2020.4
OS: Windows 10, 64 bit

Re: Arduino - Python - FG in/out - status LED's Win7/10

Postby Volador » Fri Apr 02, 2021 7:45 pm

User avatar
Volador
 
Posts: 1140
Joined: Tue Sep 01, 2020 4:58 pm
Callsign: Volador, G-VLDR
Version: 2020.4
OS: Windows 10, 64 bit

Previous

Return to Interfacing

Who is online

Users browsing this forum: No registered users and 3 guests