Re: [Flightgear-devel] collision avoidance
On Monday 12 June 2006 07:15, Mick - wrote: Through observation, I found that my calculated agl value (as discussed in my previous post) was close to that of /position/ground-elev-ft when using the current lat/lon values instead of those from Point3D calc_gc_lon_lat( const Point3D orig, double course, double dist ). I did this in an attempt to compare against the /position/ground-elev-ft value. The resulting value was close but not the same. Having converted between feet and meters, and degrees and radians for the purpose of the calculations, would this have resulted in the slight difference in value? Ok, what is 'slight' in that case? With my limited avionics knowledge, I assumed that: (altitude-ft - ground-elev-ft) = altitude-agl-ft. Again, this is something I want to verify instead of assuming. So is it (somewhat) correct to assume that subtracting the current altitude from my calculated agl would give me the the altitude-agl-ft? That should be ok. Anyway, I have attached the quick hack that I used to test that and the past material changes. That might serve as a starting point for you. It takes the aircraft's position (not the view position!) does an additional ground query at that location and computes an additional location 10 meters away in the direction of your view. There is also an additional ground query. Both are printed to stdout ... Hope that helps Greetings Mathias -- Mathias Fröhlich, email: [EMAIL PROTECTED] ? src/FDM/OpenFDM Index: configure.ac === RCS file: /var/cvs/FlightGear-0.9/source/configure.ac,v retrieving revision 1.116 diff -u -r1.116 configure.ac --- configure.ac 5 Apr 2006 19:52:52 - 1.116 +++ configure.ac 12 Jun 2006 06:13:18 - @@ -439,6 +439,14 @@ fi AM_CONDITIONAL(ENABLE_JPEG_SERVER, test x$ac_cv_header_simgear_screen_jpgfactory_hxx = xyes) +dnl Check for installed OpenFDM +AC_CHECK_HEADER(OpenFDM/OpenFDMConfig.h) +AM_CONDITIONAL(ENABLE_OpenFDM_FDM, \ + [ test x$ac_cv_header_OpenFDM_OpenFDMConfig_h = xyes ] ) +if test x$ac_cv_header_OpenFDM_OpenFDMConfig_h = xyes ; then +AC_DEFINE([FG_ENABLE_OPENFDM_FDM], 1, [Define for no logging output]) +fi + AC_LANG_POP dnl Check for system installed zlib @@ -519,6 +527,7 @@ src/FDM/JSBSim/models/atmosphere/Makefile \ src/FDM/JSBSim/models/propulsion/Makefile \ src/FDM/LaRCsim/Makefile \ + src/FDM/OpenFDM/Makefile \ src/FDM/SP/Makefile \ src/FDM/UIUCModel/Makefile \ src/FDM/YASim/Makefile \ Index: src/FDM/Makefile.am === RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/Makefile.am,v retrieving revision 1.7 diff -u -r1.7 Makefile.am --- src/FDM/Makefile.am 22 Nov 2004 10:10:33 - 1.7 +++ src/FDM/Makefile.am 12 Jun 2006 06:13:18 - @@ -4,8 +4,14 @@ SP_DIR = endif +if ENABLE_OpenFDM_FDM +OpenFDM_DIR = OpenFDM +else +OpenFDM_DIR = +endif + SUBDIRS = Balloon JSBSim LaRCsim UIUCModel YASim \ - $(SP_DIR) ExternalNet ExternalPipe + $(SP_DIR) $(OpenFDM_DIR) ExternalNet ExternalPipe noinst_LIBRARIES = libFlight.a Index: src/FDM/flight.hxx === RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/flight.hxx,v retrieving revision 1.13 diff -u -r1.13 flight.hxx --- src/FDM/flight.hxx 11 Jun 2006 13:34:19 - 1.13 +++ src/FDM/flight.hxx 12 Jun 2006 06:13:20 - @@ -433,7 +433,10 @@ FG_PARACHUTE = 9, // Driven externally via a serial port, net, file, etc. - FG_EXTERNAL = 10 + FG_EXTERNAL = 10, + + // OpenFDM. Reads JSBSim legacy and new files. + FG_OPENFDM = 11 }; // initialization Index: src/Main/Makefile.am === RCS file: /var/cvs/FlightGear-0.9/source/src/Main/Makefile.am,v retrieving revision 1.68 diff -u -r1.68 Makefile.am --- src/Main/Makefile.am 14 May 2006 12:22:53 - 1.68 +++ src/Main/Makefile.am 12 Jun 2006 06:13:20 - @@ -9,6 +9,13 @@ SP_FDM_LIBS = endif +if ENABLE_OpenFDM_FDM +OpenFDM_LIBS = $(top_builddir)/src/FDM/OpenFDM/libFGOpenFDM.a \ + -lOpenFDMJSBReader -lOpenFDMeasyxmlXML -lOpenFDMXML -lOpenFDM +else +OpenFDM_LIBS = +endif + if WITH_THREADS THREAD_LIBS = -lsgthreads $(thread_LIBS) else @@ -74,6 +81,7 @@ $(top_builddir)/src/FDM/LaRCsim/libLaRCsim.a \ $(top_builddir)/src/FDM/UIUCModel/libUIUCModel.a \ $(SP_FDM_LIBS) \ + $(OpenFDM_LIBS) \ $(top_builddir)/src/GUI/libGUI.a \ $(top_builddir)/src/Autopilot/libAutopilot.a \ $(top_builddir)/src/Input/libInput.a \ Index: src/Main/fg_init.cxx === RCS file: /var/cvs/FlightGear-0.9/source/src/Main/fg_init.cxx,v retrieving revision 1.165 diff -u -r1.165 fg_init.cxx --- src/Main/fg_init.cxx 10 Jun 2006 22:24:05 - 1.165 +++ src/Main/fg_init.cxx 12 Jun 2006 06:13:20 - @@ -88,6 +88,9 @@
Re: [Flightgear-devel] collision avoidance
Hi, On Sunday 11 June 2006 06:53, Mick - wrote: I've managed to get Mathias' suggestion of using get_elevation_m but with strange AGL values. I used calc_gc_lon_lat from simgear/math/polar3d.hxx for getting the latitude/longitude from x-meters away, then feeding the resulting lat/lon values into get_elevation_m, but it seems this might not be correct (result is not wgs84?). When flying over the ocean, I get an varying AGL value of 10-20ft. With this said, could you suggest an alternative? I have tried that out. That what you describe works here. The ocean surface is not exactly at 0m elevation. It varies between 0m elevation and about -1m. That is normal since the vertices are at exactly 0m, the triangle surfaces must be beond that somewhere in the middle. May be our maximum altitude value bites you. You may need to set that to something similar than the aircrafts altitude. The problem is that the down direction for the lookup is not perpandicular to the geodetic earths surface but directed towards the earths center ... Additionally, could you please suggest how I could use the bounding box method? Well, that depends on what you need. Hierarchical bounding boxes is something different than I suggest. It helps for a different problem. If you need that, I have not understood what you need. Collision avoidance can be meant with not hitting the ground. I expect that you need that. Collisions can also happen with other aircraft/whatever in 3D. If this is what you need than, the elevation value is not aprioriate for you. For that problem it is best to use hierarchical bounding boxes. The scenegraph already has some (poor) hierarchical bounding box structure in it. If you need that it might be a good starting point to reuse that. If you have further problems, feel free to ask. Greetings Mathias -- Mathias Fröhlich, email: [EMAIL PROTECTED] ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] collision avoidance
Before continuing, I thought I'd verify a few points with those in the know. Through observation, I found that my calculated agl value (as discussed in my previous post) was close to that of /position/ground-elev-ft when using the current lat/lon values instead of those from Point3D calc_gc_lon_lat( const Point3D orig, double course, double dist ). I did this in an attempt to compare against the /position/ground-elev-ft value. The resulting value was close but not the same. Having converted between feet and meters, and degrees and radians for the purpose of the calculations, would this have resulted in the slight difference in value? With my limited avionics knowledge, I assumed that: (altitude-ft - ground-elev-ft) = altitude-agl-ft. Again, this is something I want to verify instead of assuming. So is it (somewhat) correct to assume that subtracting the current altitude from my calculated agl would give me the the altitude-agl-ft? thanks, Michael. From: Mathias Fröhlich [EMAIL PROTECTED] Reply-To: FlightGear developers discussions flightgear-devel@lists.sourceforge.net To: FlightGear developers discussions flightgear-devel@lists.sourceforge.net Subject: Re: [Flightgear-devel] collision avoidance Date: Sun, 11 Jun 2006 12:21:23 +0200 Hi, On Sunday 11 June 2006 06:53, Mick - wrote: I've managed to get Mathias' suggestion of using get_elevation_m but with strange AGL values. I used calc_gc_lon_lat from simgear/math/polar3d.hxx for getting the latitude/longitude from x-meters away, then feeding the resulting lat/lon values into get_elevation_m, but it seems this might not be correct (result is not wgs84?). When flying over the ocean, I get an varying AGL value of 10-20ft. With this said, could you suggest an alternative? I have tried that out. That what you describe works here. The ocean surface is not exactly at 0m elevation. It varies between 0m elevation and about -1m. That is normal since the vertices are at exactly 0m, the triangle surfaces must be beond that somewhere in the middle. May be our maximum altitude value bites you. You may need to set that to something similar than the aircrafts altitude. The problem is that the down direction for the lookup is not perpandicular to the geodetic earths surface but directed towards the earths center ... Additionally, could you please suggest how I could use the bounding box method? Well, that depends on what you need. Hierarchical bounding boxes is something different than I suggest. It helps for a different problem. If you need that, I have not understood what you need. Collision avoidance can be meant with not hitting the ground. I expect that you need that. Collisions can also happen with other aircraft/whatever in 3D. If this is what you need than, the elevation value is not aprioriate for you. For that problem it is best to use hierarchical bounding boxes. The scenegraph already has some (poor) hierarchical bounding box structure in it. If you need that it might be a good starting point to reuse that. If you have further problems, feel free to ask. Greetings Mathias -- Mathias Fröhlich, email: [EMAIL PROTECTED] ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] collision avoidance
Hi Gonzalo, I've managed to get Mathias' suggestion of using get_elevation_m but with strange AGL values. I used calc_gc_lon_lat from simgear/math/polar3d.hxx for getting the latitude/longitude from x-meters away, then feeding the resulting lat/lon values into get_elevation_m, but it seems this might not be correct (result is not wgs84?). When flying over the ocean, I get an varying AGL value of 10-20ft. With this said, could you suggest an alternative? Additionally, could you please suggest how I could use the bounding box method? thanks, Michael. From: Gonzalo Aguilar Delgado [EMAIL PROTECTED] Reply-To: FlightGear developers discussions flightgear-devel@lists.sourceforge.net To: FlightGear developers discussions flightgear-devel@lists.sourceforge.net Subject: Re: [Flightgear-devel] collision avoidance Date: Fri, 02 Jun 2006 13:58:18 +0200 Hi all! Best thing to do would be bounding boxes. It's fast to calculate and relative accurate. You can calculate bounding box for each object one time and use every time! On Friday 02 June 2006 01:44, Mick - wrote: I'm trying to create a type of collision avoidance capability, and would need AGL data from in front of the aircraft. Could someone suggest where (in the code) I could get projected elevation information, for example, AGL data 10 meters in front. My understanding is that AGL is taken from the nose of the aircraft. In C++ code src/Scenery/scenery.hxx one of: FGScenery::get_elevation_m; FGScenery::get_cart_elevation_m; should do what you need. Dependent on how often you need to compute that and how far away from the actual aircraft you need to know that the groundcache accessible from FGInterface might be faster. That provides you with the same information in a small area around the aircraft (usually only the bonunding sphere of the aircraft model plus a few meters) in a more performant way. Greetings Mathias -- Gonzalo Aguilar Delgado - Ingeniero en Informática [ Seguridad Medios de pago ] ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] collision avoidance
Hi all! Best thing to do would be bounding boxes. It's fast to calculate and relative accurate. You can calculate bounding box for each object one time and use every time! On Friday 02 June 2006 01:44, Mick - wrote: I'm trying to create a type of collision avoidance capability, and would need AGL data from in front of the aircraft. Could someone suggest where (in the code) I could get projected elevation information, for example, AGL data 10 meters in front. My understanding is that AGL is taken from the nose of the aircraft. In C++ code src/Scenery/scenery.hxx one of: FGScenery::get_elevation_m; FGScenery::get_cart_elevation_m; should do what you need. Dependent on how often you need to compute that and how far away from the actual aircraft you need to know that the groundcache accessible from FGInterface might be faster. That provides you with the same information in a small area around the aircraft (usually only the bonunding sphere of the aircraft model plus a few meters) in a more performant way. Greetings Mathias -- Gonzalo Aguilar Delgado - Ingeniero en Informática [ Seguridad Medios de pago ] ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel