plib-users Mailing List for PLIB (Page 4)
Brought to you by:
sjbaker
You can subscribe to this list here.
2000 |
Jan
|
Feb
(24) |
Mar
(54) |
Apr
(29) |
May
(58) |
Jun
(29) |
Jul
(675) |
Aug
(46) |
Sep
(40) |
Oct
(102) |
Nov
(39) |
Dec
(40) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(45) |
Feb
(23) |
Mar
(30) |
Apr
(64) |
May
(28) |
Jun
(61) |
Jul
(55) |
Aug
(35) |
Sep
(24) |
Oct
(23) |
Nov
(21) |
Dec
(67) |
2002 |
Jan
(98) |
Feb
(23) |
Mar
(13) |
Apr
(23) |
May
(43) |
Jun
(45) |
Jul
(54) |
Aug
(5) |
Sep
(56) |
Oct
(17) |
Nov
(53) |
Dec
(26) |
2003 |
Jan
(67) |
Feb
(36) |
Mar
(22) |
Apr
(35) |
May
(26) |
Jun
(35) |
Jul
(10) |
Aug
(49) |
Sep
(17) |
Oct
(3) |
Nov
(30) |
Dec
(10) |
2004 |
Jan
(12) |
Feb
(18) |
Mar
(52) |
Apr
(50) |
May
(22) |
Jun
(13) |
Jul
(16) |
Aug
(23) |
Sep
(21) |
Oct
(29) |
Nov
(6) |
Dec
(26) |
2005 |
Jan
(9) |
Feb
(19) |
Mar
(13) |
Apr
(19) |
May
(12) |
Jun
(8) |
Jul
(6) |
Aug
(10) |
Sep
(22) |
Oct
(3) |
Nov
(6) |
Dec
(17) |
2006 |
Jan
(10) |
Feb
(8) |
Mar
(5) |
Apr
(5) |
May
(6) |
Jun
(8) |
Jul
(8) |
Aug
(13) |
Sep
(2) |
Oct
(1) |
Nov
(9) |
Dec
(6) |
2007 |
Jan
(3) |
Feb
(4) |
Mar
(12) |
Apr
(2) |
May
(6) |
Jun
|
Jul
(22) |
Aug
|
Sep
(9) |
Oct
(13) |
Nov
|
Dec
|
2008 |
Jan
(1) |
Feb
(6) |
Mar
(2) |
Apr
(4) |
May
(15) |
Jun
(28) |
Jul
(8) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2009 |
Jan
(5) |
Feb
(5) |
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
(2) |
Apr
(7) |
May
(4) |
Jun
(2) |
Jul
(5) |
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
|
2011 |
Jan
(7) |
Feb
(2) |
Mar
(1) |
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
(1) |
Nov
(4) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Jan R. <slo...@gm...> - 2008-06-24 20:27:20
|
Am Mon, 23 Jun 2008 10:47:56 -0400 schrieb "cory barton" <co...@gm...>: > Oops! :( :) Long live gdb! > Anyhow, Jan thanks for all the help. I now have plib 1.8.5 installed > in my home directory, and plib 1.8.4 is working again. You're welcome. Kind regards, Jan R. -- Jan Reucker email: jan dot reucker at web dot de web: http://www.reucker-online.de |
From: cory b. <co...@gm...> - 2008-06-23 14:47:50
|
I found out why I was having trouble with setValuator. When the textbox has no value, then the associated variable is set to 0. I was using that variable elsewhere in my program in division, thus causing a divide be zero error. Oops! :( Anyhow, Jan thanks for all the help. I now have plib 1.8.5 installed in my home directory, and plib 1.8.4 is working again. Cory On Fri, Jun 20, 2008 at 4:08 PM, Jan Reucker <slo...@gm...> wrote: > Am Wed, 18 Jun 2008 11:35:34 -0400 schrieb "cory barton" <co...@gm...>: > >> I am not sure what I do now. >> Do I have to manually create the libplibxxx.so.1.8.5 files and >> corresponding links? >> Is there a different syntax for inking to libplibxxx.a? >> Should I remove the plib1.8.4 package? > > Cory, > > I'd recommend re-installing all the 1.8.4 stuff to make your system > work again. Then compile and install 1.8.5 to a different place, > e.g. in your home directory: > > ./configure --prefix=$HOME > make > make install > > Then compile and link your program with -I$HOME/include and -L$HOME/lib . > > Kind regards, > Jan R. > > -- > Jan Reucker > email: jan dot reucker at web dot de > web: http://www.reucker-online.de > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > |
From: Jan R. <slo...@gm...> - 2008-06-22 08:08:25
|
Am Wed, 18 Jun 2008 11:35:34 -0400 schrieb "cory barton" <co...@gm...>: > I am not sure what I do now. > Do I have to manually create the libplibxxx.so.1.8.5 files and > corresponding links? > Is there a different syntax for inking to libplibxxx.a? > Should I remove the plib1.8.4 package? Cory, I'd recommend re-installing all the 1.8.4 stuff to make your system work again. Then compile and install 1.8.5 to a different place, e.g. in your home directory: ./configure --prefix=$HOME make make install Then compile and link your program with -I$HOME/include and -L$HOME/lib . Kind regards, Jan R. -- Jan Reucker email: jan dot reucker at web dot de web: http://www.reucker-online.de |
From: cory b. <co...@gm...> - 2008-06-18 15:35:31
|
Jan, > sudo apt-get install libxmu-dev libxmu6 That was enough to move me to the next set of stumbling blocks. I have plib1.8.4 and had plib1.8.4-dev installed Once I did sudo make install, then my program started seg faulting. So I looked around a bit and decided that I should have removed plib1.8.4-dev So I removed it, and reran sudo make install. I did not want to remove plib1.8.4, since it will break flight gear (says synaptic) Now g++ is failing to link to the plib libraries. I have all of the corresponding libplibxxx.a files and also a bunch of libplibxxx.so.1.8.4 files in /usr/lib/ when I had plib-dev installed I had a bunch of libplibxxx.so links to the corresponding libplibxxx.so.1.8.4 files. I am not sure what I do now. Do I have to manually create the libplibxxx.so.1.8.5 files and corresponding links? Is there a different syntax for inking to libplibxxx.a? Should I remove the plib1.8.4 package? Please advise Thanks, Cory On Tue, Jun 17, 2008 at 4:45 PM, Jan Reucker <slo...@gm...> wrote: > Am Tue, 17 Jun 2008 16:02:49 -0400 schrieb "cory barton" <co...@gm...>: > > Hi Cory, > >> /usr/bin/ld: cannot find -lXmu >> collect2: ld returned 1 exit status > > sudo apt-get install libxmu-dev libxmu6 > >> and: >> configure:6929: checking for glNewList in -lMesaGL >> configure:6964: gcc -o conftest -g -O2 conftest.c -lMesaGL -lSM >> -lICE -lXi -lXmu -lXext -lX11 -lm >&5 >> /usr/bin/ld: cannot find -lMesaGL >> collect2: ld returned 1 exit status > > What does > > find /usr -name lib*GL* > > or > > find /usr -name lib*Mesa* > > report? > > Kind regards, > Jan R. > > -- > Jan Reucker > email: jan dot reucker at web dot de > web: http://www.reucker-online.de > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > |
From: Jan R. <slo...@gm...> - 2008-06-17 20:45:48
|
Am Tue, 17 Jun 2008 16:02:49 -0400 schrieb "cory barton" <co...@gm...>: Hi Cory, > /usr/bin/ld: cannot find -lXmu > collect2: ld returned 1 exit status sudo apt-get install libxmu-dev libxmu6 > and: > configure:6929: checking for glNewList in -lMesaGL > configure:6964: gcc -o conftest -g -O2 conftest.c -lMesaGL -lSM > -lICE -lXi -lXmu -lXext -lX11 -lm >&5 > /usr/bin/ld: cannot find -lMesaGL > collect2: ld returned 1 exit status What does find /usr -name lib*GL* or find /usr -name lib*Mesa* report? Kind regards, Jan R. -- Jan Reucker email: jan dot reucker at web dot de web: http://www.reucker-online.de |
From: cory b. <co...@gm...> - 2008-06-17 20:03:09
|
Jan, I haven't made any progress on this issue. I added a post to the ubuntu forums, but still don't have a reply. I did look in config.log and found the following: configure:6841: checking for glNewList in -lGL configure:6876: gcc -o conftest -g -O2 conftest.c -lGL -lSM -lICE -lXi -lXmu -lXext -lX11 -lm >&5 /usr/bin/ld: cannot find -lXmu collect2: ld returned 1 exit status and: configure:6929: checking for glNewList in -lMesaGL configure:6964: gcc -o conftest -g -O2 conftest.c -lMesaGL -lSM -lICE -lXi -lXmu -lXext -lX11 -lm >&5 /usr/bin/ld: cannot find -lMesaGL collect2: ld returned 1 exit status In my searches, I found some suggestion that I should check for libGl.so I found it in /usr/lib/ libGl.so is a link to libGl.so.1 which is a link to libGl.so.1.2 I also found a suggestion that I should try using: ./configure --with-lGL=/usr but that failed, so I also tried: ./configure --with-lGL=/usr/ ./configure --with-lGL=/usr/lib ./configure --with-lGL=/usr/lib/ all fail. I have no idea what else to do. On Tue, Jun 17, 2008 at 3:34 PM, Jan Reucker <slo...@gm...> wrote: > Am Sun, 15 Jun 2008 20:52:41 +0100 schrieb Stuart McDonald <stu...@bl...>: > >> The configure script should generate a log (config.log?) that shows the >> small program is it trying to compile. > > That's right, there should be a config.log and you'll find the > description of the error towards the end of the file. > >> It could also be the library is named something else, (say) >> libOSMesaGL.a or something. No idea how to properly fix something like >> that, but as a last resort you could hand edit the configure.ac (might >> be configure.in) and change the name. > > I usually create a symlink with the required name that points > to the real lib, e.g. > > ln -s /usr/lib/libFancyGL.so.1.2.3 /usr/lib/libGL.so > > A quick look at /usr/lib shows that this is what Ubuntu does > by default: > > lrwxrwxrwx 1 root root 17 2008-05-31 09:51 /usr/lib/libGL.so -> libGL.so.96.43.01 > > On my PC /usr/lib/libGL.so is only a symlink pointing to the libGL > provided by NVIDIA. > > But take a look at config.log first to make sure that this is the > problem. > > Kind regards, > Jan R. > > -- > Jan Reucker > email: jan dot reucker at web dot de > web: http://www.reucker-online.de > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > |
From: Jan R. <slo...@gm...> - 2008-06-17 19:34:13
|
Am Sun, 15 Jun 2008 20:52:41 +0100 schrieb Stuart McDonald <stu...@bl...>: > The configure script should generate a log (config.log?) that shows the > small program is it trying to compile. That's right, there should be a config.log and you'll find the description of the error towards the end of the file. > It could also be the library is named something else, (say) > libOSMesaGL.a or something. No idea how to properly fix something like > that, but as a last resort you could hand edit the configure.ac (might > be configure.in) and change the name. I usually create a symlink with the required name that points to the real lib, e.g. ln -s /usr/lib/libFancyGL.so.1.2.3 /usr/lib/libGL.so A quick look at /usr/lib shows that this is what Ubuntu does by default: lrwxrwxrwx 1 root root 17 2008-05-31 09:51 /usr/lib/libGL.so -> libGL.so.96.43.01 On my PC /usr/lib/libGL.so is only a symlink pointing to the libGL provided by NVIDIA. But take a look at config.log first to make sure that this is the problem. Kind regards, Jan R. -- Jan Reucker email: jan dot reucker at web dot de web: http://www.reucker-online.de |
From: Stuart M. <stu...@bl...> - 2008-06-15 19:52:43
|
You need to find where the libraries are installed and ensure that the -L library path flag is set correctly. Unfortunately I really don't know much about Linux installs or autoconf, but I do know what it's doing is creating a small C file which has a call to a function that should be in the library (glNewList in this case). It then compile and link that small program and if it works then library must have been found. From the list below it looks like you have Mesa installed so I can only assume it's not in a location the the linker looks by default, therefore the -L<dir path> option must be given to tell it where to look for the libMesaGL.0 (or libMesaGL.a sorry, as I said I don't know much about linux). e.g. it could be the library is /usr/local/lib/libMesaGL.sl so you would need to get -L /usr/local/lib in the the link flags (again, sorry don't know how to drive autoconf to do this). The configure script should generate a log (config.log?) that shows the small program is it trying to compile. To find the library you could do a find / -name "lib*Mesa*" (might take a while 8-) It could also be the library is named something else, (say) libOSMesaGL.a or something. No idea how to properly fix something like that, but as a last resort you could hand edit the configure.ac (might be configure.in) and change the name. Hopefully some help. Good luck, Stuart. cory barton wrote: > I wasn't sure how to get the SVN version, so I am trying to install > PLIB 1.8.5, but ./configure is failing. > > Here is the last bit of the ./configure output(everything before it is yes): > > checking for pthread_create in -lpthread... no > checking for glNewList in -lGL... no > checking for glNewList in -lMesaGL... no > configure: error: could not find working GL library > > I do have the following packages installed: > ii freeglut3 2.4.0-6 > OpenGL Utility Toolkit > ii freeglut3-dev 2.4.0-6 > OpenGL Utility Toolkit development files > ii glutg3 3.7-25 > the OpenGL Utility Toolkit > ii glutg3-dev 3.7-25 > the OpenGL Utility Toolkit development files > ii libgl1-mesa-dev 7.0.3~rc2-1ubuntu3 > A free implementation of the OpenGL API -- G > ii libgl1-mesa-dri 7.0.3~rc2-1ubuntu3 > A free implementation of the OpenGL API -- D > ii libgl1-mesa-glx 7.0.3~rc2-1ubuntu3 > A free implementation of the OpenGL API -- G > rc libglew1.4 1.4.0-1ubuntu1 > The OpenGL Extension Wrangler - runtime envi > ii libglew1.5 1.5.0dfsg1-3ubuntu1 > The OpenGL Extension Wrangler - runtime envi > ii libglib2.0-0 2.16.3-1ubuntu2 > The GLib library of C routines > ii libglib2.0-cil 2.12.0-2ubuntu3 > CLI binding for the GLib utility library 2.1 > ii libglibmm-2.4-1c2a 2.16.0-1 > C++ wrapper for the GLib toolkit (shared lib > ii libglu1-mesa 7.0.3~rc2-1ubuntu3 > The OpenGL utility library (GLU) > ii libglu1-mesa-dev 7.0.3~rc2-1ubuntu3 > The OpenGL utility library -- development fi > ii libglut3 3.7-25 > the OpenGL Utility Toolkit > ii libglut3-dev 3.7-25 > development libraries and headers for GLUT > ii xlibmesa-gl-dev 1:7.3+10ubuntu10 > transitional package for Debian etch > ii xorg-driver-fglrx > 1:7.1.0-8-3+2.6.24.13-18.41 Video driver for ATI graphics > accelerators > ii xscreensaver-gl 5.04-4ubuntu1 > GL(Mesa) screen hacks for xscreensaver > ii xserver-xorg-video-glint 1:1.1.1-8 > X.Org X server -- Glint display driver > > What am I missing? I have googled all over for a solution to this, but > have not found it. > > Thanks, > > Cory > > > On Fri, Jun 13, 2008 at 2:59 PM, cory barton <co...@gm...> wrote: > >> I haven't tried the most recent SVN version. >> >> I will try that and let you know. May be tuesday before I have a >> chance to try that. I am going out of town. >> >> thanks, >> >> Cory >> >> >> On Fri, Jun 13, 2008 at 9:25 AM, Fay John F Dr CTR USAF 46 SK >> <joh...@eg...> wrote: >> >>> Hmmm ... I'm running on Windows, but that shouldn't make a difference. >>> (Of course, "shouldn't" is the longest word in the English language, >>> right up there with "if.") >>> >>> Have you tried getting the most recent SVN version? >>> >>> Unfortunately I've been away from the library for a couple of years now, >>> and I'm a bit rusty on what's what. >>> >>> John F. Fay >>> Technical Fellow >>> Jacobs Technology TEAS Group >>> 850-883-1294 >>> >>> -----Original Message----- >>> From: pli...@li... >>> [mailto:pli...@li...] On Behalf Of cory >>> barton >>> Sent: Thursday, June 12, 2008 5:13 PM >>> To: PLIB Users >>> Subject: Re: [Plib-users] (cory vs. pui) The attack of setValuator >>> >>> 1.8.4c2 ubuntu package >>> >>> >>> >>> On Thu, Jun 12, 2008 at 5:30 PM, Fay John F Dr CTR USAF 46 SK >>> <joh...@eg...> wrote: >>> >>>> Sorry, I still can't get it to crash. >>>> >>>> What version of PUI are you using? >>>> >>>> John F. Fay >>>> Technical Fellow >>>> Jacobs Technology TEAS Group >>>> 850-883-1294 >>>> >>>> -----Original Message----- >>>> From: pli...@li... >>>> [mailto:pli...@li...] On Behalf Of cory >>>> barton >>>> Sent: Thursday, June 12, 2008 3:53 PM >>>> To: PLIB Users >>>> Subject: Re: [Plib-users] (cory vs. pui) The attack of setValuator >>>> >>>> Here is the code: >>>> >>>> <snip> >>>> >>>> >>>> On Thu, Jun 12, 2008 at 4:42 PM, Fay John F Dr CTR USAF 46 SK >>>> <joh...@eg...> wrote: >>>> >>>>> Hmmm ... unless somebody else steps in, please forward me a copy of >>>>> >>>> the >>>> >>>>> offending code. I've tried putting in your code snippet and the >>>>> >>>> program >>>> >>>>> works just fine for me, so evidently something else is going on. >>>>> >>>>> John F. Fay >>>>> Technical Fellow >>>>> Jacobs Technology TEAS Group >>>>> 850-883-1294 >>>>> >>>>> -----Original Message----- >>>>> From: pli...@li... >>>>> [mailto:pli...@li...] On Behalf Of cory >>>>> barton >>>>> Sent: Thursday, June 12, 2008 3:19 PM >>>>> To: PLIB Users >>>>> Subject: [Plib-users] (cory vs. pui) The attack of setValuator >>>>> >>>>> I found the following in the PUI documentation today: >>>>> There are many occasions when you'd really like to have the PUI >>>>> >>> widget >>> >>>>> directly drive and/or reflect the value of some memory location in >>>>> >>> the >>> >>>>> application code. These calls let you do that: >>>>> >>>>> void puObject::setValuator ( int *i ) ; >>>>> void puObject::setValuator ( float *f ) ; >>>>> void puObject::setValuator ( char *s ) ; >>>>> >>>>> >>>>> Once you make one of these calls, PUI will automatically update the >>>>> memory location indicated with the current value of the widget >>>>> whenever it changes - and also update the appearance of the widget to >>>>> reflect the value stored in that memory location whenever the widget >>>>> is redrawn. This is often a lot more convenient than using a callback >>>>> function to register changes in the widget's value. >>>>> >>>>> So I tried it out: >>>>> //global variable >>>>> float update = 1.0f; >>>>> >>>>> //initialize my puInput inside a function >>>>> //hertz text input >>>>> hertz_text = new puInput ( curx, cury, >>>>> curx + >>>>> PUI_TEXT_WIDTH, >>>>> cury + >>>>> PUI_TEXT_HEIGHT ) ; >>>>> hertz_text->setValuator( &update ); >>>>> hertz_text->setLabel( "Hertz" ); >>>>> hertz_text->setLabelPlace( PUPLACE_TOP_CENTERED ); >>>>> >>>>> >>>>> This compiles, and runs. >>>>> >>>>> It seems to work correctly as long as I do not remove all of the >>>>> characters from the puInput box. However if I am trying to change the >>>>> value, when I am typing in the new value, if the new value ever >>>>> becomes a non valid float value, then the program crashes. For >>>>> >>> example >>> >>>>> if I want to change 1.0 to 2.0 and I delete 1.0 so I can type 2.0, >>>>> then instant crash. I can change from 1.0 to 2.0 if I type the 2 >>>>> >>> after >>> >>>>> the 1, and then erase the 1. >>>>> >>>>> Searching the mail archives and googling didn't help, so I am posting >>>>> here. >>>>> >>>>> I suspect either my weak understanding of pointers means that I am >>>>> passing an incorrect argument to the setValuator function, or maybe >>>>> the puInput object is writing invalid data to the update variable. >>>>> >>>>> Please let me know how to fix this. >>>>> >>>>> thanks, >>>>> >>>>> Cory >>>>> >>>>> >>>> >>>> >>> ------------------------------------------------------------------------ >>> - >>> >>>> Check out the new SourceForge.net Marketplace. >>>> It's the best place to buy or sell services for >>>> just about anything Open Source. >>>> http://sourceforge.net/services/buy/index.php >>>> _______________________________________________ >>>> plib-users mailing list >>>> pli...@li... >>>> https://lists.sourceforge.net/lists/listinfo/plib-users >>>> >>>> >>> ------------------------------------------------------------------------ >>> - >>> Check out the new SourceForge.net Marketplace. >>> It's the best place to buy or sell services for >>> just about anything Open Source. >>> http://sourceforge.net/services/buy/index.php >>> _______________________________________________ >>> plib-users mailing list >>> pli...@li... >>> https://lists.sourceforge.net/lists/listinfo/plib-users >>> >>> ------------------------------------------------------------------------- >>> Check out the new SourceForge.net Marketplace. >>> It's the best place to buy or sell services for >>> just about anything Open Source. >>> http://sourceforge.net/services/buy/index.php >>> _______________________________________________ >>> plib-users mailing list >>> pli...@li... >>> https://lists.sourceforge.net/lists/listinfo/plib-users >>> >>> > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > > > |
From: cory b. <co...@gm...> - 2008-06-15 01:25:42
|
I wasn't sure how to get the SVN version, so I am trying to install PLIB 1.8.5, but ./configure is failing. Here is the last bit of the ./configure output(everything before it is yes): checking for pthread_create in -lpthread... no checking for glNewList in -lGL... no checking for glNewList in -lMesaGL... no configure: error: could not find working GL library I do have the following packages installed: ii freeglut3 2.4.0-6 OpenGL Utility Toolkit ii freeglut3-dev 2.4.0-6 OpenGL Utility Toolkit development files ii glutg3 3.7-25 the OpenGL Utility Toolkit ii glutg3-dev 3.7-25 the OpenGL Utility Toolkit development files ii libgl1-mesa-dev 7.0.3~rc2-1ubuntu3 A free implementation of the OpenGL API -- G ii libgl1-mesa-dri 7.0.3~rc2-1ubuntu3 A free implementation of the OpenGL API -- D ii libgl1-mesa-glx 7.0.3~rc2-1ubuntu3 A free implementation of the OpenGL API -- G rc libglew1.4 1.4.0-1ubuntu1 The OpenGL Extension Wrangler - runtime envi ii libglew1.5 1.5.0dfsg1-3ubuntu1 The OpenGL Extension Wrangler - runtime envi ii libglib2.0-0 2.16.3-1ubuntu2 The GLib library of C routines ii libglib2.0-cil 2.12.0-2ubuntu3 CLI binding for the GLib utility library 2.1 ii libglibmm-2.4-1c2a 2.16.0-1 C++ wrapper for the GLib toolkit (shared lib ii libglu1-mesa 7.0.3~rc2-1ubuntu3 The OpenGL utility library (GLU) ii libglu1-mesa-dev 7.0.3~rc2-1ubuntu3 The OpenGL utility library -- development fi ii libglut3 3.7-25 the OpenGL Utility Toolkit ii libglut3-dev 3.7-25 development libraries and headers for GLUT ii xlibmesa-gl-dev 1:7.3+10ubuntu10 transitional package for Debian etch ii xorg-driver-fglrx 1:7.1.0-8-3+2.6.24.13-18.41 Video driver for ATI graphics accelerators ii xscreensaver-gl 5.04-4ubuntu1 GL(Mesa) screen hacks for xscreensaver ii xserver-xorg-video-glint 1:1.1.1-8 X.Org X server -- Glint display driver What am I missing? I have googled all over for a solution to this, but have not found it. Thanks, Cory On Fri, Jun 13, 2008 at 2:59 PM, cory barton <co...@gm...> wrote: > I haven't tried the most recent SVN version. > > I will try that and let you know. May be tuesday before I have a > chance to try that. I am going out of town. > > thanks, > > Cory > > > On Fri, Jun 13, 2008 at 9:25 AM, Fay John F Dr CTR USAF 46 SK > <joh...@eg...> wrote: >> Hmmm ... I'm running on Windows, but that shouldn't make a difference. >> (Of course, "shouldn't" is the longest word in the English language, >> right up there with "if.") >> >> Have you tried getting the most recent SVN version? >> >> Unfortunately I've been away from the library for a couple of years now, >> and I'm a bit rusty on what's what. >> >> John F. Fay >> Technical Fellow >> Jacobs Technology TEAS Group >> 850-883-1294 >> >> -----Original Message----- >> From: pli...@li... >> [mailto:pli...@li...] On Behalf Of cory >> barton >> Sent: Thursday, June 12, 2008 5:13 PM >> To: PLIB Users >> Subject: Re: [Plib-users] (cory vs. pui) The attack of setValuator >> >> 1.8.4c2 ubuntu package >> >> >> >> On Thu, Jun 12, 2008 at 5:30 PM, Fay John F Dr CTR USAF 46 SK >> <joh...@eg...> wrote: >>> Sorry, I still can't get it to crash. >>> >>> What version of PUI are you using? >>> >>> John F. Fay >>> Technical Fellow >>> Jacobs Technology TEAS Group >>> 850-883-1294 >>> >>> -----Original Message----- >>> From: pli...@li... >>> [mailto:pli...@li...] On Behalf Of cory >>> barton >>> Sent: Thursday, June 12, 2008 3:53 PM >>> To: PLIB Users >>> Subject: Re: [Plib-users] (cory vs. pui) The attack of setValuator >>> >>> Here is the code: >>> >>> <snip> >>> >>> >>> On Thu, Jun 12, 2008 at 4:42 PM, Fay John F Dr CTR USAF 46 SK >>> <joh...@eg...> wrote: >>>> Hmmm ... unless somebody else steps in, please forward me a copy of >>> the >>>> offending code. I've tried putting in your code snippet and the >>> program >>>> works just fine for me, so evidently something else is going on. >>>> >>>> John F. Fay >>>> Technical Fellow >>>> Jacobs Technology TEAS Group >>>> 850-883-1294 >>>> >>>> -----Original Message----- >>>> From: pli...@li... >>>> [mailto:pli...@li...] On Behalf Of cory >>>> barton >>>> Sent: Thursday, June 12, 2008 3:19 PM >>>> To: PLIB Users >>>> Subject: [Plib-users] (cory vs. pui) The attack of setValuator >>>> >>>> I found the following in the PUI documentation today: >>>> There are many occasions when you'd really like to have the PUI >> widget >>>> directly drive and/or reflect the value of some memory location in >> the >>>> application code. These calls let you do that: >>>> >>>> void puObject::setValuator ( int *i ) ; >>>> void puObject::setValuator ( float *f ) ; >>>> void puObject::setValuator ( char *s ) ; >>>> >>>> >>>> Once you make one of these calls, PUI will automatically update the >>>> memory location indicated with the current value of the widget >>>> whenever it changes - and also update the appearance of the widget to >>>> reflect the value stored in that memory location whenever the widget >>>> is redrawn. This is often a lot more convenient than using a callback >>>> function to register changes in the widget's value. >>>> >>>> So I tried it out: >>>> //global variable >>>> float update = 1.0f; >>>> >>>> //initialize my puInput inside a function >>>> //hertz text input >>>> hertz_text = new puInput ( curx, cury, >>>> curx + >>>> PUI_TEXT_WIDTH, >>>> cury + >>>> PUI_TEXT_HEIGHT ) ; >>>> hertz_text->setValuator( &update ); >>>> hertz_text->setLabel( "Hertz" ); >>>> hertz_text->setLabelPlace( PUPLACE_TOP_CENTERED ); >>>> >>>> >>>> This compiles, and runs. >>>> >>>> It seems to work correctly as long as I do not remove all of the >>>> characters from the puInput box. However if I am trying to change the >>>> value, when I am typing in the new value, if the new value ever >>>> becomes a non valid float value, then the program crashes. For >> example >>>> if I want to change 1.0 to 2.0 and I delete 1.0 so I can type 2.0, >>>> then instant crash. I can change from 1.0 to 2.0 if I type the 2 >> after >>>> the 1, and then erase the 1. >>>> >>>> Searching the mail archives and googling didn't help, so I am posting >>>> here. >>>> >>>> I suspect either my weak understanding of pointers means that I am >>>> passing an incorrect argument to the setValuator function, or maybe >>>> the puInput object is writing invalid data to the update variable. >>>> >>>> Please let me know how to fix this. >>>> >>>> thanks, >>>> >>>> Cory >>>> >>> >>> >>> >> ------------------------------------------------------------------------ >> - >>> Check out the new SourceForge.net Marketplace. >>> It's the best place to buy or sell services for >>> just about anything Open Source. >>> http://sourceforge.net/services/buy/index.php >>> _______________________________________________ >>> plib-users mailing list >>> pli...@li... >>> https://lists.sourceforge.net/lists/listinfo/plib-users >>> >> >> ------------------------------------------------------------------------ >> - >> Check out the new SourceForge.net Marketplace. >> It's the best place to buy or sell services for >> just about anything Open Source. >> http://sourceforge.net/services/buy/index.php >> _______________________________________________ >> plib-users mailing list >> pli...@li... >> https://lists.sourceforge.net/lists/listinfo/plib-users >> >> ------------------------------------------------------------------------- >> Check out the new SourceForge.net Marketplace. >> It's the best place to buy or sell services for >> just about anything Open Source. >> http://sourceforge.net/services/buy/index.php >> _______________________________________________ >> plib-users mailing list >> pli...@li... >> https://lists.sourceforge.net/lists/listinfo/plib-users >> > |
From: cory b. <co...@gm...> - 2008-06-13 18:59:37
|
I haven't tried the most recent SVN version. I will try that and let you know. May be tuesday before I have a chance to try that. I am going out of town. thanks, Cory On Fri, Jun 13, 2008 at 9:25 AM, Fay John F Dr CTR USAF 46 SK <joh...@eg...> wrote: > Hmmm ... I'm running on Windows, but that shouldn't make a difference. > (Of course, "shouldn't" is the longest word in the English language, > right up there with "if.") > > Have you tried getting the most recent SVN version? > > Unfortunately I've been away from the library for a couple of years now, > and I'm a bit rusty on what's what. > > John F. Fay > Technical Fellow > Jacobs Technology TEAS Group > 850-883-1294 > > -----Original Message----- > From: pli...@li... > [mailto:pli...@li...] On Behalf Of cory > barton > Sent: Thursday, June 12, 2008 5:13 PM > To: PLIB Users > Subject: Re: [Plib-users] (cory vs. pui) The attack of setValuator > > 1.8.4c2 ubuntu package > > > > On Thu, Jun 12, 2008 at 5:30 PM, Fay John F Dr CTR USAF 46 SK > <joh...@eg...> wrote: >> Sorry, I still can't get it to crash. >> >> What version of PUI are you using? >> >> John F. Fay >> Technical Fellow >> Jacobs Technology TEAS Group >> 850-883-1294 >> >> -----Original Message----- >> From: pli...@li... >> [mailto:pli...@li...] On Behalf Of cory >> barton >> Sent: Thursday, June 12, 2008 3:53 PM >> To: PLIB Users >> Subject: Re: [Plib-users] (cory vs. pui) The attack of setValuator >> >> Here is the code: >> >> <snip> >> >> >> On Thu, Jun 12, 2008 at 4:42 PM, Fay John F Dr CTR USAF 46 SK >> <joh...@eg...> wrote: >>> Hmmm ... unless somebody else steps in, please forward me a copy of >> the >>> offending code. I've tried putting in your code snippet and the >> program >>> works just fine for me, so evidently something else is going on. >>> >>> John F. Fay >>> Technical Fellow >>> Jacobs Technology TEAS Group >>> 850-883-1294 >>> >>> -----Original Message----- >>> From: pli...@li... >>> [mailto:pli...@li...] On Behalf Of cory >>> barton >>> Sent: Thursday, June 12, 2008 3:19 PM >>> To: PLIB Users >>> Subject: [Plib-users] (cory vs. pui) The attack of setValuator >>> >>> I found the following in the PUI documentation today: >>> There are many occasions when you'd really like to have the PUI > widget >>> directly drive and/or reflect the value of some memory location in > the >>> application code. These calls let you do that: >>> >>> void puObject::setValuator ( int *i ) ; >>> void puObject::setValuator ( float *f ) ; >>> void puObject::setValuator ( char *s ) ; >>> >>> >>> Once you make one of these calls, PUI will automatically update the >>> memory location indicated with the current value of the widget >>> whenever it changes - and also update the appearance of the widget to >>> reflect the value stored in that memory location whenever the widget >>> is redrawn. This is often a lot more convenient than using a callback >>> function to register changes in the widget's value. >>> >>> So I tried it out: >>> //global variable >>> float update = 1.0f; >>> >>> //initialize my puInput inside a function >>> //hertz text input >>> hertz_text = new puInput ( curx, cury, >>> curx + >>> PUI_TEXT_WIDTH, >>> cury + >>> PUI_TEXT_HEIGHT ) ; >>> hertz_text->setValuator( &update ); >>> hertz_text->setLabel( "Hertz" ); >>> hertz_text->setLabelPlace( PUPLACE_TOP_CENTERED ); >>> >>> >>> This compiles, and runs. >>> >>> It seems to work correctly as long as I do not remove all of the >>> characters from the puInput box. However if I am trying to change the >>> value, when I am typing in the new value, if the new value ever >>> becomes a non valid float value, then the program crashes. For > example >>> if I want to change 1.0 to 2.0 and I delete 1.0 so I can type 2.0, >>> then instant crash. I can change from 1.0 to 2.0 if I type the 2 > after >>> the 1, and then erase the 1. >>> >>> Searching the mail archives and googling didn't help, so I am posting >>> here. >>> >>> I suspect either my weak understanding of pointers means that I am >>> passing an incorrect argument to the setValuator function, or maybe >>> the puInput object is writing invalid data to the update variable. >>> >>> Please let me know how to fix this. >>> >>> thanks, >>> >>> Cory >>> >> >> >> > ------------------------------------------------------------------------ > - >> Check out the new SourceForge.net Marketplace. >> It's the best place to buy or sell services for >> just about anything Open Source. >> http://sourceforge.net/services/buy/index.php >> _______________________________________________ >> plib-users mailing list >> pli...@li... >> https://lists.sourceforge.net/lists/listinfo/plib-users >> > > ------------------------------------------------------------------------ > - > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > |
From: Fay J. F Dr C. U. 46 S. <joh...@eg...> - 2008-06-13 13:25:53
|
Hmmm ... I'm running on Windows, but that shouldn't make a difference. (Of course, "shouldn't" is the longest word in the English language, right up there with "if.") Have you tried getting the most recent SVN version? Unfortunately I've been away from the library for a couple of years now, and I'm a bit rusty on what's what. John F. Fay Technical Fellow Jacobs Technology TEAS Group 850-883-1294 -----Original Message----- From: pli...@li... [mailto:pli...@li...] On Behalf Of cory barton Sent: Thursday, June 12, 2008 5:13 PM To: PLIB Users Subject: Re: [Plib-users] (cory vs. pui) The attack of setValuator 1.8.4c2 ubuntu package On Thu, Jun 12, 2008 at 5:30 PM, Fay John F Dr CTR USAF 46 SK <joh...@eg...> wrote: > Sorry, I still can't get it to crash. > > What version of PUI are you using? > > John F. Fay > Technical Fellow > Jacobs Technology TEAS Group > 850-883-1294 > > -----Original Message----- > From: pli...@li... > [mailto:pli...@li...] On Behalf Of cory > barton > Sent: Thursday, June 12, 2008 3:53 PM > To: PLIB Users > Subject: Re: [Plib-users] (cory vs. pui) The attack of setValuator > > Here is the code: > > <snip> > > > On Thu, Jun 12, 2008 at 4:42 PM, Fay John F Dr CTR USAF 46 SK > <joh...@eg...> wrote: >> Hmmm ... unless somebody else steps in, please forward me a copy of > the >> offending code. I've tried putting in your code snippet and the > program >> works just fine for me, so evidently something else is going on. >> >> John F. Fay >> Technical Fellow >> Jacobs Technology TEAS Group >> 850-883-1294 >> >> -----Original Message----- >> From: pli...@li... >> [mailto:pli...@li...] On Behalf Of cory >> barton >> Sent: Thursday, June 12, 2008 3:19 PM >> To: PLIB Users >> Subject: [Plib-users] (cory vs. pui) The attack of setValuator >> >> I found the following in the PUI documentation today: >> There are many occasions when you'd really like to have the PUI widget >> directly drive and/or reflect the value of some memory location in the >> application code. These calls let you do that: >> >> void puObject::setValuator ( int *i ) ; >> void puObject::setValuator ( float *f ) ; >> void puObject::setValuator ( char *s ) ; >> >> >> Once you make one of these calls, PUI will automatically update the >> memory location indicated with the current value of the widget >> whenever it changes - and also update the appearance of the widget to >> reflect the value stored in that memory location whenever the widget >> is redrawn. This is often a lot more convenient than using a callback >> function to register changes in the widget's value. >> >> So I tried it out: >> //global variable >> float update = 1.0f; >> >> //initialize my puInput inside a function >> //hertz text input >> hertz_text = new puInput ( curx, cury, >> curx + >> PUI_TEXT_WIDTH, >> cury + >> PUI_TEXT_HEIGHT ) ; >> hertz_text->setValuator( &update ); >> hertz_text->setLabel( "Hertz" ); >> hertz_text->setLabelPlace( PUPLACE_TOP_CENTERED ); >> >> >> This compiles, and runs. >> >> It seems to work correctly as long as I do not remove all of the >> characters from the puInput box. However if I am trying to change the >> value, when I am typing in the new value, if the new value ever >> becomes a non valid float value, then the program crashes. For example >> if I want to change 1.0 to 2.0 and I delete 1.0 so I can type 2.0, >> then instant crash. I can change from 1.0 to 2.0 if I type the 2 after >> the 1, and then erase the 1. >> >> Searching the mail archives and googling didn't help, so I am posting >> here. >> >> I suspect either my weak understanding of pointers means that I am >> passing an incorrect argument to the setValuator function, or maybe >> the puInput object is writing invalid data to the update variable. >> >> Please let me know how to fix this. >> >> thanks, >> >> Cory >> > > > ------------------------------------------------------------------------ - > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > ------------------------------------------------------------------------ - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ plib-users mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-users |
From: cory b. <co...@gm...> - 2008-06-12 22:12:55
|
1.8.4c2 ubuntu package On Thu, Jun 12, 2008 at 5:30 PM, Fay John F Dr CTR USAF 46 SK <joh...@eg...> wrote: > Sorry, I still can't get it to crash. > > What version of PUI are you using? > > John F. Fay > Technical Fellow > Jacobs Technology TEAS Group > 850-883-1294 > > -----Original Message----- > From: pli...@li... > [mailto:pli...@li...] On Behalf Of cory > barton > Sent: Thursday, June 12, 2008 3:53 PM > To: PLIB Users > Subject: Re: [Plib-users] (cory vs. pui) The attack of setValuator > > Here is the code: > > <snip> > > > On Thu, Jun 12, 2008 at 4:42 PM, Fay John F Dr CTR USAF 46 SK > <joh...@eg...> wrote: >> Hmmm ... unless somebody else steps in, please forward me a copy of > the >> offending code. I've tried putting in your code snippet and the > program >> works just fine for me, so evidently something else is going on. >> >> John F. Fay >> Technical Fellow >> Jacobs Technology TEAS Group >> 850-883-1294 >> >> -----Original Message----- >> From: pli...@li... >> [mailto:pli...@li...] On Behalf Of cory >> barton >> Sent: Thursday, June 12, 2008 3:19 PM >> To: PLIB Users >> Subject: [Plib-users] (cory vs. pui) The attack of setValuator >> >> I found the following in the PUI documentation today: >> There are many occasions when you'd really like to have the PUI widget >> directly drive and/or reflect the value of some memory location in the >> application code. These calls let you do that: >> >> void puObject::setValuator ( int *i ) ; >> void puObject::setValuator ( float *f ) ; >> void puObject::setValuator ( char *s ) ; >> >> >> Once you make one of these calls, PUI will automatically update the >> memory location indicated with the current value of the widget >> whenever it changes - and also update the appearance of the widget to >> reflect the value stored in that memory location whenever the widget >> is redrawn. This is often a lot more convenient than using a callback >> function to register changes in the widget's value. >> >> So I tried it out: >> //global variable >> float update = 1.0f; >> >> //initialize my puInput inside a function >> //hertz text input >> hertz_text = new puInput ( curx, cury, >> curx + >> PUI_TEXT_WIDTH, >> cury + >> PUI_TEXT_HEIGHT ) ; >> hertz_text->setValuator( &update ); >> hertz_text->setLabel( "Hertz" ); >> hertz_text->setLabelPlace( PUPLACE_TOP_CENTERED ); >> >> >> This compiles, and runs. >> >> It seems to work correctly as long as I do not remove all of the >> characters from the puInput box. However if I am trying to change the >> value, when I am typing in the new value, if the new value ever >> becomes a non valid float value, then the program crashes. For example >> if I want to change 1.0 to 2.0 and I delete 1.0 so I can type 2.0, >> then instant crash. I can change from 1.0 to 2.0 if I type the 2 after >> the 1, and then erase the 1. >> >> Searching the mail archives and googling didn't help, so I am posting >> here. >> >> I suspect either my weak understanding of pointers means that I am >> passing an incorrect argument to the setValuator function, or maybe >> the puInput object is writing invalid data to the update variable. >> >> Please let me know how to fix this. >> >> thanks, >> >> Cory >> > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > |
From: Fay J. F Dr C. U. 46 S. <joh...@eg...> - 2008-06-12 21:30:19
|
Sorry, I still can't get it to crash. What version of PUI are you using? John F. Fay Technical Fellow Jacobs Technology TEAS Group 850-883-1294 -----Original Message----- From: pli...@li... [mailto:pli...@li...] On Behalf Of cory barton Sent: Thursday, June 12, 2008 3:53 PM To: PLIB Users Subject: Re: [Plib-users] (cory vs. pui) The attack of setValuator Here is the code: <snip> On Thu, Jun 12, 2008 at 4:42 PM, Fay John F Dr CTR USAF 46 SK <joh...@eg...> wrote: > Hmmm ... unless somebody else steps in, please forward me a copy of the > offending code. I've tried putting in your code snippet and the program > works just fine for me, so evidently something else is going on. > > John F. Fay > Technical Fellow > Jacobs Technology TEAS Group > 850-883-1294 > > -----Original Message----- > From: pli...@li... > [mailto:pli...@li...] On Behalf Of cory > barton > Sent: Thursday, June 12, 2008 3:19 PM > To: PLIB Users > Subject: [Plib-users] (cory vs. pui) The attack of setValuator > > I found the following in the PUI documentation today: > There are many occasions when you'd really like to have the PUI widget > directly drive and/or reflect the value of some memory location in the > application code. These calls let you do that: > > void puObject::setValuator ( int *i ) ; > void puObject::setValuator ( float *f ) ; > void puObject::setValuator ( char *s ) ; > > > Once you make one of these calls, PUI will automatically update the > memory location indicated with the current value of the widget > whenever it changes - and also update the appearance of the widget to > reflect the value stored in that memory location whenever the widget > is redrawn. This is often a lot more convenient than using a callback > function to register changes in the widget's value. > > So I tried it out: > //global variable > float update = 1.0f; > > //initialize my puInput inside a function > //hertz text input > hertz_text = new puInput ( curx, cury, > curx + > PUI_TEXT_WIDTH, > cury + > PUI_TEXT_HEIGHT ) ; > hertz_text->setValuator( &update ); > hertz_text->setLabel( "Hertz" ); > hertz_text->setLabelPlace( PUPLACE_TOP_CENTERED ); > > > This compiles, and runs. > > It seems to work correctly as long as I do not remove all of the > characters from the puInput box. However if I am trying to change the > value, when I am typing in the new value, if the new value ever > becomes a non valid float value, then the program crashes. For example > if I want to change 1.0 to 2.0 and I delete 1.0 so I can type 2.0, > then instant crash. I can change from 1.0 to 2.0 if I type the 2 after > the 1, and then erase the 1. > > Searching the mail archives and googling didn't help, so I am posting > here. > > I suspect either my weak understanding of pointers means that I am > passing an incorrect argument to the setValuator function, or maybe > the puInput object is writing invalid data to the update variable. > > Please let me know how to fix this. > > thanks, > > Cory > |
From: cory b. <co...@gm...> - 2008-06-12 20:53:18
|
Here is the code: //#include <memory.h> #include <stdio.h> #include <sstream> #include <simgear/compiler.h> #include <GL/glut.h> //#include SG_GLUT_H #include <plib/fnt.h> #include <plib/pu.h> #include <string> #include <simgear/io/sg_socket.hxx> #include <simgear/io/sg_serial.hxx> #include <simgear/io/sg_file.hxx> #include "SSAircraft.hxx" #include "SSPid.hxx" using namespace std; //defines #define DECIMALS 6 #define KEY_ESCAPE 27 #define GAIN_MIN -1 //gain values for sliders MIN should be 0 or less #define GAIN_MAX 1 #define DEG_MIN -180 //target value limiters #define DEG_MAX 180 //pui gui constants #define WINDOW_X 360 //window width #define WINDOW_Y 300 //window height #define PUI_X_OFFSET 0 #define PUI_Y_OFFSET 0 #define PUI_CTRL_X_OFFSET PUI_BUTTON_WIDTH + PUI_X_GAP * 2 #define PUI_CTRL_WIDTH PUI_ARROW_WIDTH * 2 + PUI_TEXT_WIDTH + PUI_X_GAP * 2 #define PUI_LABEL_X_OFFSET #define PUI_X_GAP 10 #define PUI_Y_GAP 20 #define PUI_TEXT_WIDTH 80 #define PUI_TEXT_HEIGHT 30 #define PUI_ARROW_WIDTH 30 #define PUI_ARROW_HEIGHT 30 #define PUI_BUTTON_WIDTH 120 #define PUI_BUTTON_HEIGHT 30 #define PUI_RADIO_WIDTH 100 #define PUI_RADIO_HEIGHT 60 //global items //objects SGIOChannel *in_channel, *out_channel, *log_file; SSAircraft *sim_craft = new SSAircraft(); SSPid *aileron_pid = new SSPid(); SSPid *elevator_pid = new SSPid(); //vars bool logging = false; bool pauseSoftSim = true; char inport[ 256 ] = "5500"; char outport[ 256 ] = "5501"; int sock; float update = 1.0f; char out_file[ 1024 ] = "sLog.csv"; char save_buf[ 2 * 2048 ]; int save_len = 0; //pui widgets from PLIB library puFrame *gui_frame; //radio buttons char *controller_selector_labels[] = { "Roll", "Pitch", NULL }; puButtonBox *controller_selector; //plain old buttons puButton *pause_button, *log_button; //arrow buttons for adjusting control values puArrowButton *kp_arrow_l, *kp_arrow_r, *ki_arrow_l, *ki_arrow_r, *kd_arrow_l, *kd_arrow_r, *target_arrow_l, *target_arrow_r; //text input boxes puInput *kp_text, *ki_text, *kd_text, *target_text, *hertz_text; char *valid_input = "-.0123456789"; //valid input mask for text boxes char kp_str[ PUSTRING_MAX ], ki_str[ PUSTRING_MAX ], kd_str[ PUSTRING_MAX ], target_str[ PUSTRING_MAX ]; //labels puText *roll_err_label, *pitch_err_label, *udp_label; char roll_text[ PUSTRING_MAX ], pitch_text[ PUSTRING_MAX ]; //function prototypes void timer( int value ); bool parse_fgear_data( char *buf ); void redrawWindow( void ); void reshapeWindow( int w, int h ); string command_output( void ); void processNormalKeys( unsigned char key, int x, int y ); void init_pui_widgets( void ); void pui_callback( puObject *pob ); void gui_update( SSPid *pid ); void processMousefn ( int button, int updown, int x, int y ); void processMotionfn ( int x, int y ); int main( int argc, char **argv ) { //glut setup glutInit( &argc, argv ); glutInitDisplayMode( GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB ); glutInitWindowPosition( 100, 100 ); glutInitWindowSize( WINDOW_X, WINDOW_Y ); glutCreateWindow( "SoftSim" ); glutDisplayFunc( redrawWindow ); glutReshapeFunc( reshapeWindow ); glutIdleFunc( redrawWindow ); glutMouseFunc ( processMousefn ); // process mouse clicks glutMotionFunc ( processMotionfn ); // process mouse moves glutPassiveMotionFunc ( processMotionfn ); glutKeyboardFunc( processNormalKeys ); glEnable( GL_DEPTH_TEST ); // enable depth testing //this takes care of timing for the program glutTimerFunc( ( int )( 1000.0f/update ), timer, 0 ); //set up networking in_channel = new SGSocket( "", inport, "udp" ); out_channel = new SGSocket( "", outport, "udp" ); in_channel->open( SG_IO_IN ); out_channel->open( SG_IO_OUT ); //set up logging string f_name = out_file; log_file = new SGFile( f_name ); log_file->open( SG_IO_OUT ); //initialize PID controllers //the gains are some that work ok with the default plane aileron_pid->set_gains( 0.06, 0.004, -0.04 ); aileron_pid->set_reference( 0 ); aileron_pid->set_limits( -1, 1 ); elevator_pid->set_gains( -0.05, -0.001, 0 ); elevator_pid->set_reference( 0 ); elevator_pid->set_limits( -1, 1 ); //setup all the buttons and gui stuff init_pui_widgets(); //start glut glutMainLoop(); //clean up in_channel->close(); out_channel->close(); log_file->close(); return 0; } void timer( int value ) { char buffer[ 512 ]; size_t found; string log_str; //string to log to file int length; //do if not paused if ( !pauseSoftSim ){ //read incoming data while ( ( length = in_channel->readline( buffer, 512 ) ) > 0 ) { parse_fgear_data( buffer ); if ( logging ) { //prepare log string log_str = buffer; //find \n char and replace with comma found=log_str.find( '\n' ); if ( found!=string::npos ) { log_str.replace( found, 1, "," ); } } } string command_str = command_output(); //send outgoing data out_channel->write( command_str.c_str(), command_str.size() ); //log to file if ( logging ) { //don't log if no data from udp if ( log_str.length () > 0 ) { log_str.append( command_str ); log_file->writestring( log_str.c_str() ); //cout << command_str.c_str() << endl; //cout << log_str << endl; } } //make some updates system( "clear" ); //this is not portable. I should probably //be using the ncurses library cout.precision( DECIMALS ); cout << "Roll error: " << aileron_pid->get_error() << endl; cout << "Pitch error: " << elevator_pid->get_error() << endl; } glutTimerFunc( ( int )( 1000.0f/update ), timer, value ); } //parse incoming data from flight gear bool parse_fgear_data( char *buf ) { //variables //control double aileron, elevator, rudder, throttle; //position double latitudeDegree, longitudeDegree, altitude; //attitude double headingDegree, rollDegree, pitchDegree, sideSlip; //speed / accel double airspeed, verticalSpd, xAccel, yAccel, zAccel; //printf("%s\n", buf); string msg = buf; string::size_type begin, end; begin = 0; end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } //aileron aileron = atof( msg.substr( begin, end ).c_str() ); begin = end + 1; //elevator end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } elevator = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //rudder end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } rudder = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //throttle end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } throttle = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //latitude end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } latitudeDegree = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //longitude end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } longitudeDegree = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //altitude end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } altitude = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //roll end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } rollDegree = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //pitch end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } pitchDegree = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //heading end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } headingDegree = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //side slip end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } sideSlip = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //airspeed end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } airspeed = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //vertical speed end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } verticalSpd = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //x accel end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } xAccel = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //y accel end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } yAccel = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //z accel end = msg.find( "\n", begin ); if ( end == string::npos ) { return false; } zAccel = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //set aircraft values sim_craft->set_aileron( aileron ); sim_craft->set_elevator( elevator ); sim_craft->set_rudder( rudder ); sim_craft->set_throttle( throttle ); sim_craft->set_latitude( latitudeDegree ); sim_craft->set_longitude( longitudeDegree ); sim_craft->set_altitude( altitude ); sim_craft->set_roll( rollDegree ); sim_craft->set_pitch( pitchDegree ); sim_craft->set_heading( headingDegree ); sim_craft->set_sideslip( sideSlip ); sim_craft->set_airspeed( airspeed ); sim_craft->set_vert_speed( verticalSpd ); sim_craft->set_xaccel( xAccel ); sim_craft->set_yaccel( yAccel ); sim_craft->set_zaccel( zAccel ); return true; } string command_output( void ) { stringstream s; s.precision( DECIMALS ); s << aileron_pid->update( sim_craft->get_roll() ) << "," << elevator_pid->update( sim_craft->get_pitch() ) << endl; /* s << sim_craft->get_aileron() << "," << sim_craft->get_elevator() << "," << sim_craft->get_rudder() << "," << sim_craft->get_throttle() << endl; */ //cout << s.str() << endl; return s.str(); } void redrawWindow( void ) { puDisplay(); glutSwapBuffers(); glutPostRedisplay(); } void reshapeWindow( int w, int h ) { //I am trying to preven window resizing, but this doesn't seem to work glutReshapeWindow( WINDOW_X, WINDOW_Y ); //set window back to initial size } void processMousefn ( int button, int updown, int x, int y ) { // Invoke the PUI mouse function puMouse ( button, updown, x, y ) ; glutPostRedisplay () ; } void processMotionfn ( int x, int y ){ // Invoke the PUI mouse motion function puMouse ( x, y ) ; glutPostRedisplay () ; } void processNormalKeys(unsigned char key, int x, int y) { // Invoke the PUI keyboard function puKeyboard ( key, PU_DOWN ) ; glutPostRedisplay() ; } /********************************************************************** * Initialize pui controls *********************************************************************/ void init_pui_widgets( void ) { int curx = PUI_X_GAP * 4 + PUI_ARROW_WIDTH * 2 + PUI_TEXT_WIDTH; int cury = PUI_RADIO_HEIGHT + PUI_Y_GAP * 2; puInit(); gui_frame = new puFrame( PUI_X_OFFSET, PUI_Y_OFFSET, PUI_X_OFFSET + WINDOW_X, PUI_Y_OFFSET + WINDOW_Y ); //log button log_button = new puButton( curx, cury, "Log: sLog.csv"); log_button->setSize( PUI_BUTTON_WIDTH, PUI_BUTTON_HEIGHT ); log_button->setValue( 0 ); //logging off by default log_button->setCallback( pui_callback ); cury += PUI_Y_GAP + PUI_BUTTON_HEIGHT; //pause button pause_button = new puButton( curx, cury, "Pause" ); pause_button->setSize( PUI_BUTTON_WIDTH, PUI_BUTTON_HEIGHT ); pause_button->setValue( 1 ); //pause by default pause_button->setCallback( pui_callback ); curx = PUI_X_GAP; cury = PUI_Y_GAP; //radio buttons controller_selector = new puButtonBox ( curx, cury, curx + PUI_RADIO_WIDTH, cury + PUI_RADIO_HEIGHT, controller_selector_labels, 1 ); //value corresponds to index of item in labels array controller_selector->setCallback( pui_callback ); cury += PUI_RADIO_HEIGHT + PUI_Y_GAP; //kd items kd_arrow_l = new puArrowButton ( curx, cury, curx + PUI_ARROW_WIDTH, cury + PUI_ARROW_HEIGHT, PUARROW_LEFT ); kd_arrow_l->setCallback( pui_callback ); curx += PUI_ARROW_WIDTH + PUI_X_GAP; //kd_text kd_text = new puInput ( curx, cury, curx + PUI_TEXT_WIDTH, cury + PUI_TEXT_HEIGHT ) ; kd_text->setValidData( valid_input ); sprintf( kd_str, "%.3f", aileron_pid->get_kd() ); //format label kd_text->setValue( kd_str ); //set value to aileron gains since roll is selected by default kd_text->setLabel( "Kd" ); kd_text->setLabelPlace( PUPLACE_TOP_CENTERED ); kd_text->setCallback( pui_callback ); curx += PUI_TEXT_WIDTH + PUI_X_GAP; kd_arrow_r = new puArrowButton ( curx, cury, curx + PUI_ARROW_WIDTH, cury + PUI_ARROW_HEIGHT, PUARROW_RIGHT ); kd_arrow_r->setCallback( pui_callback ); curx = PUI_X_GAP; cury += PUI_ARROW_HEIGHT + PUI_Y_GAP; //ki items ki_arrow_l = new puArrowButton ( curx, cury, curx + PUI_ARROW_WIDTH, cury + PUI_ARROW_HEIGHT, PUARROW_LEFT ); ki_arrow_l->setCallback( pui_callback ); curx += PUI_ARROW_WIDTH + PUI_X_GAP; //ki_text ki_text = new puInput ( curx, cury, curx + PUI_TEXT_WIDTH, cury + PUI_TEXT_HEIGHT ) ; ki_text->setValidData( valid_input ); sprintf( ki_str, "%.3f", aileron_pid->get_ki() ); //format label ki_text->setValue( ki_str ); //set value to aileron gains since roll is selected by default ki_text->setLabel( "Ki" ); ki_text->setLabelPlace( PUPLACE_TOP_CENTERED ); ki_text->setCallback( pui_callback ); curx += PUI_TEXT_WIDTH + PUI_X_GAP; ki_arrow_r = new puArrowButton ( curx, cury, curx + PUI_ARROW_WIDTH, cury + PUI_ARROW_HEIGHT, PUARROW_RIGHT ); ki_arrow_r->setCallback( pui_callback ); curx = PUI_X_GAP; cury += PUI_ARROW_HEIGHT + PUI_Y_GAP; //kp items kp_arrow_l = new puArrowButton ( curx, cury, curx + PUI_ARROW_WIDTH, cury + PUI_ARROW_HEIGHT, PUARROW_LEFT ); kp_arrow_l->setCallback( pui_callback ); curx += PUI_ARROW_WIDTH + PUI_X_GAP; //kp_text kp_text = new puInput ( curx, cury, curx + PUI_TEXT_WIDTH, cury + PUI_TEXT_HEIGHT ) ; kp_text->setValidData( valid_input ); sprintf( kp_str, "%.3f", aileron_pid->get_kp() ); //format label kp_text->setValue( kp_str ); //set value to aileron gains since roll is selected by default kp_text->setLabel( "Kp" ); kp_text->setLabelPlace( PUPLACE_TOP_CENTERED ); kp_text->setCallback( pui_callback ); curx += PUI_TEXT_WIDTH + PUI_X_GAP; kp_arrow_r = new puArrowButton ( curx, cury, curx + PUI_ARROW_WIDTH, cury + PUI_ARROW_HEIGHT, PUARROW_RIGHT ); kp_arrow_r->setCallback( pui_callback ); curx = PUI_X_GAP; cury += PUI_ARROW_HEIGHT + PUI_Y_GAP; //target items target_arrow_l = new puArrowButton ( curx, cury, curx + PUI_ARROW_WIDTH, cury + PUI_ARROW_HEIGHT, PUARROW_LEFT ); target_arrow_l->setCallback( pui_callback ); curx += PUI_ARROW_WIDTH + PUI_X_GAP; //target_text target_text = new puInput ( curx, cury, curx + PUI_TEXT_WIDTH, cury + PUI_TEXT_HEIGHT ) ; target_text->setValidData( valid_input ); sprintf( target_str, "%.3f", aileron_pid->get_reference() ); //format label target_text->setValue( target_str ); //set value to aileron gains since roll is selected by default target_text->setLabel( "Target" ); target_text->setLabelPlace( PUPLACE_TOP_CENTERED ); target_text->setCallback( pui_callback ); curx += PUI_TEXT_WIDTH + PUI_X_GAP; target_arrow_r = new puArrowButton ( curx, cury, curx + PUI_ARROW_WIDTH, cury + PUI_ARROW_HEIGHT, PUARROW_RIGHT ); target_arrow_r->setCallback( pui_callback ); curx += PUI_ARROW_WIDTH + PUI_X_GAP; cury -= PUI_ARROW_HEIGHT - PUI_Y_GAP; //labels roll_err_label = new puText ( curx, cury ) ; roll_err_label->setLabel( "Roll error: 0.000" ); cury += PUI_ARROW_HEIGHT; pitch_err_label = new puText ( curx, cury ) ; pitch_err_label->setLabel( "Pitch error: 0.000" ); curx = PUI_RADIO_WIDTH + PUI_X_GAP * 2; cury = PUI_Y_GAP; udp_label = new puText ( curx, cury ) ; udp_label->setLabel( "UDP in: 5500 | UDP out: 5501" ); //hertz text input hertz_text = new puInput ( curx, cury, curx + PUI_TEXT_WIDTH, cury + PUI_TEXT_HEIGHT ) ; //hertz_text->setValidData( valid_input ); hertz_text->setValuator( &update ); hertz_text->setLabel( "Hertz" ); hertz_text->setLabelPlace( PUPLACE_TOP_CENTERED ); //hertz_text->setCallback( pui_callback ); } /********************************************************************** * pui callback *********************************************************************/ void pui_callback( puObject *pob ){ const float interval = 0.001; //increment or decrement interval //this will be 0 for roll and 1 for pitch int val = controller_selector->getValue(); bool aileron; if ( val == 0 ) { aileron = true; } else { aileron = false; } if ( pob == log_button ) { //toggle logging logging = log_button->getValue(); //cout << "log_button" << endl; } else if ( pob == pause_button ) { //toggle pause pauseSoftSim = pause_button->getValue(); //cout << "pause_button" << endl; } else if ( pob == controller_selector ) { //update gui if ( aileron ) { //update for ailerons gui_update( aileron_pid ); } else { //update for elevator gui_update( elevator_pid ); } } else if ( pob == kp_arrow_l ) { //decrement kp if ( aileron ) { aileron_pid->set_kp( aileron_pid->get_kp() - interval ); gui_update( aileron_pid ); } else { elevator_pid->set_kp( elevator_pid->get_kp() - interval ); gui_update( elevator_pid ); } } else if ( pob == kp_arrow_r ) { //increment kp if ( aileron ) { aileron_pid->set_kp( aileron_pid->get_kp() + interval ); gui_update( aileron_pid ); } else { elevator_pid->set_kp( elevator_pid->get_kp() + interval ); gui_update( elevator_pid ); } } else if ( pob == ki_arrow_l ) { //decrement ki if ( aileron ) { aileron_pid->set_ki( aileron_pid->get_ki() - interval ); gui_update( aileron_pid ); } else { elevator_pid->set_ki( elevator_pid->get_ki() - interval ); gui_update( elevator_pid ); } } else if ( pob == ki_arrow_r ) { //increment ki if ( aileron ) { aileron_pid->set_ki( aileron_pid->get_ki() + interval ); gui_update( aileron_pid ); } else { elevator_pid->set_ki( elevator_pid->get_ki() + interval ); gui_update( elevator_pid ); } } else if ( pob == kd_arrow_l ) { //decrement kd if ( aileron ) { aileron_pid->set_kd( aileron_pid->get_kd() - interval ); gui_update( aileron_pid ); } else { elevator_pid->set_kd( elevator_pid->get_kd() - interval ); gui_update( elevator_pid ); } } else if ( pob == kd_arrow_r ) { //increment kd if ( aileron ) { aileron_pid->set_kd( aileron_pid->get_kd() + interval ); gui_update( aileron_pid ); } else { elevator_pid->set_kd( elevator_pid->get_kd() + interval ); gui_update( elevator_pid ); } } else if ( pob == target_arrow_l ) { //decrement target if ( aileron ) { aileron_pid->set_reference( aileron_pid->get_reference() - 1 ); gui_update( aileron_pid ); } else { elevator_pid->set_reference( elevator_pid->get_reference() - 1 ); gui_update( elevator_pid ); } } else if ( pob == target_arrow_r ) { //increment target if ( aileron ) { aileron_pid->set_reference( aileron_pid->get_reference() + 1 ); gui_update( aileron_pid ); } else { elevator_pid->set_reference( elevator_pid->get_reference() + 1 ); gui_update( elevator_pid ); } } else { cout << "Unknown callback to pui_callback" << endl; } } void gui_update( SSPid *pid ) { sprintf( kp_str, "%.3f", pid->get_kp() ); //format label kp_text->setValue( kp_str ); sprintf( ki_str, "%.3f", pid->get_ki() ); //format label ki_text->setValue( ki_str ); sprintf( kd_str, "%.3f", pid->get_kd() ); //format label kd_text->setValue( kd_str ); sprintf( target_str, "%.3f", pid->get_reference() ); //format label target_text->setValue( target_str ); } On Thu, Jun 12, 2008 at 4:42 PM, Fay John F Dr CTR USAF 46 SK <joh...@eg...> wrote: > Hmmm ... unless somebody else steps in, please forward me a copy of the > offending code. I've tried putting in your code snippet and the program > works just fine for me, so evidently something else is going on. > > John F. Fay > Technical Fellow > Jacobs Technology TEAS Group > 850-883-1294 > > -----Original Message----- > From: pli...@li... > [mailto:pli...@li...] On Behalf Of cory > barton > Sent: Thursday, June 12, 2008 3:19 PM > To: PLIB Users > Subject: [Plib-users] (cory vs. pui) The attack of setValuator > > I found the following in the PUI documentation today: > There are many occasions when you'd really like to have the PUI widget > directly drive and/or reflect the value of some memory location in the > application code. These calls let you do that: > > void puObject::setValuator ( int *i ) ; > void puObject::setValuator ( float *f ) ; > void puObject::setValuator ( char *s ) ; > > > Once you make one of these calls, PUI will automatically update the > memory location indicated with the current value of the widget > whenever it changes - and also update the appearance of the widget to > reflect the value stored in that memory location whenever the widget > is redrawn. This is often a lot more convenient than using a callback > function to register changes in the widget's value. > > So I tried it out: > //global variable > float update = 1.0f; > > //initialize my puInput inside a function > //hertz text input > hertz_text = new puInput ( curx, cury, > curx + > PUI_TEXT_WIDTH, > cury + > PUI_TEXT_HEIGHT ) ; > hertz_text->setValuator( &update ); > hertz_text->setLabel( "Hertz" ); > hertz_text->setLabelPlace( PUPLACE_TOP_CENTERED ); > > > This compiles, and runs. > > It seems to work correctly as long as I do not remove all of the > characters from the puInput box. However if I am trying to change the > value, when I am typing in the new value, if the new value ever > becomes a non valid float value, then the program crashes. For example > if I want to change 1.0 to 2.0 and I delete 1.0 so I can type 2.0, > then instant crash. I can change from 1.0 to 2.0 if I type the 2 after > the 1, and then erase the 1. > > Searching the mail archives and googling didn't help, so I am posting > here. > > I suspect either my weak understanding of pointers means that I am > passing an incorrect argument to the setValuator function, or maybe > the puInput object is writing invalid data to the update variable. > > Please let me know how to fix this. > > thanks, > > Cory > > ------------------------------------------------------------------------ > - > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > |
From: Fay J. F Dr C. U. 46 S. <joh...@eg...> - 2008-06-12 20:42:34
|
Hmmm ... unless somebody else steps in, please forward me a copy of the offending code. I've tried putting in your code snippet and the program works just fine for me, so evidently something else is going on. John F. Fay Technical Fellow Jacobs Technology TEAS Group 850-883-1294 -----Original Message----- From: pli...@li... [mailto:pli...@li...] On Behalf Of cory barton Sent: Thursday, June 12, 2008 3:19 PM To: PLIB Users Subject: [Plib-users] (cory vs. pui) The attack of setValuator I found the following in the PUI documentation today: There are many occasions when you'd really like to have the PUI widget directly drive and/or reflect the value of some memory location in the application code. These calls let you do that: void puObject::setValuator ( int *i ) ; void puObject::setValuator ( float *f ) ; void puObject::setValuator ( char *s ) ; Once you make one of these calls, PUI will automatically update the memory location indicated with the current value of the widget whenever it changes - and also update the appearance of the widget to reflect the value stored in that memory location whenever the widget is redrawn. This is often a lot more convenient than using a callback function to register changes in the widget's value. So I tried it out: //global variable float update = 1.0f; //initialize my puInput inside a function //hertz text input hertz_text = new puInput ( curx, cury, curx + PUI_TEXT_WIDTH, cury + PUI_TEXT_HEIGHT ) ; hertz_text->setValuator( &update ); hertz_text->setLabel( "Hertz" ); hertz_text->setLabelPlace( PUPLACE_TOP_CENTERED ); This compiles, and runs. It seems to work correctly as long as I do not remove all of the characters from the puInput box. However if I am trying to change the value, when I am typing in the new value, if the new value ever becomes a non valid float value, then the program crashes. For example if I want to change 1.0 to 2.0 and I delete 1.0 so I can type 2.0, then instant crash. I can change from 1.0 to 2.0 if I type the 2 after the 1, and then erase the 1. Searching the mail archives and googling didn't help, so I am posting here. I suspect either my weak understanding of pointers means that I am passing an incorrect argument to the setValuator function, or maybe the puInput object is writing invalid data to the update variable. Please let me know how to fix this. thanks, Cory ------------------------------------------------------------------------ - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ plib-users mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-users |
From: cory b. <co...@gm...> - 2008-06-12 20:18:46
|
I found the following in the PUI documentation today: There are many occasions when you'd really like to have the PUI widget directly drive and/or reflect the value of some memory location in the application code. These calls let you do that: void puObject::setValuator ( int *i ) ; void puObject::setValuator ( float *f ) ; void puObject::setValuator ( char *s ) ; Once you make one of these calls, PUI will automatically update the memory location indicated with the current value of the widget whenever it changes - and also update the appearance of the widget to reflect the value stored in that memory location whenever the widget is redrawn. This is often a lot more convenient than using a callback function to register changes in the widget's value. So I tried it out: //global variable float update = 1.0f; //initialize my puInput inside a function //hertz text input hertz_text = new puInput ( curx, cury, curx + PUI_TEXT_WIDTH, cury + PUI_TEXT_HEIGHT ) ; hertz_text->setValuator( &update ); hertz_text->setLabel( "Hertz" ); hertz_text->setLabelPlace( PUPLACE_TOP_CENTERED ); This compiles, and runs. It seems to work correctly as long as I do not remove all of the characters from the puInput box. However if I am trying to change the value, when I am typing in the new value, if the new value ever becomes a non valid float value, then the program crashes. For example if I want to change 1.0 to 2.0 and I delete 1.0 so I can type 2.0, then instant crash. I can change from 1.0 to 2.0 if I type the 2 after the 1, and then erase the 1. Searching the mail archives and googling didn't help, so I am posting here. I suspect either my weak understanding of pointers means that I am passing an incorrect argument to the setValuator function, or maybe the puInput object is writing invalid data to the update variable. Please let me know how to fix this. thanks, Cory |
From: cory b. <co...@gm...> - 2008-06-12 15:32:03
|
The link is here: http://plib.sourceforge.net/download.html#DEMOS this is the link that does not work http://plib.sourceforge.net/dist/p-guide-0.0.1.tar.gz On Thu, Jun 12, 2008 at 11:07 AM, Fay John F Dr CTR USAF 46 SK <joh...@eg...> wrote: > plib/demos/p-guide ? > > I'm not sure what link you are referring to. > > John F. Fay > Technical Fellow > Jacobs Technology TEAS Group > 850-883-1294 > > -----Original Message----- > From: pli...@li... > [mailto:pli...@li...] On Behalf Of cory > barton > Sent: Thursday, June 12, 2008 9:53 AM > To: PLIB Users > Subject: [Plib-users] A tool for designing PUI interface panels. > > Does this tool still exist anywhere? The link to it is broken. > > ------------------------------------------------------------------------ > - > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > |
From: Fay J. F Dr C. U. 46 S. <joh...@eg...> - 2008-06-12 15:07:11
|
plib/demos/p-guide ? I'm not sure what link you are referring to. John F. Fay Technical Fellow Jacobs Technology TEAS Group 850-883-1294 -----Original Message----- From: pli...@li... [mailto:pli...@li...] On Behalf Of cory barton Sent: Thursday, June 12, 2008 9:53 AM To: PLIB Users Subject: [Plib-users] A tool for designing PUI interface panels. Does this tool still exist anywhere? The link to it is broken. ------------------------------------------------------------------------ - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ plib-users mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-users |
From: cory b. <co...@gm...> - 2008-06-12 14:53:06
|
Does this tool still exist anywhere? The link to it is broken. |
From: cory b. <co...@gm...> - 2008-06-11 20:28:29
|
Thank you everyone, that fixed it. Cory On Wed, Jun 11, 2008 at 4:22 PM, Fay John F Dr CTR USAF 46 SK <joh...@eg...> wrote: > Sounds like I have one less thing to do this evening. > > Jan, thank you very much. > > John F. Fay > Technical Fellow > Jacobs Technology TEAS Group > 850-883-1294 > > -----Original Message----- > From: pli...@li... > [mailto:pli...@li...] On Behalf Of Jan > Reucker > Sent: Wednesday, June 11, 2008 3:21 PM > To: pli...@li... > Subject: Re: [Plib-users] Problem with setLabel, weirdness ensues. > > Am Wed, 11 Jun 2008 15:55:57 -0400 schrieb "cory barton" > <co...@gm...>: > > >> void init_pui_widgets( void ) { >> //unused variable bbb >> char bbb[ PUSTRING_MAX ]; //if I remove this setLabel() fails! >> char txt[ PUSTRING_MAX ]; >> puInit(); > > Hi, > > this won't work, because txt is only allocated on the stack (local > variable), and it will be destroyed at the end of the function. > Introducing bbb cures the problem because it pushes txt further down > on the stack, thus avoiding that it is overwritten by the rest of > your code. If you introduce another function that uses more stack > space, chances are that the above code won't work anymore. > > puObject::setLabel() does not copy the string; it just copies the > pointer to the string. Therefore you have to provide a buffer > that doesn't go out of scope as long as your widget exists. > > Kind regards, > Jan R. > > -- > Jan Reucker > email: jan dot reucker at web dot de > web: http://www.reucker-online.de > > ------------------------------------------------------------------------ > - > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > |
From: Fay J. F Dr C. U. 46 S. <joh...@eg...> - 2008-06-11 20:22:25
|
Sounds like I have one less thing to do this evening. Jan, thank you very much. John F. Fay Technical Fellow Jacobs Technology TEAS Group 850-883-1294 -----Original Message----- From: pli...@li... [mailto:pli...@li...] On Behalf Of Jan Reucker Sent: Wednesday, June 11, 2008 3:21 PM To: pli...@li... Subject: Re: [Plib-users] Problem with setLabel, weirdness ensues. Am Wed, 11 Jun 2008 15:55:57 -0400 schrieb "cory barton" <co...@gm...>: > void init_pui_widgets( void ) { > //unused variable bbb > char bbb[ PUSTRING_MAX ]; //if I remove this setLabel() fails! > char txt[ PUSTRING_MAX ]; > puInit(); Hi, this won't work, because txt is only allocated on the stack (local variable), and it will be destroyed at the end of the function. Introducing bbb cures the problem because it pushes txt further down on the stack, thus avoiding that it is overwritten by the rest of your code. If you introduce another function that uses more stack space, chances are that the above code won't work anymore. puObject::setLabel() does not copy the string; it just copies the pointer to the string. Therefore you have to provide a buffer that doesn't go out of scope as long as your widget exists. Kind regards, Jan R. -- Jan Reucker email: jan dot reucker at web dot de web: http://www.reucker-online.de ------------------------------------------------------------------------ - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ plib-users mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-users |
From: Jan R. <slo...@gm...> - 2008-06-11 20:20:39
|
Am Wed, 11 Jun 2008 15:55:57 -0400 schrieb "cory barton" <co...@gm...>: > void init_pui_widgets( void ) { > //unused variable bbb > char bbb[ PUSTRING_MAX ]; //if I remove this setLabel() fails! > char txt[ PUSTRING_MAX ]; > puInit(); Hi, this won't work, because txt is only allocated on the stack (local variable), and it will be destroyed at the end of the function. Introducing bbb cures the problem because it pushes txt further down on the stack, thus avoiding that it is overwritten by the rest of your code. If you introduce another function that uses more stack space, chances are that the above code won't work anymore. puObject::setLabel() does not copy the string; it just copies the pointer to the string. Therefore you have to provide a buffer that doesn't go out of scope as long as your widget exists. Kind regards, Jan R. -- Jan Reucker email: jan dot reucker at web dot de web: http://www.reucker-online.de |
From: cory b. <co...@gm...> - 2008-06-11 19:55:58
|
I am ok with public code on this one. I put the GPL stuff on top of the file. Here is the email I sent to John: Wow! Fantastic response time! Thank you. I have been banging my head on this problem for while now. I attached the main file that I am working with. The relevant bits(to the best of my knowledge) are located in the following functions: main: line 96 init_pui_widgets: line 453 pui_callback: line 516 I am doing the development in Ubuntu. I will send you the supporting classes for this program if needed. Let me know if you still want me to make a small sample program to demonstrate the issue. Also the char array for radio button labels: char *controller_selector_labels[] = { "Roll", "Pitch", NULL }; gives a warning: softSim.cxx:76: warning: deprecated conversion from string constant to 'char*' Do you know how to fix that? Thanks, Cory Here is the code: /********************************************************************** * softSim.cxx * Software simulation interface for FlightGear * * Written by Cory Barton, started May 2008 * Copyright (C) 2008 Cory Barton co...@gm... * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *********************************************************************/ //#include <memory.h> #include <stdio.h> #include <sstream> #include <simgear/compiler.h> #include <GL/glut.h> //#include SG_GLUT_H #include <plib/fnt.h> #include <plib/pu.h> #include <string> #include <simgear/io/sg_socket.hxx> #include <simgear/io/sg_serial.hxx> #include <simgear/io/sg_file.hxx> #include "SSAircraft.hxx" #include "SSPid.hxx" using namespace std; //defines #define DECIMALS 6 #define KEY_ESCAPE 27 #define WINDOW_X 350 //window width #define WINDOW_Y 350 //window height #define PUI_X_OFFSET 0 #define PUI_Y_OFFSET 0 #define GAIN_MIN -1 //gain values for sliders MIN should be 0 or less #define GAIN_MAX 1 #define DEG_MIN -180 //target value limiters #define DEG_MAX 180 //global items //objects SGIOChannel *in_channel, *out_channel, *log_file; SSAircraft *sim_craft = new SSAircraft(); SSPid *aileron_pid = new SSPid(); SSPid *elevator_pid = new SSPid(); //vars bool slaved = false; bool network = false; bool serial = false; bool output = false; bool logging = false; bool pauseSoftSim = true; char baud[ 256 ] = "4800"; char inport[ 256 ] = "5500"; char outport[ 256 ] = "5501"; char device [256 ] = "/dev/ttyS0"; int sock; float update = 1.0f; char out_file[ 1024 ] = "softSimLog.csv"; char save_buf[ 2 * 2048 ]; int save_len = 0; //pui widgets from PLIB library //puGroup *gui_group; puFrame *gui_frame; char *controller_selector_labels[] = { "Roll", "Pitch", NULL }; puButtonBox *controller_selector; puButton *pause_button, *log_button; puSlider *kp_slider, *ki_slider, *kd_slider, *target_slider; //function prototypes void print_help( void ); void timer( int value ); bool parse_fgear_data( char *buf ); void redrawWindow( void ); void reshapeWindow( int w, int h ); string command_output( void ); void processNormalKeys( unsigned char key, int x, int y ); void init_pui_widgets( void ); void pui_callback( puObject *pob ); void processMousefn ( int button, int updown, int x, int y ); void processMotionfn ( int x, int y ); int main( int argc, char **argv ) { // parse arguments for ( int i = 1; i < argc; i++ ) { if ( sscanf(argv[i], "--udp-in=%s", inport ) == 1 ) { slaved = true; network = true; serial = false; } else if ( sscanf( argv[i], "--udp-out=%s", outport ) == 1 ) { output = true; } else if ( sscanf( argv[i], "--serial=%s", device ) == 1 ) { slaved = true; serial = true; network = false; } else if ( sscanf( argv[i], "--baud=%s", baud ) == 1 ) { // do nothing } else if ( sscanf( argv[i], "--update=%f", &update ) == 1 ) { // do nothing } else if ( sscanf( argv[i], "--log=%s", out_file ) == 1 ) { logging = true; } else if ( strcmp( argv[i], "--help" ) == 0 ) { print_help(); return 0; } else { print_help(); fprintf( stderr, "%s: unknown flag \"%s\".\n", argv[0], argv[i] ); return 1; } } glutInit( &argc, argv ); glutInitDisplayMode( GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB ); glutInitWindowPosition( 100, 100 ); glutInitWindowSize( WINDOW_X, WINDOW_Y ); glutCreateWindow( "SoftSim" ); glutDisplayFunc( redrawWindow ); glutReshapeFunc( reshapeWindow ); glutIdleFunc( redrawWindow ); glutMouseFunc ( processMousefn ); // process mouse clicks glutMotionFunc ( processMotionfn ); // process mouse moves glutPassiveMotionFunc ( processMotionfn ); glutKeyboardFunc( processNormalKeys ); // enable depth testing glEnable( GL_DEPTH_TEST ); if ( slaved ) { glutTimerFunc( ( int )( 1000.0f/update ), timer, 0 ); if ( network ) { in_channel = new SGSocket( "", inport, "udp" ); if ( output ) { out_channel = new SGSocket( "", outport, "udp" ); } } else if ( serial ) { in_channel = new SGSerial( device, baud ); } else { printf( "unknown input, defaulting to network on port 5500\n" ); in_channel = new SGSocket( "", "5500", "udp" ); } in_channel->open( SG_IO_IN ); if ( output ) { out_channel->open( SG_IO_OUT ); } if ( logging ) { string f_name = out_file; log_file = new SGFile( f_name ); log_file->open( SG_IO_OUT ); } } //initialize PID controllers aileron_pid->set_gains( 0.06, 0.004, -0.04 ); aileron_pid->set_reference( 0 ); aileron_pid->set_limits( -1, 1 ); elevator_pid->set_gains( -0.05, -0.001, 0 ); elevator_pid->set_reference( 0 ); elevator_pid->set_limits( -1, 1 ); init_pui_widgets(); glutMainLoop(); if ( slaved ) { in_channel->close(); if ( output ) { out_channel->close(); } if ( logging ) { log_file->close(); } } return 0; } void timer( int value ) { char buffer[ 512 ]; size_t found; string log_str; //string to log to file int length; if ( !pauseSoftSim ){ //read incoming data while ( ( length = in_channel->readline( buffer, 512 ) ) > 0 ) { parse_fgear_data( buffer ); if ( logging ) { //prepare log string log_str = buffer; //find \n char and replace with comma found=log_str.find( '\n' ); if ( found!=string::npos ) { log_str.replace( found, 1, "," ); } } } string command_str = command_output(); if ( output ) { //send outgoing data out_channel->write( command_str.c_str(), command_str.size() ); } //log to file if ( logging ) { //don't log if no data from udp if ( log_str.length () > 0 ) { log_str.append( command_str ); log_file->writestring( log_str.c_str() ); //cout << command_str.c_str() << endl; //cout << log_str << endl; } } //make some updates system( "clear" ); //this is not portable. I should probably //be using the ncurses library cout.precision( DECIMALS ); cout << "Roll error: " << aileron_pid->get_error() << endl; cout << "Pitch error: " << elevator_pid->get_error() << endl; } glutTimerFunc( ( int )( 1000.0f/update ), timer, value ); } //parse incoming data from flight gear bool parse_fgear_data( char *buf ) { //variables //control double aileron, elevator, rudder, throttle; //position double latitudeDegree, longitudeDegree, altitude; //attitude double headingDegree, rollDegree, pitchDegree, sideSlip; //speed / accel double airspeed, verticalSpd, xAccel, yAccel, zAccel; //printf("%s\n", buf); string msg = buf; string::size_type begin, end; begin = 0; end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } //aileron aileron = atof( msg.substr( begin, end ).c_str() ); begin = end + 1; //elevator end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } elevator = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //rudder end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } rudder = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //throttle end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } throttle = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //latitude end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } latitudeDegree = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //longitude end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } longitudeDegree = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //altitude end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } altitude = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //roll end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } rollDegree = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //pitch end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } pitchDegree = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //heading end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } headingDegree = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //side slip end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } sideSlip = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //airspeed end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } airspeed = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //vertical speed end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } verticalSpd = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //x accel end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } xAccel = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //y accel end = msg.find( ",", begin ); if ( end == string::npos ) { return false; } yAccel = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //z accel end = msg.find( "\n", begin ); if ( end == string::npos ) { return false; } zAccel = atof( msg.substr( begin, end - begin ).c_str() ); begin = end + 1; //set aircraft values sim_craft->set_aileron( aileron ); sim_craft->set_elevator( elevator ); sim_craft->set_rudder( rudder ); sim_craft->set_throttle( throttle ); sim_craft->set_latitude( latitudeDegree ); sim_craft->set_longitude( longitudeDegree ); sim_craft->set_altitude( altitude ); sim_craft->set_roll( rollDegree ); sim_craft->set_pitch( pitchDegree ); sim_craft->set_heading( headingDegree ); sim_craft->set_sideslip( sideSlip ); sim_craft->set_airspeed( airspeed ); sim_craft->set_vert_speed( verticalSpd ); sim_craft->set_xaccel( xAccel ); sim_craft->set_yaccel( yAccel ); sim_craft->set_zaccel( zAccel ); return true; } string command_output( void ) { stringstream s; s.precision( DECIMALS ); s << aileron_pid->update( sim_craft->get_roll() ) << "," << elevator_pid->update( sim_craft->get_pitch() ) << endl; /* s << sim_craft->get_aileron() << "," << sim_craft->get_elevator() << "," << sim_craft->get_rudder() << "," << sim_craft->get_throttle() << endl; */ //cout << s.str() << endl; return s.str(); } void redrawWindow( void ) { puDisplay(); glutSwapBuffers(); glutPostRedisplay(); } void reshapeWindow( int w, int h ) { glutReshapeWindow( WINDOW_X, WINDOW_Y ); //set window back to initial size } void processMousefn ( int button, int updown, int x, int y ) { // Invoke the PUI mouse function puMouse ( button, updown, x, y ) ; glutPostRedisplay () ; } void processMotionfn ( int x, int y ){ // Invoke the PUI mouse motion function puMouse ( x, y ) ; glutPostRedisplay () ; } void processNormalKeys(unsigned char key, int x, int y) { // Invoke the PUI keyboard function puKeyboard ( key, PU_DOWN ) ; glutPostRedisplay() ; } /********************************************************************** * Initialize pui controls *********************************************************************/ void init_pui_widgets( void ) { //unused variable bbb char bbb[ PUSTRING_MAX ]; //if I remove this setLabel() fails! char txt[ PUSTRING_MAX ]; puInit(); gui_frame = new puFrame( PUI_X_OFFSET, PUI_Y_OFFSET, PUI_X_OFFSET + WINDOW_X, PUI_Y_OFFSET + WINDOW_Y ); //radio buttons controller_selector = new puButtonBox ( 10, 200, 90, 270, controller_selector_labels, 1 ); //value corresponds to index of item in labels array controller_selector->setCallback( pui_callback ); //kp slider kp_slider = new puSlider ( 100, 60, 200, TRUE ); kp_slider->setMinValue( GAIN_MIN ); kp_slider->setMaxValue( GAIN_MAX ); kp_slider->setValue( ( float ) aileron_pid->get_kp() ); //set value to aileron gains since roll is selected by default sprintf( txt, "Kp: %.3f", aileron_pid->get_kp() ); //format label kp_slider->setLabel( txt ); cout << txt << endl; kp_slider->setLabelPlace( PUPLACE_TOP_CENTERED ); kp_slider->setCallback( pui_callback ); //ki slider ki_slider = new puSlider ( 140, 60, 200, TRUE ); ki_slider->setMinValue( GAIN_MIN ); ki_slider->setMaxValue( GAIN_MAX ); ki_slider->setValue( ( float ) aileron_pid->get_ki() ); ki_slider->setLabel( "Ki" ); ki_slider->setLabelPlace( PUPLACE_TOP_CENTERED ); ki_slider->setCallback( pui_callback ); //kd slider kd_slider = new puSlider ( 180, 60, 200, TRUE ); kd_slider->setMinValue( GAIN_MIN ); kd_slider->setMaxValue( GAIN_MAX ); kd_slider->setValue( ( float ) aileron_pid->get_kd() ); kd_slider->setLabel( txt ); kd_slider->setLabelPlace( PUPLACE_TOP_CENTERED ); kd_slider->setCallback( pui_callback ); //target slider target_slider = new puSlider ( 10, 30, 330, FALSE, 20); target_slider->setMinValue( DEG_MIN ); target_slider->setMaxValue( DEG_MAX ); target_slider->setValue( ( float ) aileron_pid->get_reference() ); target_slider->setLabel( "Target" ); target_slider->setLabelPlace( PUPLACE_BOTTOM_CENTERED ); target_slider->setCallback( pui_callback ); //pause button pause_button = new puButton( 210, 130, "Pause" ); pause_button->setSize( 60, 30 ); pause_button->setValue( 1 ); //pause by default pause_button->setCallback( pui_callback ); //log button log_button = new puButton( 210, 80, "Log" ); log_button->setSize( 60, 30 ); log_button->setValue( 0 ); //logging off by default log_button->setCallback( pui_callback ); } /********************************************************************** * pui callback *********************************************************************/ void pui_callback( puObject *pob ){ //this will be 0 for roll and 1 for pitch int val = controller_selector->getValue(); //unused variable bbb char bbb[ PUSTRING_MAX ]; //trying to make setLabel work char txt[ PUSTRING_MAX ]; if ( pob == log_button ) { //toggle logging logging = log_button->getValue(); //cout << "log_button" << endl; } else if ( pob == pause_button ) { //toggle pause pauseSoftSim = pause_button->getValue(); //cout << "pause_button" << endl; } else if ( pob == kp_slider ) { //update kp if ( val == 0 ) { aileron_pid->set_kp( ( double ) kp_slider->getValue() ); sprintf( txt, "Kp: %.3f", aileron_pid->get_kp() ); //format label kp_slider->setLabel( txt ); //BROKEN } else { elevator_pid->set_kp( ( double ) kp_slider->getValue() ); sprintf( txt, "Kp: %.3f", elevator_pid->get_kp() ); //format label kp_slider->setLabel( txt ); //BROKEN } //cout << "kp_slider" << endl; } else if ( pob == ki_slider ) { //update ki if ( val == 0 ) { aileron_pid->set_ki( ( double ) ki_slider->getValue() ); } else { elevator_pid->set_ki( ( double ) ki_slider->getValue() ); } //cout << "ki_slider" << endl; } else if ( pob == kd_slider ) { //update kd if ( val == 0 ) { aileron_pid->set_kd( ( double ) kd_slider->getValue() ); } else { elevator_pid->set_kd( ( double ) kd_slider->getValue() ); } //cout << "kd_slider" << endl; } else if ( pob == target_slider ) { //update reference if ( val == 0 ) { aileron_pid->set_reference( ( double ) target_slider->getValue() ); } else { elevator_pid->set_reference( ( double ) target_slider->getValue() ); } //cout << "target_slider" << endl; } else if ( pob == controller_selector ) { //update gui if ( val == 0 ) { target_slider->setValue( ( float ) aileron_pid->get_reference() ); kp_slider->setValue( ( float ) aileron_pid->get_kp() ); ki_slider->setValue( ( float ) aileron_pid->get_ki() ); kd_slider->setValue( ( float ) aileron_pid->get_kd() ); } else { target_slider->setValue( ( float ) elevator_pid->get_reference() ); kp_slider->setValue( ( float ) elevator_pid->get_kp() ); ki_slider->setValue( ( float ) elevator_pid->get_ki() ); kd_slider->setValue( ( float ) elevator_pid->get_kd() ); } } else { cout << "Unknown callback to pui_callback" << endl; } } void print_help( void ) { printf("softSim: a software simulation interface for FlightGear\n\nUsage:\n"); printf(" --help Prints this help message\n"); printf(" --update=x Update rate in Hertz\n"); printf(" --udp-in=x Input read from UDP socket at specified port (defaults to 5500)\n"); printf(" This is essential, so do not ommit this flag\n"); printf(" --udp-out=x Output to UDP socket at specified port (defaults to 5501)\n"); printf(" --serial=dev Input read from serial port with specified device\n"); printf(" --baud=x Set serial port baud rate (defaults to 4800)\n"); printf(" --log=file Log to file\n"); } On Wed, Jun 11, 2008 at 3:49 PM, Fay John F Dr CTR USAF 46 SK <joh...@eg...> wrote: > Because I am giving him a private e-mail address to send sample code to. > > Sorry ... I didn't mean to sound hush-hush. I will definitely publish > the fix if and when I find it. > > John F. Fay > Technical Fellow > Jacobs Technology TEAS Group > 850-883-1294 > > -----Original Message----- > From: pli...@li... > [mailto:pli...@li...] On Behalf Of M&M > Sent: Wednesday, June 11, 2008 2:45 PM > To: PLIB Users > Subject: Re: [Plib-users] Problem with setLabel, weirdness ensues. > > Hi, > > Why contact seperately? Why not to the mailing list? > > Cheers > > > > > > On Wed, Jun 11, 2008 at 8:30 PM, Fay John F Dr CTR USAF 46 SK > <joh...@eg...> wrote: > > > Cory, > > That is indeed weird. I will contact you separately > about it. > > John F. Fay > Technical Fellow > Jacobs Technology TEAS Group > 850-883-1294 > > > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > |
From: M&M <gon...@gm...> - 2008-06-11 19:55:53
|
Ok, no problem, Good luck solving Cory problem. On Wed, Jun 11, 2008 at 8:49 PM, Fay John F Dr CTR USAF 46 SK < joh...@eg...> wrote: > Because I am giving him a private e-mail address to send sample code to. > > Sorry ... I didn't mean to sound hush-hush. I will definitely publish > the fix if and when I find it. > > John F. Fay > Technical Fellow > Jacobs Technology TEAS Group > 850-883-1294 > > -----Original Message----- > From: pli...@li... > [mailto:pli...@li...] On Behalf Of M&M > Sent: Wednesday, June 11, 2008 2:45 PM > To: PLIB Users > Subject: Re: [Plib-users] Problem with setLabel, weirdness ensues. > > Hi, > > Why contact seperately? Why not to the mailing list? > > Cheers > > > > > > On Wed, Jun 11, 2008 at 8:30 PM, Fay John F Dr CTR USAF 46 SK > <joh...@eg...> wrote: > > > Cory, > > That is indeed weird. I will contact you separately > about it. > > John F. Fay > Technical Fellow > Jacobs Technology TEAS Group > 850-883-1294 > > > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > |
From: Fay J. F Dr C. U. 46 S. <joh...@eg...> - 2008-06-11 19:49:27
|
Because I am giving him a private e-mail address to send sample code to. Sorry ... I didn't mean to sound hush-hush. I will definitely publish the fix if and when I find it. John F. Fay Technical Fellow Jacobs Technology TEAS Group 850-883-1294 -----Original Message----- From: pli...@li... [mailto:pli...@li...] On Behalf Of M&M Sent: Wednesday, June 11, 2008 2:45 PM To: PLIB Users Subject: Re: [Plib-users] Problem with setLabel, weirdness ensues. Hi, Why contact seperately? Why not to the mailing list? Cheers On Wed, Jun 11, 2008 at 8:30 PM, Fay John F Dr CTR USAF 46 SK <joh...@eg...> wrote: Cory, That is indeed weird. I will contact you separately about it. John F. Fay Technical Fellow Jacobs Technology TEAS Group 850-883-1294 |