Menu

#2857 AI multiple object control

2020.4
New
nobody
High
2025-02-07
2024-01-15
No

Hello, I am attempting to control my main aircraft via upd connection with Simulink while simultaneously, I would like to be able to observe other aircrafts flying along side my aircraft. I would also like to either script the position and orientation or control the motion of the other aircrafts via Simulink as well. I would like to avoid using multiplayer mode due to jittering. From what I found, one way is to create an AI scenario and its corresponding flightplan which is defined by a set of waypoints and speed. However, this method does not work as intended. My additional AI aircraft flies in a weird manner when the speed exceeds 90 Knots for some reason. Is there a way to achieve my intended task? Perhaps I can disable the FDM of the AI somehow and control its motion via Nasal? 
Thank you for your help beforehand. 

Discussion

  • James Turner

    James Turner - 2024-01-15

    Unfortunately we don't have a good way to control AI aircraft via Nasal.

    My preference would be, extend the Simulink protocol to control AI aircraft/objects position directly: this would give you full control. Should be a very small modification but does need a C++ code change.

     
  • Nezar Sahbon

    Nezar Sahbon - 2024-01-15

    Do you have any hints on how to extend it to control an AI aircraft?

     
  • James Turner

    James Turner - 2024-01-16

    I just checked and Simulink uses our 'net_FDM' protocol which is unfortunately not easily extensible to add the AI aircraft. (Uses a fixed datagram of fields, no easy/compatible way to add an array of AI object positions).

    You could in principle use the 'telnet' aka 'props' protocol to update the positions of AI objects via their /ai/aircraft[nn]/controls properties - not sure if we have a good example of this but the props are shown here:

    https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/AIModel/AIAircraft.cxx#l99
    

    This would also work from Nasal, if that's easier.

     
  • Keith Paterson

    Keith Paterson - 2025-02-07

    The current code doesn't react well to missing waypoints. It getting wonky above 90 knots gives the impression this is the case. Sadly you can't disable the AI "fdm" currently. You can how ever use scripted objects. https://wiki.flightgear.org/Scripted_AI_Objects

     

Log in to post a comment.

MongoDB Logo MongoDB