Board index FlightGear Support Interfacing

Controlling FlightGear from Python

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

Re: Controlling FlightGear from Python

Postby adityarajiv » Wed Aug 04, 2021 6:03 am

databytes=str.encode(str(self.airspeed)+"$"+str(self.altitude)+"$"+str(self.heading)+"\n")
self.s1.sendto(databytes,("127.0.0.1",5500))

I am writing this code to send values to flight gear.

Input protocol file is:
Code: Select all
<?xml version="1.0"?>
<PropertyList>
  <generic>
    <input>
      <line_separator>newline</line_separator>
      <var_separator>$</var_separator>

      <chunk>
        <node>/velocities/airspeed-kt</node>
        <type>double</type>
        <format>%f</format>
      </chunk>
     
      <chunk>
   <node>/position/altitude-ft</node>
   <type>double</type>
   <format>%f</format>
      </chunk>   

      <chunk>
   <node>/orientation/heading-deg</node>
   <type>double</type>
   <format>%f</format>   
      </chunk>
 
  </input>
  </generic>
</PropertyList>


but its not changing.
I am running flight gear with fdm=external.

Please help me.
Last edited by Johan G on Wed Aug 04, 2021 7:41 am, edited 1 time in total.
Reason: Added [code] tags. They can be added manually or with the [^_ ] button above the text editing box.
adityarajiv
 
Posts: 10
Joined: Tue Jul 27, 2021 7:15 am

Re: Controlling FlightGear from Python

Postby wkitty42 » Wed Aug 04, 2021 11:13 am

can you elaborate more on "value is not being shown" and "its not changing"?

how are you looking at/for them? do you have the property tree open or are you trying to view the properties via another way? (eg: logging to a file)

what craft are you using? could it be getting in the way?

perhaps you could/should start with a brand new craft that you create... you only need the FDM, really... no modeling is necessary... it would be like you are in the UFO and should simply move based on your external FDM's input...
"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: Controlling FlightGear from Python

Postby adityarajiv » Wed Aug 04, 2021 1:45 pm

yes i am openign the internal browser and it is not showing there. But is i send the same data on a dummy server i created in the same machine the changes are visible.

Do you have any solution?
adityarajiv
 
Posts: 10
Joined: Tue Jul 27, 2021 7:15 am

Re: Controlling FlightGear from Python

Postby wkitty42 » Wed Aug 04, 2021 2:11 pm

adityarajiv wrote in Wed Aug 04, 2021 1:45 pm:yes i am openign the internal browser and it is not showing there. But is i send the same data on a dummy server i created in the same machine the changes are visible.

ok...

adityarajiv wrote in Wed Aug 04, 2021 1:45 pm:Do you have any solution?

could you answer my other questions in that post, too? it is hard to help from waaaaaay over here when no one can physically see what you are actually doing over there... collecting hen's teeth is not a fun exercise...
"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

Previous

Return to Interfacing

Who is online

Users browsing this forum: No registered users and 3 guests