Re: [Flightgear-devel] Help needed fo write an FG string property

2009-04-17 Thread Harry Campigli
HI Curtis thanks for the response,

Well I tore my hair out for a couple of days. But I could never make any
sense of the string stored in the structure, nor could I find a string
terminator in it. I dont know exactly why as i am not very experieced in c
strings.

I ended up putting the property to a local string, then writing it into a
normal char array in the structure adding a teminator after the last
printable.


Certianly not elegant but works for now to load the stucture. A programer
would write it differently to me!


  tempnode = node-getChild(registration);
  pt = net-registration[i];// pointer to array
in struct
  pt[0] = '\0';   // put an end
of string for default
  if ( tempnode != NULL ) {
  temp =  tempnode-getStringValue();
  n=0;
  x=0x31;
  while ( (x  0x19) (x0x7f)  (n  SL_MAX_REGISTRATION)){
  x=temp[n];// pointer
to prop string to send
  pt[n] = x; // wite to
the struct string
  n++;
  }
  pt[n] = '\0'; //0x0A;
  }

From the structure Its written into the other machine with

  node-setStringValue(registration, net-registration[i]);



The file is a clone of the native controls io, purpose being to forward the
clouds, AI and multiplayer info to the slave pcs for display.

Now I have the Ai aircraft  data across to the slaves, my next question is
where does FG pick up the AI items attached for display by the AIbase? Ie I
need to fool the slaves to display the imported aircraft from the data,
preferably with out diabling the Ai base as It is still used displaying the
multiplayer on the slaves from another protocol and port.

I know i could do it with a cloned Ai update funtion, but maybe i can do it
at a lower level?


BTW ref our mail of last weekend, I have been putting a drawing together of
how I have interconnected  the sim aircraft hardware by can bus to FG I
would have mailed it by now if I had not been banging my head on the walls
with this string issue. I will revert with it shortly


Regards Harry






On Fri, Apr 17, 2009 at 2:30 AM, Curtis Olson curtol...@gmail.com wrote:



 On Thu, Apr 16, 2009 at 1:07 AM, Harry Campigli wrote:




 How fo write an FG string property from an indexed string in a structure?

 Possibly someone can help please , I have tried to find an example with no
 luck, I am sure i had it working yesterday but now every way i try i end up
 with it wrong at compile, a seg fault or a property node with an empty
 string. The basic setup works fine with doubles ect, here i only show the
 string code.


 Its wrong, but this is what i want to do, where : index i is declared as
 an int,  path is a node, and path[i] is a string indexed in the structure
 called buf-node-setStringValue(path,buf-path[i]);
 )

 1-The stucture called buf with indexed stings in it from the h file
 
 enum {
 FG_MAX_AIRCRAFT = 25
 };
 uint32_t num_aircraft;
 string callsign[FG_MAX_AIRCRAFT];
 string path[FG_MAX_AIRCRAFT];
 


 2- I write to the stucture with

 
   tempnode = node-getChild(path);
   if ( tempnode != NULL ) {
   net-path[i] =  tempnode-getStringValue();
   }

 


 At a glance, this looks like it should work.  I believe getStringValue()
 returns a const char * type and you should be able to assign this to a
 string variable like you show in your example code.

 If I was going to dig into this, I might start inserting some printf()'s to
 dump out the value of tempnode-getStringValue() to make sure that is sane.
 Make sure [i] is a sane index value, etc.  Off by one errors are pretty easy
 to accidentally introduce.  Hehe, I still have trouble with those off by an
 order of magnitude errors ... :-)

 Without seeing your surrounding code, I think I would be most interested in
 first checking the value of i.  That should remain between 0 and 24 (i=25
 would be an array overrun because you'd be referencing the 26th element of
 the array.)

 Best regards,

 Curt.
 --
 Curtis Olson: 
 http://baron.flightgear.org/~curt/http://baron.flightgear.org/%7Ecurt/


 --
 Stay on top of everything new and different, both inside and
 around Java (TM) technology - register by April 22, and save
 $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
 300 plus technical and hands-on sessions. Register today.
 Use priority code J9JMT32. http://p.sf.net/sfu/p
 ___
 Flightgear-devel mailing list
 Flightgear-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/flightgear-devel




-- 
Regards Harry

19b Jln Danau Poso
Sanur, Bali
80228

H +62 361 285629
M +62 812 7016328
--
Stay 

Re: [Flightgear-devel] aircraft modeling question

2009-04-17 Thread LeeE
On Thursday 16 April 2009, Curtis Olson wrote:
 On Tue, Apr 14, 2009 at 12:26 PM, Torsten Dreyer tors...@t3r.de 
wrote:
   My questions is this ... from a modeling perspective, can
   that 2nd
 
  aircraft
 
   be animated with absolute lon/lat/elev and roll/pitch/yaw
   degrees?  Or would we need to compute an X, Y, Z offset in
   meters for the second aircraft?  It would be a pain to figure
   out the orientation transform relative to the original
   aircraft ... can the secondary aircraft be animated with
   absolute angles relative to the world coordinate frame?
  
   (For animating the 2nd aircraft, I imagine we'd create some
   set of custom property names, and I'd drive them externally
   via some network/file protocol ... maybe creating a custom
   configuration for the generic protocol.)
 
  Don't know if I understand you right, but if you want to create
  arbitrary aircraft with independent position and attitude
  values, you might want to use
  the multiplayer protocol. If you fake the mp-server, you might
  inject any number of aircraft into your scene.

 I was hoping for a reasonably simple solution without needing new
 external software development, but the idea of leveraging the
 multiplayer protocol is interesting.  I notice that with our
 existing multiplayer servers, there is at least a many second
 delay in positioning the MP aircraft.  Is that delay imposed by
 the server side, or is there something built into the protocol
 that could cause position updates to be delayed before they are
 drawn?

 Back to my other idea.  It shouldn't be hard to figure out an XYZ
 offset of a 2nd piggyback model.  But in terms of orientation,
 are there animation primitives that would allow me to specify
 absolute euler angles for the 2nd model, or would those angle
 also have to be computed relative to the primary model
 orientation (that's doable I suppose, but my brain has begun to
 hurt just at the suggestion of having to do it.) :-)

 Thanks,

 Curt.

I can't recall any animation methods that are not relative to the 
orientation of the aircraft axis.

On the other hand though, things like pitch, roll, altitude, lat, 
lon etc. are absolutes and available in the property tree, so it 
should be easy enough to derive an equivalent absolute frame of 
reference.

That is, it should be easy enough to use these property tree nodes 
in your animations while they're atomic values but if it's decided 
that they should be represented by compound values, and it makes as 
much sense to use them for lat, lon  alt, or pitch, roll  yaw, as 
using them anywhere else, you'd have to write some code to parse 
them first.

LeeE

--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


[Flightgear-devel] Startup Problem

2009-04-17 Thread castle
Hi,

Did an upload of the the latest CVS 1.9.1,  build went just fine but when
starting the following happens...


[cas...@rampart FlightGear]$ ./run
***
***
*** Warning: changing bad FG_ROOT/--fg-root to
'/usr/local/share/FlightGear/data'
***
***
***
***
*** Warning: changing bad FG_ROOT/--fg-root to
'/usr/local/share/FlightGear/data'
***
***
./run: line 10: 11192 Segmentation fault 
/usr/local/src/FlightGear-1.9.1/src/Main/fgfs
--fg-root=/usr/local/share/FlightGear --geometry=1024x768 --airport=KSFO
--prop:bool:/sim/rendering/random-vegetation=false
--disable-random-objects --timeofday=noon --disable-clouds3d


The database is the 1.9.0 release.  While that doesn't appear to be the
immediate problem, should that be updated as well -- best way?? via CVS??

Here is the run shell script
,,
#!/bin/sh

/usr/local/src/FlightGear-1.9.1/src/Main/fgfs \
--fg-root=/usr/local/share/FlightGear \
--geometry=1024x768 \
--airport=KSFO \
--prop:bool:/sim/rendering/random-vegetation=false \
--disable-random-objects \
--timeofday=noon \
--disable-clouds3d


Nothing fancy, just something to get things moving.
Everything worked when I first built 1.9.0 a few months ago, but this
warning msg is something new.  Any thoughts on what is wrong?

Thanks
JW







--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel