A password will be e-mailed to you.

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.

Pages: [1] 2
Author Topic: SimConnect_RequestGroundInfo() - no results
DevSim
Professional
Posts: 138
Send Message
Post SimConnect_RequestGroundInfo() - no results
on: April 30, 2012, 07:21

Hi all,

I'm trying to get the SimConnect_RequestGroundInfo() working. Below is my code I use to request ground information on a specific position. Idea is a spot, not a box, from 0m to 10000m.

			hr = SimConnect_RequestGroundInfo(
				_simConnectHandle,
				REQUEST_ALT_POS,
				40.86125,
				28.4645,
				0,
				40.86125,
				28.4645,
				10000,
				5,
				5,
				SIMCONNECT_GROUND_INFO_LATLON_FORMAT_DEGREES,
				SIMCONNECT_GROUND_INFO_ALT_FORMAT_METERS,
				SIMCONNECT_GROUND_INFO_SOURCE_FLAG_TERRAIN
				);

The P3D client application logs this request:

> 32.72227 [ 0, 35]RequestGroundInfo:RequestID=1, minLat=40.86125, minLon=28.4645, minAlt=0.000000, maxLat=40.86125, maxLon=28.4645, maxAlt=10000.000000, dwGridWidth=5, dwGridHeight=5, eLatLonFormat=1, eAltFormat=0, eSourceFlags=65536

Two things:
1. No result data is received via SimConnect_GetNextDispatch().
2. The SDK doesn't describe the packet format of the received value (or I couldn't locate it)

Any ideas?

Thanks,
DevSim

Burkhard
Professional
Posts: 176
Send Message
Post Re: SimConnect_RequestGroundInfo() - no results
on: June 1, 2012, 07:05

I needed the altitude at a precise location. It is easy to get this by dropping a tiny item there, using simconnect.AICreateSimulatedObject, and then ask for the data of the object...

DevSim
Professional
Posts: 138
Send Message
Post Re: SimConnect_RequestGroundInfo() - no results
on: June 1, 2012, 10:14

I still hope that some of the techies from LM chip in here. Still, the SDK is incomplete and I have no clue why I didn't return anything.

Your hack is nice - but it should be done likewise with other calls.

How long do you have to wait for the returned height? P3D has to load that part of scenery first to get a correct height.

MikeSchroe-
ter
Lockheed Martin
Posts: 96
Send Message
Post Re: SimConnect_RequestGroundInfo() - no results
on: June 1, 2012, 11:52

Off the top of my head... how far away is the lat/lon from the current camera position? The terrain code will have a difficult time returning valid data if it is too far away since we load lower res data the farther the distance. SimConnect may not handle it as expected if the terrain system returns "invalid".

Mike

DevSim
Professional
Posts: 138
Send Message
Post Re: SimConnect_RequestGroundInfo() - no results
on: June 1, 2012, 11:54

Hi Mike,

It might indeed be far, far away, we're talking 100 of miles upon repositioning an externallly simulated aircraft via SimConnect. Obviously the new location is known, but P3Ds height of terrain not.

I like Burkhards approach, still unsure about load times...

MikeSchroe-
ter
Lockheed Martin
Posts: 96
Send Message
Post Re: SimConnect_RequestGroundInfo() - no results
on: June 1, 2012, 12:07

If you're just wanting to reposition the object, be sure to set the "on ground" flag. What that should do is place the object on the ground based on the data that is loaded. As new higher res data is loaded, we auto-magically adjust the altitude of any simobjects currently on the ground in that area. This alleviates having to know the actual altitude.

Mike

DevSim
Professional
Posts: 138
Send Message
Post Re: SimConnect_RequestGroundInfo() - no results
on: June 1, 2012, 12:11

Which call is that? On http://www.prepar3d.com/sdk/Core%20Utilities%20Kit/Variables/Simulation%20Variables.html it says, the variable SIM ON GROUND is a bool but not settable at all.

Thnks

MikeSchroe-
ter
Lockheed Martin
Posts: 96
Send Message
Post Re: SimConnect_RequestGroundInfo() - no results
on: June 1, 2012, 12:50

It would look something like this (copied from SetData.cpp in the SimConnect SDK samples):

SIMCONNECT_DATA_INITPOSITION Init;
Init.Altitude = 5000.0;
Init.Latitude = 47.64210;
Init.Longitude = -122.13010;
Init.Pitch = 0.0;
Init.Bank = -1.0;
Init.Heading = 180.0;
Init.OnGround = 0; //MAKE THIS 1 FOR "ON GROUND"
Init.Airspeed = 60;
hr = SimConnect_SetDataOnSimObject(hSimConnect, DEFINITION_6, SIMCONNECT_OBJECT_ID_USER, 0, 0, sizeof(Init), &Init );

Let us know if this works for you.

Mike

DevSim
Professional
Posts: 138
Send Message
Post Re: SimConnect_RequestGroundInfo() - no results
on: June 1, 2012, 13:09

I'll try that next I'm at the sim again.

I wonder how I decide to send regular positions (including the alitude) again after having sent the init set - as the terrain loading takes n seconds to complete - and SimStop/SimStart Events are still utterly crappy unreliable (I'm happy to provide more details, but it's all in another thread with a WONTFIX attitude by LM).

Any advice on that?

Thanks,
DevSim

MikeSchroe-
ter
Lockheed Martin
Posts: 96
Send Message
Post Re: SimConnect_RequestGroundInfo() - no results
on: June 1, 2012, 13:31

Advice on what? The crappy thing or the WONTFIX attitude thing?

We try to be as efficient and effective as possible in prioritizing our work. We simply don't have the resources to satisfy every single issue that comes up. What would really help is rather simply stating that something doesn't work, give us some context or scenario of what you are trying to accomplish.

DevSim
Professional
Posts: 138
Send Message
Post Re: SimConnect_RequestGroundInfo() - no results
on: June 1, 2012, 13:39

Mike, sorry that I had to bring this in a side note (the issue is actually at http://www.prepar3d.com/forum-5/?mingleforumaction=viewtopic&t=246 and the state is quasi FIXED in 1.3 - I showed logs and then it was declared "AS FSX, WONTFIX") and sorry for the terms used.

Ok back to the topic - what I tried to do, is to overcome the shortcomming of not knowing a) the height of terrain at a certian location when positioning my aircraft there, which combined with b) the SimStart/SimStop event notifications not beeing correct, left me with no proper indication of the P3D client, when loading and correct height of terrain can be assumed.

We're all doing our jobs here, and mine is to integrate P3D - which in the long run will fore sure sell you quite a few licenses. You can PM me anytime, I'd be more than happy to have direct communication.

MikeSchroe-
ter
Lockheed Martin
Posts: 96
Send Message
Post Re: SimConnect_RequestGroundInfo() - no results
on: June 1, 2012, 14:14

I'm not sure if SimStart/SimStop is necessarily the best solution for this problem. Try the on ground thing I suggested. You should be able to just set altitude to 0 as long as the "on ground" flag is set. I think there's also a way to get ICAO airport elevations if that is helpful. Again, as terrain loads, your on-ground object should reset appropriately.

Mike

DevSim
Professional
Posts: 138
Send Message
Post Re: SimConnect_RequestGroundInfo() - no results
on: June 2, 2012, 04:42

Sure I can set the onGround flag and altitude 0 - but how can I detect that P3D is finished loading the whole terrain/scenery data at the new point in order to let the aircraft fly/roll user controlled again? Again, my question is: when to switch from the the Init call to regular lat/lon/alt/attitude updates. That is crucial for me.

I have worldwide airport elevation data - they don't macht P3D data exactly that's the reason I need to adjust to your data for visual positioning.

DevSim
Professional
Posts: 138
Send Message
Post Re: SimConnect_RequestGroundInfo() - no results
on: June 2, 2012, 04:49

Or let me rephrase it:

1. The aircraft gets repositioned in the distance
2. P3D starts loading the scenery, sends SimStop event
3. P3D sends SimStart event, but isn't finished loading
4. P3D is finished loading

Under this scenario, how can I make sure to let the simulation roll/fly again? When would be the correct time for this?

DevSim
Professional
Posts: 138
Send Message
Post Re: SimConnect_RequestGroundInfo() - no results
on: June 5, 2012, 10:06

Mike,

Regarding your suggested SIMCONNECT_DATA_INITPOSITION setting, the SDK documentation states:

The primary use of this structure is to initialize the positioning of the user aircraft, because it also optimizes some of the terrain and other simulation systems. Simply setting parameters such as latitude, longitude and altitude does not perform this kind of optimization. This structure should not be used to incrementally move the user aircraft (as this will unnecessarily initiate the reloading of scenery), in this case change the latitude, longitude, altitude and other parameters of the aircraft appropriately (using the variables described in the Simulation Variables document).

I interpret it, as this should only be used once after P3D startup - and not while moving the aircraft around.

What is LMs advice on this?

Regards,
DevSim

Pages: [1] 2
Mingle Forum by cartpauj
Version: 1.0.31 ; Page loaded in: 0.168 seconds.