View unanswered posts | View active topics It is currently Tue Sep 16, 2014 10:24 pm






Reply to topic  [ 7 posts ] 
Datalogging? 
Author Message
Rookie

Joined: Tue Nov 30, 2010 9:24 pm
Posts: 11
Post Datalogging?
Just wondering if there is a way to datalog from a sensor? Maybe create an array to use with it. We have an accellorometer sensor and want to see what the sensor reads each second, maybe after the program has run and it appears what the sensor value was at each second, or in real time on the brick. Any help would be useful :)


Mon Dec 06, 2010 9:35 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Datalogging?
RobotC provides a function call AddToDataLog. This allows you to log data points in memory. After you are done, you can call SaveNxtDataLog to save it to a file on the brick. Then in the RobotC IDE, you can click "Robot->NXT brick->File management" to download the file onto your laptop and post process it.

If you want to see the data in real time, you can always print it out on the NXT LCD display by calling nxtDisplayTextLine and then when you run the program in the IDE, you can pop open the remote LCD screen on your laptop by "Robot->Debug Windows->NXT remote screen" so that you can see the LCD without chasing the running robot. However, the tricky part is: if you also pop up the "Joystick Control" window, the remote LCD window will go away because Bluetooth connection doesn't have enough bandwidth to transmit both the joystick packets and the LCD screen packet. So if you need both the joystick window and the remote LCD window, you must tether with a USB cable instead. So you still need to chase after the moving robot but at least with a better view of the LCD content on the remote screen on your laptop. :)


Tue Dec 07, 2010 12:58 pm
Profile
Rookie

Joined: Tue Nov 30, 2010 9:24 pm
Posts: 11
Post Re: Datalogging?
How would you use this phrase? nxtDisplayTextLine


Wed Dec 08, 2010 8:39 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Datalogging?
In RobotC, on the left hand pane you can select the "Function Library" tab. If you expand "Display->Intrinsics", you will see all the available display related functions. Double click on any one of them that you want help on.

For example:

nxtDisplayTextLine(lineNumber, "value=%d", value);


Wed Dec 08, 2010 8:44 pm
Profile
Rookie

Joined: Sun Nov 16, 2008 3:07 pm
Posts: 45
Post Re: Datalogging?
I am a fan of
WriteDebugStreamLine("Accel: %d", MyAccelVal);

Then look at it while the debugger is connected via Debug Windows.
(set Menu to SuperUser to enable that menu choice, which you do on the Window menu).

Then you can cut and paste the output into Notepad, save it as foo.txt, then open it in excel, run the import wizard to get the numbers into a column and plot a graph of it if you want.

(i'm sure there are more elegant ways).

Not useful if you aren't connected on the debugger.

[caveat: I typed the above off top of head, so syntax might be slightly off]


Sun Jan 09, 2011 11:30 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Datalogging?
Yes, you can do that too. The only problem is that RobotC and NXT has a lot of restrictions on debugging. For example, once you open other windows such as the joystick panel or the LCD remote screen, the debug stream window cannot coexist at the same time. I suppose it is because Bluetooth does not have enough bandwidth to support both communications. If you use USB connection, you can do both but it limits your robot's mobility. The LCD remote screen also has it's own limitations. It has only 8 lines so you have to plan how to use this small screen to display all the info you want to see. In both cases, the string processing functions can only deal with 19 characters at a time and can only have two substitution fields in the format strings. Sometimes, I spent more time thinking how to debug a problem than actually debugging it. :(

The next major library function I am going to tackle is a generic logging facility built on top of the Datalogging NXT provides. But of course, it has it's own limitation as well.


Sun Jan 09, 2011 11:40 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Datalogging?
BTW, now that FTC introduces the Samantha WiFi module, it can in theory vastly improve debugging if they will add high bandwidth debugging facilities when NXT is on USB link so that the PC can access the debugging info through the Samantha module.


Sun Jan 09, 2011 11:46 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.