Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Wireless debug print ?? (http://www.chiefdelphi.com/forums/showthread.php?t=74765)

vamfun 17-02-2009 04:28

Wireless debug print ??
 
We are using C++ and want to use debug print statements to send data over the wireless data link and display it on a laptop.

We are aware of the LCD print capability and use it for small prints but large data dumps require a laptop. We have the TCP/IP communications going, but not quite sure how to send things to the Terminal window.

Does anyone have some sample code for this.

SuperBK 17-02-2009 10:25

Re: Wireless debug print ??
 
Juse use printf and to see the output, open a target console. Right click on the target, select "Target Tools" and "Console". You don't have to be running in debug mode to see the output.
Brian

Redneck 17-02-2009 18:47

Re: Wireless debug print ??
 
Quote:

Originally Posted by SuperBK (Post 822822)
Juse use printf and to see the output, open a target console. Right click on the target, select "Target Tools" and "Console". You don't have to be running in debug mode to see the output.
Brian

We tried that, but it didn't work. The console it brought up was completely blank. There were no error messages or anything (at least not that I recall) that might indicate what happened.

radau 17-02-2009 19:00

Re: Wireless debug print ??
 
Quote:

Originally Posted by SuperBK (Post 822822)
Juse use printf and to see the output, open a target console. Right click on the target, select "Target Tools" and "Console". You don't have to be running in debug mode to see the output.
Brian

They want to use wifi to retrieve the output, which (using printf) is spat out to the serial on the cRio (which requires a physical connection). You could use a serial/wireless adapter ($100) :ahh:.

Or maybe if you write your debugging messages to a file on the cRio, you can retrieve them by ftp-ing to it wirelessly (10.te.am.2, using "root" and no password). You could probably even watch the file grow as if it were real console output, using something like ftptail.

Here's the code you need to write stuff to files:

Code:

#include <stdio.h>
#include <stdarg.h>

FILE *debugf;

/**
 * Use this like you use printf! (e.g. debug("Gyro heading = %f", gyro->GetAngle());).
 */
void debug(char *msg, ...)
{
        if (debugf != NULL)
        {
                char buf[256];
                va_list args;
               
                va_start(args, msg);
                vsprintf(buf, msg, args);
               
                va_end(args);
               
                fputs(buf,  debugf);
                fputs("\n", debugf);
        }
}

/**
 * Put this in IterativeRobot::RobotInit!
 */
void debugInit()
{
        if (debugf == NULL)
        {
                debugf = fopen("debug.txt", "w");
        }
}

I haven't tried this! The advantages of writing to files is that it creates significantly less overhead than printfs, but I dunno about overhead caused by ftptail. :cool:

SuperBK 18-02-2009 20:47

Re: Wireless debug print ??
 
We get the output to the console wirelessly. Always have since the beginning. Our "console out" switch is on, if that makes a difference.
Brian

X-Istence 18-02-2009 21:14

Re: Wireless debug print ??
 
For wireless debugging I wrote to the console output using standard iostream:

Code:

std::cout << "Variable 1: " << var1 << std::endl;
Worked great, right click the target in wind river, target tools, remote console. Make sure the console output switch is turned on.

agough 18-02-2009 21:28

Re: Wireless debug print ??
 
I am searching for the way to activate it and i can't find it.
Is it the same for wireless download or is that a different thing altogether?

X-Istence 23-02-2009 00:21

Re: Wireless debug print ??
 
Quote:

Originally Posted by agough (Post 824410)
I am searching for the way to activate it and i can't find it.
Is it the same for wireless download or is that a different thing altogether?

When you set up a debug connection using the instructions in the PDF that is supplied you can right click on the remote connection, after you connect to the remote target, you can then from that same menu select remote console.


All times are GMT -5. The time now is 02:31.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi