Board index FlightGear Support Interfacing

Terrain elevation data interfacing with simulink

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

Terrain elevation data interfacing with simulink

Postby Mle » Mon Nov 08, 2021 7:40 am

Hello, I have used the standard blocks from simulink to interface with flight gear 3.4. Everything seems to work well, except that the received ground elevation is a constant 192. I am running the interface using the generated script. When running fg alone the elevation data is correct. Any idea how to solve this issue?
Mle
 
Posts: 2
Joined: Mon Nov 08, 2021 7:35 am

Re: Terrain elevation data interfacing with simulink

Postby jano » Mon Nov 08, 2021 12:03 pm

Hi, you can check in flightgear property tree if "/position/ground-elev-m" is the same as what you receive in simulink, if yes the net_ctrl protocol should be working fine and the problem is in simulink making the plane flight at the same altitude :), or a problem with the way this altitude is processed on external net fdm

i'm not sure it was the case for 3.4, but for a recent Fg the command line options to play with simulink when i gave a one month free try were:

Code: Select all
 --native-fdm=socket,in,30,,5503,udp
--fdm=null
--native-ctrls=socket,out,30,127.0.0.1,5505,udp


(using the net_fdm and net_ctrl blocks, the ports are to match your settings in simulink ..)
jano
 
Posts: 221
Joined: Fri Nov 30, 2007 12:32 am
Location: france
Callsign: jano
Version: git
OS: debian SID

Re: Terrain elevation data interfacing with simulink

Postby Mle » Mon Nov 08, 2021 12:43 pm

Hi thanks very much for your answer. I am still not quite sure I understand. I send to fg lat lon and alt data, and I see their effect on the altitude and position in fg. The property in fg gui is the same as the one received in simulink. I thought that the ground elevation should change regardless of the flying altitude (dependent only on lat lon data)
Mle
 
Posts: 2
Joined: Mon Nov 08, 2021 7:35 am

Re: Terrain elevation data interfacing with simulink

Postby jano » Mon Nov 08, 2021 2:10 pm

I thought that the ground elevation should change regardless of the flying altitude (dependent only on lat lon data)


yep that's the case here, i didn't notice it was a ground elevation altitude :) it can be stuck at the same altitude if you're immobile, on a very flat land or if it take the altitude on a 3d model flying at the same altitude.
here the ground altitude change in FG for a ksfo landing in external fdm, with the latest FG version compatible with simulink net_fdm (2020.3) so i can't be of much help for your case, given both the net_fdm and net_ctrl procols seems to be working.
any reason you're still using FG 3.4 ?
Last edited by jano on Mon Nov 08, 2021 7:11 pm, edited 1 time in total.
jano
 
Posts: 221
Joined: Fri Nov 30, 2007 12:32 am
Location: france
Callsign: jano
Version: git
OS: debian SID

Re: Terrain elevation data interfacing with simulink

Postby wkitty42 » Mon Nov 08, 2021 4:28 pm

it should also be noted that if anyone is running FG older than 2020.3.11 (the current Long Term Support [aka LTS] version), they should upgrade to the latest as older versions are no longer supported...

also, in the case of simulink, there may need to be some editing of the options used to start FG... especially with the newer version of FG... at least one option that i've seen used with simulink starting FG has been deprecated for a while and finally removed... what happens is that FG will not start when it sees an invalid option... the solution is to edit the bat file that simulink uses to start FG and remove the invalid option... then everything should work as it did in older versions of FG...
"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: 9161
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 22.04


Return to Interfacing

Who is online

Users browsing this forum: No registered users and 2 guests