Board index FlightGear Support Flying

Simple Circle Orbit for AI Flightplan

Controlling your aircraft, using the autopilot etc.

Simple Circle Orbit for AI Flightplan

Postby Stevenj279 » Thu Aug 27, 2020 10:26 pm

I'm simply trying to place a small AI UAV (ATI-Resolution) in a constant circular orbit at a very slow speed - 25 ktas - covering about a 3 km diameter. Since there's no built-in orbit setting or hold that I'm aware of, any suggestions would be helpful... I don't need it to fly from or to anywhere before or after, just stay in a circular orbit (using, I assume, the <repeat> setting). I'm not using any nav aids, just simple coordinates for the waypoints.

So far, trying to get it to do this has been very difficult, since there's apparently no way to force the aircraft to fly over each waypoint.

Also, as I understand it, the aircraft will jump to whatever the nearest waypoint is, completely disregarding the next in line. This makes it difficult, to say the least...

For flight planning purposes, it might be of value to look into addressing this as an improved capability in the future (I'd try, but the architecture is still far beyond my current coding skills). What would be nice:

1. Allow for a setting to "Fly By" or "Fly Over" set waypoints (most flight sims have this).
2. Add a few simple flight patterns, such as "Orbit", "Figure-Eight", "Racetrack", with the user entering the necessary coordinates, speeds, altitudes, whether left/right hand turns, etc., based on the type of pattern needed.

It would certainly help with flight planning immensely!
Last edited by Stevenj279 on Thu Aug 27, 2020 10:47 pm, edited 1 time in total.
Williamsburg, VA
Win 7 Pro 64-bit, Intel Core i7-4700MQ 2.40 GHz
32 Gb Ram, 500 GB SSD, 2 TB SCSI HDD, NVIDIA GeForce GTX 780M
Stevenj279
 
Posts: 47
Joined: Fri Jul 24, 2020 12:26 am

Re: Simple Circle Orbit for AI Flightplan

Postby Johan G » Thu Aug 27, 2020 10:40 pm

I guess there are two or three ways:

  • Set an autopilot to keep a constant airspeed, bank angle and altitude (this will drift quite a lot, probably even without any significant wind).
  • Add several waypoints around the intended circle (this will become a somewhat rounded polygon).
  • Create an autopilot that will mostly keep a constant airspeed, bank angle and altitude but will adjust the bank angle to try fly over the waypoins (this will take much more effort, and a deeper dive into Nasal and/or property rules).
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 6036
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.2
OS: Windows 10, 64 bit

Re: Simple Circle Orbit for AI Flightplan

Postby Stevenj279 » Thu Aug 27, 2020 11:41 pm

Thanks Johan - The Nasal code route is beyond me right now...

For the first autopilot suggestion, I'm using an AI platform. Building an autopilot might be do-able, but the documentation refers to the aircraft's name-set.xml file, which is not used for just AI platforms (not sure if this can be done).

For the polygon, I've had well over a dozen points and different shapes, but trying to space them so that the last waypoint isn't closer than the next (FG idiosyncrasy?) tends to pose problems, particularly since the platform will not fly directly over the waypoints (also difficult if not impossible to know at what point the platform decides to begin its turn for the next waypoint, unless someone knows these parameters). I've drawn up mission plans for real world strike packages, so I understand the concepts...
Williamsburg, VA
Win 7 Pro 64-bit, Intel Core i7-4700MQ 2.40 GHz
32 Gb Ram, 500 GB SSD, 2 TB SCSI HDD, NVIDIA GeForce GTX 780M
Stevenj279
 
Posts: 47
Joined: Fri Jul 24, 2020 12:26 am

Re: Simple Circle Orbit for AI Flightplan

Postby Johan G » Fri Aug 28, 2020 2:22 am

Stevenj279 wrote in Thu Aug 27, 2020 11:41 pm:For the first autopilot suggestion, I'm using an AI platform.

Oh, I see. I did not consider that this was for an AI flight plan. You can disregard most of the suggestions above, they are for regular piloted aircraft.

For an IA I am quite unsure how to do anything but the AI flight plan. Sorry. :(

It would be really nice if AI aicraft could loiter in perfect circles and racetracks, and maybe even eights though.
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 6036
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.2
OS: Windows 10, 64 bit

Re: Simple Circle Orbit for AI Flightplan

Postby Stevenj279 » Fri Aug 28, 2020 3:37 am

It would be really nice if AI aicraft could loiter in perfect circles and racetracks, and maybe even eights though.


Indeed! One would think something like this would be relatively simple, compared to FG's overall impressive capabilities. I just don't know how to even try to implement such things without looking at something to compare it to.
Williamsburg, VA
Win 7 Pro 64-bit, Intel Core i7-4700MQ 2.40 GHz
32 Gb Ram, 500 GB SSD, 2 TB SCSI HDD, NVIDIA GeForce GTX 780M
Stevenj279
 
Posts: 47
Joined: Fri Jul 24, 2020 12:26 am

Re: Simple Circle Orbit for AI Flightplan

Postby Thorsten » Fri Aug 28, 2020 7:01 am

The old AI tankers had the option to fly a circular orbit (two of the three demo tankers actually did), so the capability seems to be there.
Thorsten
 
Posts: 11748
Joined: Mon Nov 02, 2009 8:33 am

Re: Simple Circle Orbit for AI Flightplan

Postby Johan G » Fri Aug 28, 2020 9:55 am

Note: All links go to the latest commit by the time of this post.

Oh yes the tankers. I recall they do at least racetrack orbits quite well, and if the circular orbits are still there that should be a lot closer.

The property list file configuring the tankers, fgdata/AI/tankers.xml mentions a property, /sim/ai/tankers/tanker/pattern-length-nm, that set the length of the racetrack orbit (default is 50 NM). I would guess that circular orbits are made by shortening that length to a proper amount.

Unfortunately, not being all that familiar with the code base, I am unable to find out if the racetrack orbit is just a holding pattern or how wide the racetracks are (though for a regular tanker I feel I can somewhat safely assume it is a 4 minute/turn at 250 kt, which should amount to a width of about 5.3 NM). I would guess that the full answer hides somewhere in flightgear/src/AIModel/.

Edit: It seems the magic happens in fgdata/Nasal/tanker.nas.

Edit 2: Full name of the pattern-length-nm property from tanker.nas.
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 6036
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.2
OS: Windows 10, 64 bit

Re: Simple Circle Orbit for AI Flightplan

Postby Thorsten » Fri Aug 28, 2020 11:08 am

No, tanker.nas is the new Nasal-driven interactive tanker - we had AI tankers before that which were flying round in circles - I rememver well trying to catch one with the SR-71 without any success... the tankers are probably removed since we have the AI tanker, but the capability is probably still in the AI system.
Thorsten
 
Posts: 11748
Joined: Mon Nov 02, 2009 8:33 am

Re: Simple Circle Orbit for AI Flightplan

Postby Stevenj279 » Fri Aug 28, 2020 3:48 pm

The property list file configuring the tankers, fgdata/AI/tankers.xml mentions a property, /sim/ai/tankers/tanker/pattern-length-nm, that set the length of the racetrack orbit (default is 50 NM).


I saw that too, but it appears to be ignored and no errors are thrown if you try to include it in the xml file. Went into the Browse Internal Properties, followed the path /sim/ai/tankers/tanker/, but that option is not listed.

but the capability is probably still in the AI system


Also ran the refueling scenario (FG 2020.1.3) and checked the /ai/models/aircraft/orientation for the tanker info while it was running. No such property exists, so I suspect it is AWOL?

I looked at the tankers.xml flightplan and noted that it's merely 2 waypoints, repeated in sequence 3 times and the scenario with "ESSO 2" ran without problems. For giggles, I chose 2 waypoints in my flightplan that were about 1 km apart, repeated them as the tankers did, but immediately upon reaching the 2nd waypoint, the aircraft makes a very slight turn, then heads off into the sunset. It totally ignores going back and forth as would be expected. It is flying only at 40 ktas, so there shouldn't be a position update issue. I essentially followed the tankers.xml example explicitly, just had different coords - I have no earthly idea why it is doing this.

Wondering if there's a minimum separation distance between waypoints that's not mentioned anywhere...

Edit: Just modified the flightplan to give a 1 nm separation between waypoints - still no joy...platform heads off to greener pastures right after it reaches the 2nd waypoint...
Williamsburg, VA
Win 7 Pro 64-bit, Intel Core i7-4700MQ 2.40 GHz
32 Gb Ram, 500 GB SSD, 2 TB SCSI HDD, NVIDIA GeForce GTX 780M
Stevenj279
 
Posts: 47
Joined: Fri Jul 24, 2020 12:26 am

Re: Simple Circle Orbit for AI Flightplan

Postby wlbragg » Fri Aug 28, 2020 5:34 pm

Make sure your understanding how the AI flight plans work. I believe the AI code that is driving this looks at waypoints and does a lot of interpolation between points. Thus your points wont necessarily be where you think they should be. You have to anticipate what the interpolations going to do and set points accordingly. I did a touch and go Scenario for an AI aircraft and if I tried to set the waypoints exactly where I wanted the aircraft to go, it didn't work. We're talking about elevations here but it's the same principal.
For example I set waypoint elevations at ground level over the runway and that left the aircraft to high when over the runway. I believe I had to set the points on the runway to below the surface to get it to be close to a touch and go. You need to do this for turns just the same.
That's about the best I can explain this.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5769
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Simple Circle Orbit for AI Flightplan

Postby Stevenj279 » Fri Aug 28, 2020 5:54 pm

wlbragg You have to anticipate what the interpolations going to do and set points accordingly


Fully understood, but not knowing what's under the hood as related to how the interpolations work is kind of like continuing to throw "stuff" against the wall to see what will stick...

If I create a circular orbit with umpteen waypoints, it will follow them up to a point, but somewhere in the mechanizations of the code, it results in a disregard for what has been input for the flightplan. It seems to most always happen at a particular point, so I've toyed with the idea of putting some kind of marker (3d model) as a static entity at waypoints at their set altitudes to see, at least visually, what's going on and guess from there.

I understand the elevation example you used, particularly for touch and goes, since there's likely an error value in the underlying terrain elevation of the scenery files, which most likely varies from area to area. What I'm doing is just keeping the AI platform at a set altitude (agl) above the waypoints (ca. +1,200 feet above the highest waypoint in the plan). That way there's no interpolating the differences in terrain elevation.

For what seems like a relatively simple process, something, somewhere lurks in the dark to make a mess of our plans... ;-)
Williamsburg, VA
Win 7 Pro 64-bit, Intel Core i7-4700MQ 2.40 GHz
32 Gb Ram, 500 GB SSD, 2 TB SCSI HDD, NVIDIA GeForce GTX 780M
Stevenj279
 
Posts: 47
Joined: Fri Jul 24, 2020 12:26 am

Re: Simple Circle Orbit for AI Flightplan

Postby wlbragg » Fri Aug 28, 2020 6:55 pm

since there's likely an error value in the underlying terrain elevation of the scenery files

No, I don't think so. I think it is that the point prior to the ground elevation point is say 500ft at -500yds, then 0ft at 0yds, then back to 500ft at +500yds.
I think what the code does is look ahead and smooths that path to look like 500ft at 500yds, then rounds the 0ft at 0yds to something other than 0 in anticipation of the next 500ft-500yrd point. Otherwise you get a V instead of a smooth curve. We think it should round from -500 to 0 and then again from 0 to +500, but I think it is rounding the entire path at the same time. You wouldn't get what you want if it only looked -500 to 0 and then 0 to +500 either, they would be straight lines, you have to look at all three to get any curve.
Does that make sense?
I guess to be sure someone needs to look at the code and see exactly whet it is doing. But my understanding is what I am so poorly trying to explain above.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5769
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Simple Circle Orbit for AI Flightplan

Postby Stevenj279 » Sat Aug 29, 2020 2:21 am

No Sir - I understand what you mean, at least the mechanics of it. I can manually calculate the turn radius, time and distance in a turn to fly to the next waypoint based on known parametrics (speed, bank angle, etc.) whether flying directly over a point or using an offset value. Since we're talking about a sim, I know there's many other variables involved - the higher the fidelity, the more complex the computations involved. I guess knowing the underlying framework of what FG is doing is a start, then understanding the variables within that can/will affect the outcomes is needed. Granted, this is not a Level IV sim, so some uncertainty is expected.
Williamsburg, VA
Win 7 Pro 64-bit, Intel Core i7-4700MQ 2.40 GHz
32 Gb Ram, 500 GB SSD, 2 TB SCSI HDD, NVIDIA GeForce GTX 780M
Stevenj279
 
Posts: 47
Joined: Fri Jul 24, 2020 12:26 am

Re: Simple Circle Orbit for AI Flightplan

Postby gooneybird » Sat Aug 29, 2020 6:43 am

If you want a simple circular orbit you could adapt this, it should still work with the latest FG.
It's an old experiment of mine using the old tanker scenario that places 3 aircraft circling over TNCM but can easily be moved by altering the Lon/Lat etc.

Code: Select all
<?xml version="1.0"?>

<PropertyList>

   <scenario>
      <name>Formation of 3 aircraft circling</name>


      <description>
    Formation of 3 aircraft circling over TNCM
      </description>

      <entry>
         <callsign>ESSO2</callsign>
         <type>tanker</type>
         <class>tanker</class>
         <model>AI/Aircraft/A380/388-Thai.xml</model>
         <latitude>18.047964</latitude>
         <longitude>-63.059008</longitude>
         <altitude>6000</altitude>
         <heading>020</heading>
         <speed>180</speed>
         <roll>-15</roll>
      </entry>

      <entry>
         <callsign>ESSO3</callsign>
         <type>tanker</type>
         <class>tanker</class>
         <model>AI/Aircraft/A380/388-Thai.xml</model>
         <latitude>18.048076</latitude>
         <longitude>-63.060536</longitude>
         <altitude>6050</altitude>
         <heading>020</heading>
         <speed>180</speed>
         <roll>-15</roll>
      </entry>

      <entry>
         <callsign>ESSO1</callsign>
         <type>tanker</type>
         <class>tanker</class>
         <model>AI/Aircraft/A380/388-Thai.xml</model>
         <latitude>18.046567</latitude>
         <longitude>-63.059162</longitude>
         <altitude>5950</altitude>
         <heading>020</heading>
         <speed>180</speed>
         <roll>-15</roll>
      </entry>

   </scenario>

</PropertyList>
gooneybird
 
Posts: 3005
Joined: Sat May 31, 2008 1:57 pm

Re: Simple Circle Orbit for AI Flightplan

Postby Hooray » Sat Aug 29, 2020 9:31 am

It would be straightforward to use a piece of Nasal code to invoke geo.nas and create arbitrary circular flight patterns, which is also how the following screen shot was created:

Image

Furthermore, you could make some parameters configurable - i.e. center of the circle (lat/lon), radius/diameter, and number of segments (a circle having 360 degrees, you'd want to use a coarsely-grained flight plan, depending on the speed of the aircraft in question (turnrate), but also on the diameter of the circle).

Also note that this is very much overlapping with a standard DME arc - so the requirements are very much overlapping here. And it could be a fun little exercise to create a simple UI dialog that shows a wizard to walk people through setting up such AI flight plans - which could then either be scripted, or be dumped to standard XML flight plans.

None of this is rocket science, and we have a all the docs and tutorials that you'd need to tinker with this.

A simple UI wizard can also be implemented using Nasal and Canvas, in fact another contributor implemented a whole add-on like that:

http://wiki.flightgear.org/Howto:Implem ... GCA_system
Image

Finally, you obviously don't need to use any Nasal coding for this, you can also run the same computations "offline" and then use the results inside your XML flight plan.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11977
Joined: Tue Mar 25, 2008 8:40 am

Next

Return to Flying

Who is online

Users browsing this forum: YandexBot [Bot] and 1 guest