Board index FlightGear Development New features

Dynamic pitch and yaw offsets for submodels

Discussion and requests for new features. Please note that FlightGear developers are volunteers and may or may not be able to consider these requests.

Re: Dynamic pitch and yaw offsets for submodels

Postby onox » Thu May 28, 2015 4:56 pm

You still need to add <random>true</random>

Btw, you have set life randomness to 0.0. That means a randomness between 0% and 100%. If you don't want life randomness then you need to set it to 1.0. (I tried to change it from "minimum life" to "deviation from average life", but the core devs vetoed that)

Also, I see you have the meters defined in the file, so you could try to replace:

Code: Select all
<x-offset>-34.225 </x-offset> <!-- 10.4319 m to ft -->
<y-offset>-29.040 </y-offset> <!-- -8.8514 m to ft -->
<z-offset> 31.004 </z-offset> <!--  9.45   m to ft -->
<yaw-offset>
  <property>/armament/phalanx/rotation-deg</property>
  <offset>0</offset>
</yaw-offset>
<pitch-offset>
  <property>/armament/phalanx/elevation-deg</property>
</pitch-offset>


with:

Code: Select all
<offsets>
    <x-m>10.4319</x-m>
    <y-m>-8.8514</y-m>
    <z-m>9.45</z-m>
    <heading-deg>
      <property>/armament/phalanx/rotation-deg</property>
    </heading-deg>
    <pitch-deg>
      <property>/armament/phalanx/elevation-deg</property>
    </pitch-deg>
</offsets>
Last edited by onox on Fri May 29, 2015 6:00 pm, edited 1 time in total.
onox
Retired
 
Posts: 431
Joined: Fri Jun 20, 2014 3:45 pm

Re: Dynamic pitch and yaw offsets for submodels

Postby Tomaskom » Thu May 28, 2015 9:19 pm

Allright, thanks :)
I have those offsets there in meters for reference from before this patch, but of course I will use the new offsets in newer stuff.
Please update the related wiki page with info on the new options if you haven't done that yet ;)
"There are no problems in the air. The only problem is hitting the ground"

Get my L-159 ALCA from the FGUK hangar. If you crash it, things gonna go boom!
User avatar
Tomaskom
 
Posts: 132
Joined: Sun Dec 02, 2012 9:03 pm
Location: Czech Republic
Callsign: OK-TomK
Version: git
OS: openSUSE (Linux)

Re: Dynamic pitch and yaw offsets for submodels

Postby onox » Fri May 29, 2015 5:59 pm

I have renamed <yaw> to <heading-deg> and <pitch> to <pitch-deg>.
onox
Retired
 
Posts: 431
Joined: Fri Jun 20, 2014 3:45 pm

Re: Dynamic pitch and yaw offsets for submodels

Postby Tomaskom » Sun May 31, 2015 5:44 pm

onox wrote in Fri May 29, 2015 5:59 pm:I have renamed <yaw> to <heading-deg> and <pitch> to <pitch-deg>.


I'm not sure if renaming yaw to heading is smart because it gets added to the aircraft orientation and does not represent real heading... But if it is properly documented and explained, I guess it will be OK.
"There are no problems in the air. The only problem is hitting the ground"

Get my L-159 ALCA from the FGUK hangar. If you crash it, things gonna go boom!
User avatar
Tomaskom
 
Posts: 132
Joined: Sun Dec 02, 2012 9:03 pm
Location: Czech Republic
Callsign: OK-TomK
Version: git
OS: openSUSE (Linux)

Re: Dynamic pitch and yaw offsets for submodels

Postby Johan G » Sun May 31, 2015 6:03 pm

It seems the word is "relative bearing", so maybe "relative-bearing-deg".[1]
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)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Dynamic pitch and yaw offsets for submodels

Postby onox » Sun May 31, 2015 6:39 pm

I choose it for consistency with <offsets> in regular model xml files.
onox
Retired
 
Posts: 431
Joined: Fri Jun 20, 2014 3:45 pm

Re: Dynamic pitch and yaw offsets for submodels

Postby Johan G » Sun May 31, 2015 6:58 pm

Ah, erm, ".../offsets/heading-deg" of course, should have seen that, sorry. :oops: Good and self explanatory (if one apply some brain cells to it...). :roll: :D
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)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Dynamic pitch and yaw offsets for submodels

Postby Tomaskom » Sun May 31, 2015 7:58 pm

Yeah, I forgot it's within the <offsets> block too... so it's fine :)
"There are no problems in the air. The only problem is hitting the ground"

Get my L-159 ALCA from the FGUK hangar. If you crash it, things gonna go boom!
User avatar
Tomaskom
 
Posts: 132
Joined: Sun Dec 02, 2012 9:03 pm
Location: Czech Republic
Callsign: OK-TomK
Version: git
OS: openSUSE (Linux)

Re: Dynamic pitch and yaw offsets for submodels

Postby Tomaskom » Mon Jun 01, 2015 12:09 pm

My first application of the aimable submodels: Working Phalanx CIWS with Bombable support and ballistic correction based on target movement prediction together with known submodel dynamics.
The red line is aiming where it predicts I will be by the time the bullets arrive.

Image


Short video showing how precise it is and how reliably it destroys a target that doesn't do much evasive maneuvers, just a simple slower turn at 420kt:
https://www.dropbox.com/s/qnt6kwewgv2i2 ... .mpeg?dl=0
(Phalanx here set to loose conditions to engage)
I'm really satisfied with the aim precision :) The orange dots are the actual submodels, the whiter ones are the particles that I tried to match closely to exhibit the same trajectory and speed. The first and last burst didn't hit me because of the turn, if I flied straight, I would get it even over that distance.
Download the video to see it in a better quality, Dropbox streaming is crap.
Last edited by Tomaskom on Mon Jun 01, 2015 9:04 pm, edited 1 time in total.
"There are no problems in the air. The only problem is hitting the ground"

Get my L-159 ALCA from the FGUK hangar. If you crash it, things gonna go boom!
User avatar
Tomaskom
 
Posts: 132
Joined: Sun Dec 02, 2012 9:03 pm
Location: Czech Republic
Callsign: OK-TomK
Version: git
OS: openSUSE (Linux)

Re: Dynamic pitch and yaw offsets for submodels

Postby Johan G » Mon Jun 01, 2015 12:40 pm

Hmm, I am starting to have the idea of having a Nasal script driven by some properties that outputs properties that could be used for animating an AA gun. This would open up the possibility to add AA guns by supplying a PropertyList XML file, an .ac file and a texture.

I guess position, slew rates and target position (or an AI/MP model index) could be some of the properties. I guess the most problematic parts are the ballistics and being able to have more than one instance.
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)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Dynamic pitch and yaw offsets for submodels

Postby Tomaskom » Mon Jun 01, 2015 1:02 pm

The Phalanx turret is animated, it is just too far to be seen. My current solution is a Nasal script implementing a class, I can easily spawn as many instances of that class as necessary, initializing it with different property bindings. There is currently some Phalanx-specific stuff included but I'm planning to make AA guns and even a ZSU-23-4 "Shilka" with a somewhat modified version of this.
Still there is some more tuning to be done, but it already takes into account terrain blocking direct visibility (or Earth curvature at large ranges) etc. Once it is finished, I could provide it to you.
And I know onox have developed something similar, but with quite different approach. I use rather slow updates and extrapolation/interpolation for the aiming, calculating the movement in x,y,z coordinates as seen from the gun's position (to easily predict movement) and then back to bearing/elevation/distance. He uses rapid updates instead, probably simply calculating bearing and elevation to target, with some smart noise filters applied.
Not sure if he has the ballistic prediction already, but his direct aim on a static or moving target was a bit better than mine AFAIK. I'm a few meters off over 2nm distance, but for the target to be hit that is still more than enough considering the dispersion.

The ballistics are a matter of submodel parameters, I got mine by gathering in-sim experimental data :
Image

With this code using short bursts:
Code: Select all
var myPos = geo.Coord.new();
myPos.set_latlon(getprop("/position/latitude-deg"), getprop("/position/longitude-deg"), getprop("/position/ground-elev-m"));
var submImpactPos = geo.Coord.new();
submImpactPos.set_latlon(getprop("/ai/models/ballistic/impact/latitude-deg"), getprop("/ai/models/ballistic/impact/longitude-deg"), getprop("/ai/models/ballistic/impact/elevation-m"));
var dist = myPos.direct_distance_to(submImpactPos);
var time = getprop("/ai/models/ballistic/sim/time/elapsed-sec");
print(dist~" "~time);

setprop("/ai/models/ballistic/sim/time/elapsed-sec", 0);


But I guess it would be possible to get the exponential time dependance from the submodel parameters directly.
"There are no problems in the air. The only problem is hitting the ground"

Get my L-159 ALCA from the FGUK hangar. If you crash it, things gonna go boom!
User avatar
Tomaskom
 
Posts: 132
Joined: Sun Dec 02, 2012 9:03 pm
Location: Czech Republic
Callsign: OK-TomK
Version: git
OS: openSUSE (Linux)

Re: Dynamic pitch and yaw offsets for submodels

Postby onox » Mon Jun 01, 2015 8:33 pm

I actually have reduced the error to almost near 0 (by using the C++ algorithm (SGGeodesy::inverse()) in SimGear for calculating the course instead of geo.Coord.course_to()) for even distance up to 3.6 km:

Image
Image
Image

There's still a little bit of jitter though because the ship pitches and rolls continuously. I'm trying to use cppbind to create Nasal bindings for SGQuat and SGVec so I can delete the Nasal matrix computation I'm doing.

Tomaskom wrote in Mon Jun 01, 2015 12:09 pm:http://www.dropbox.com/s/qnt6kwewgv2i2cc/Phalan...Correction.mpeg?dl=0.


This link doesn't work :( And I would really like to see that movie :)
onox
Retired
 
Posts: 431
Joined: Fri Jun 20, 2014 3:45 pm

Re: Dynamic pitch and yaw offsets for submodels

Postby Tomaskom » Mon Jun 01, 2015 9:05 pm

Ah there were dots left instead of a part of the URL. Edited the post to include correct link: https://www.dropbox.com/s/qnt6kwewgv2i2 ... .mpeg?dl=0
"There are no problems in the air. The only problem is hitting the ground"

Get my L-159 ALCA from the FGUK hangar. If you crash it, things gonna go boom!
User avatar
Tomaskom
 
Posts: 132
Joined: Sun Dec 02, 2012 9:03 pm
Location: Czech Republic
Callsign: OK-TomK
Version: git
OS: openSUSE (Linux)

Re: Dynamic pitch and yaw offsets for submodels

Postby Johan G » Tue Jun 02, 2015 4:16 pm

The link works now. Looks like a fun challenge. 8)
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)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Dynamic pitch and yaw offsets for submodels

Postby rastafioul » Mon Aug 01, 2016 12:49 am

Are the <x-m> <y-m> <z-m> , any x y and z also dynamic in the submodel? (tried but did not work)

And are thoses same values could also be dynamic in aircraine.xml (tried but did not work)

Code: Select all
<PropertyList>

  <path>aircrane.ac</path>
 
   <model>
         <condition>
          <property>sim/model/cargo-on-hook</property>
          </condition>
          <offsets>
         <x-m>-2.5</x-m>
         <y-m>0</y-m>
         <z-m>-10</z-m>
          </offsets>         
   </model>
<PropertyList>
Thanks to every single person who helped and/or still helping to have such a great simulator.
For those who would find any complain to do: help or shut up and buy one!
rastafioul
 
Posts: 18
Joined: Tue Feb 16, 2016 6:55 pm
Version: 2016.2.1
OS: debian

Previous

Return to New features

Who is online

Users browsing this forum: benih and 3 guests