Re: Question regarding printing to terminal e.g. variable values etc.
Richard Vaughan <[email protected]>
| Newsgroups | gmane.science.robotics.playerstage |
|---|---|
| Message-ID | <[email protected]> |
adding a newline to the end of your printf will flush stdout. printf( "test\n" ); this is standard C stuff, and not specific to P/S. Richard/ On Mon, Jan 10, 2011 at 9:14 PM, Rich Mattes <[email protected]> wrote: > On 1/10/2011 10:05 AM, Lana Eliason wrote: >> Hi all, >> >> I'm very new to the player/stage environment and am currently having a >> few issues. I am using stage 3.2.2 in Fedora 12. >> >> I'm trying to code some c++ for making one robot follow the other >> which is doing some odd things, hence I am trying to track what is >> going on. My initial thought is to get the code to print out the >> values of variables it is using, however the standard printf command >> e.g. printf("test"); ...which I have been recommended to use doesn't >> output anything. It seems it just skips over this line entirely. Can >> anybody please tell me why this might be and/or how else to output >> values? >> >> Also, is there any more newbie-friendly way of coding for >> player/stage? Currently i'm just using emacs and compiling it in the >> terminal - its not exactly as convenient to do as coding in say, >> Visual Studio which i'm used to... The lack of any form of debugging >> is proving a bit of a pain. >> >> Any advice would really be very much appreciated. >> >> Thank you :) >> >> Lana > > Hello, > > First off, are you trying to write a Player client to control your > robots, or are you trying to write a Stage controller? You only mention > that you're using Stage. Also, are you getting any error messages or > other output? The lack of output from printf could mean your program is > never reaching the printf call, which could mean you have an error > somewhere. It could also mean that your program crashes before it > flushes the output buffer, you can add a call to fflush(stdout); after > each printf() to ensure everything you're sending to stdout will show > up. Without more information about your setup, it's hard to tell what > exactly is going on. > > The best way to debug your code is to use a tool like gdb. Its command > line interface isn't terribly friendly at first, but it's pretty > powerful once you get to know it. There are other options though: if > you're into graphical IDE's, you might try installing Eclipse (su -c > 'yum install eclipse-cdt') and using its C/C++ development tools to > create a C++ project to write your code. Once you set up the include > paths and libraries for your project to point to Player or Stage, you > should be able to debug a player client from within Eclipse. Eclipse > has pretty good gdb integration, you can set breakpoints from within the > editor, etc. You could also go the emacs route and do everything from > the emacs environment (code, gdb, gcc, etc.) There are lots of emacs > tutorials floating around on the net. > > Rich > > ------------------------------------------------------------------------------ > Gaining the trust of online customers is vital for the success of any company > that requires sensitive data to be transmitted over the Web. Learn how to > best implement a security strategy that keeps consumers' information secure > and instills the confidence they need to proceed with transactions. > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > Playerstage-developers mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/playerstage-developers > ------------------------------------------------------------------------------ Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl