Go to Post If you don't like contact, your robot is not built well enough. - sanddrag [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 17-02-2009, 04:28
vamfun vamfun is offline
Mentor :Contol System Engineer
AKA: Chris
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 2003
Location: Van Nuys, California
Posts: 182
vamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of light
Send a message via AIM to vamfun
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.
Reply With Quote
  #2   Spotlight this post!  
Unread 17-02-2009, 10:25
SuperBK's Avatar
SuperBK SuperBK is offline
Registered User
AKA: BrianK
FRC #1225 (Amperage Robotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Henersonville, NC
Posts: 358
SuperBK is just really niceSuperBK is just really niceSuperBK is just really niceSuperBK is just really nice
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
__________________
Brian K
Team 1225 Robotics Mentor
Reply With Quote
  #3   Spotlight this post!  
Unread 17-02-2009, 18:47
Redneck's Avatar
Redneck Redneck is offline
Hacker Hick
AKA: Jamie (2.0) Moran
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Aug 2004
Rookie Year: 2004
Location: California
Posts: 90
Redneck is just really niceRedneck is just really niceRedneck is just really niceRedneck is just really nice
Send a message via AIM to Redneck
Re: Wireless debug print ??

Quote:
Originally Posted by SuperBK View Post
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.
__________________


Which badges can you claim?
Reply With Quote
  #4   Spotlight this post!  
Unread 17-02-2009, 19:00
radau radau is offline
Registered User
no team
 
Join Date: Jan 2009
Location: CA
Posts: 9
radau is an unknown quantity at this point
Re: Wireless debug print ??

Quote:
Originally Posted by SuperBK View Post
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) .

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.

Last edited by radau : 17-02-2009 at 19:07.
Reply With Quote
  #5   Spotlight this post!  
Unread 18-02-2009, 20:47
SuperBK's Avatar
SuperBK SuperBK is offline
Registered User
AKA: BrianK
FRC #1225 (Amperage Robotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Henersonville, NC
Posts: 358
SuperBK is just really niceSuperBK is just really niceSuperBK is just really niceSuperBK is just really nice
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
__________________
Brian K
Team 1225 Robotics Mentor
Reply With Quote
  #6   Spotlight this post!  
Unread 18-02-2009, 21:14
X-Istence X-Istence is offline
Melt the RC controller!
AKA: Bert JW Regeer
no team
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Montville
Posts: 151
X-Istence will become famous soon enoughX-Istence will become famous soon enough
Send a message via AIM to X-Istence Send a message via MSN to X-Istence
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.
__________________
My Blog!
Reply With Quote
  #7   Spotlight this post!  
Unread 18-02-2009, 21:28
agough's Avatar
agough agough is offline
Registered User
FRC #0234 (Cyber Blue)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2008
Location: Indiana
Posts: 8
agough is an unknown quantity at this point
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?
__________________
"By failing to prepare, you are preparing to fail."-Benjamin Franklin
"Wise men talk because they have something to say; fools, because they have to say something."-Plato
Reply With Quote
  #8   Spotlight this post!  
Unread 23-02-2009, 00:21
X-Istence X-Istence is offline
Melt the RC controller!
AKA: Bert JW Regeer
no team
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Montville
Posts: 151
X-Istence will become famous soon enoughX-Istence will become famous soon enough
Send a message via AIM to X-Istence Send a message via MSN to X-Istence
Re: Wireless debug print ??

Quote:
Originally Posted by agough View Post
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.
__________________
My Blog!
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Debug Windriver issue..... programmr C/C++ 12 06-02-2011 13:47
Sidecar Debug NinjaSpawn94 NI LabVIEW 6 07-02-2009 10:48
SERAL INSTEAD OF DEBUG... EGG0900 Programming 2 05-11-2005 18:25
IFI Dynamic Debug Tool fowlerm Programming 0 25-08-2005 16:18
Debug function in programming? archiver 2001 4 24-06-2002 00:34


All times are GMT -5. The time now is 14:50.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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