ROBOTC.net forums
http://www.robotc.net/forums/

Questions about the datalog functionality
http://www.robotc.net/forums/viewtopic.php?f=1&t=120
Page 1 of 1

Author:  trailfoot [ Wed Apr 04, 2007 8:38 pm ]
Post subject:  Questions about the datalog functionality

I have a few questions about the datalog:
  1. What does the CreateDatalog(size) function do? It isn't listed in the "NXT Datalog Test.c" sample program and I can't figure out a use for it.
  2. What format is the .rdt file saved in? Is this a Lego format? Is it documented? I'd like to be able to write a program to read it.
  3. When you use the RobotC GUI to do a "Spreadsheet Upload" to a .csv file, why are there two columns of data? For example, from "NXT Datalog Test.c":
    Code:
    1:     255     2001
    2:     3          0
    3:     3          1
    4:     3          2
    ...

    Is the first line always 255, # data points?
Too many questions? :wink: I'll post any answers I get to the wiki. Thanks.

Author:  JamesD [ Mon Apr 23, 2007 2:05 am ]
Post subject: 

Hi Trailfoot,
In response to your questions:

1) I'm pretty sure the CreateDatalog(size) function does appear in the "NXT Datalog Test.c" near the top and is used to define the number of readings/variables you want to record. In the sample it is set to 2000.

2) I've no idea

3) I can't answer your question about the first column but I'd also like to know why and what this column represents. I'd also like to pose another question about timestamps. Is it possible to use a datalog that also timestamps each entry. Do I need to run a different datalog at the same time? Can this be done?

Thanks
James

Author:  Dick Swan [ Thu Apr 26, 2007 9:23 am ]
Post subject: 

What does the CreateDatalog(size) function do? It isn't listed in the "NXT Datalog Test.c" sample program and I can't figure out a use for it. This is a legacy hangover from the iniitla RobotC implementation on the Mindstorms RCX. On the RCX the datalog and user programs shared the same memory and the "CreateDatalog" function was used to indicate how much of this single memory pool was assigned to the datalog.

On the NXT, the datalog is fixed in size at something like 7000 entries. The "CreateDatalog" function has no effect.

What format is the .rdt file saved in? Is this a Lego format? Is it documented? I'd like to be able to write a program to read it.
The format is 3-bytes per datalog entry. The size is dependend on the number of used entries in the datalog. It's three bytes because the first byte contains the "source" of the data point (i.e. is in a sensor value, a timer value, a user variable, etc). The next two bytes are the actual data point.

The purpose of storing a source type is to allow for storing multiple data sets in the single datalog. For example, you might want to store the values of two different sensors.

One way of logging data points is to create a task that periodically -- say every 50 milliseconds -- logs a data point. This way you have a known time base of when data points vs time the point was logged.

But there may be cases when you don't want to periodically log data points. You may only want to log a data point when some action triggers it. Say when you push a button or touch sensor you might want to log the value of a light sensor. In this case it would make sense to actually log two items. The first item is a timer value so that you know when the second item -- the actual data point -- was logged.

You should be able to figure out the "source" types from the following:
datalogSourceTypeToBaseType[opcdSourceCounter] = 0x00;
datalogSourceTypeToBaseType[opcdSourceGlobalVar] = 0x00;
datalogSourceTypeToBaseType[opcdSourceVar] = 0x00;
datalogSourceTypeToBaseType[opcdSource100MsecTimer] = 0x20;
datalogSourceTypeToBaseType[opcdSource10MsecTimer] = 0x28;
datalogSourceTypeToBaseType[opcdSource1MsecTimer] = 0x30;
datalogSourceTypeToBaseType[opcdSourceSensor] = 0x40;
datalogSourceTypeToBaseType[opcdSourceSensorRaw] = 0x48;
datalogSourceTypeToBaseType[opcdSourceMessage] = 0x50;
datalogSourceTypeToBaseType[opcdSourceClockMinutes] = 0x60;
datalogSourceTypeToBaseType[opcdSourceConstant] = 0x70;

Say you logged timer "T1" with a 100Msec resolution it would have source type "0x20". Timers T2/T3/T4 would be source types 0x21/0x22/0x23.

Sensor values are source types 0x40 to 0x43 for the four sensor ports.

When you use the RobotC GUI to do a "Spreadsheet Upload" to a .csv
file, why are there two columns of data? For example, from "NXT Datalog Test.c":

THis is explained above. Note that the first entry in the file is "special". The source type is 255 (only used for the first entry) and the "value" is the number of datapoints in the datalog.

Author:  JamesD [ Sun Apr 29, 2007 6:56 am ]
Post subject: 

Hi Dick,

Thanks for taking the time to make such a detailed and clear response. It is very much appreciated.

James

Author:  JamesD [ Mon Jun 11, 2007 7:53 am ]
Post subject:  Datalogging: Does too much data 'brick' the NXT?

I moved this from its own post as I felt it better to add to this one

Hi All,

Has anyone else been playing around with datalogging and ended up 'bricking' (getting the NXT into a non functioning state) their NXT?

I'm not sure why. It might be because I was trying to collect too many data values, but it 'bricked' requiring me to reload the firmware.

Anyone else had a similar experience?
Am I correct in assuming if I go over approx 7000 readings I'll brick the NXT?

Thanks
James

Author:  Dick Swan [ Fri Jun 22, 2007 5:57 am ]
Post subject: 

Exceing the datalog size should not "brick" the NXT. In my testing, the NXT quietly simply stopped logging data points. IF this is not happening then it is a bug.

If you post some code that causes the problem, I'll analyze it to determine the root cause. Even better if you send me a PM as I'll get to it sooner.

Author:  amormachine [ Tue Jul 10, 2007 7:25 pm ]
Post subject:  Datalog Continued ...

Is there a way to datalog multiple columns? or do you have to log the data in one column sequentially?

Author:  amormachine [ Tue Jul 10, 2007 8:58 pm ]
Post subject:  Floats?

An additional question would be whether or not you can datalog a float value. Unfortunately, it appears that all values are saved as integers.

Author:  JamesD [ Sat Jul 14, 2007 10:01 am ]
Post subject: 

As far as datalogging to separate columns, my understanding is it dumps to a single column and then you export it to excel and sort the column based on the "source data Point" Dick referred to above and seperate these out into separate columns for analysis.

Re Floating point, I don't think it does it, so depending on the level of detail you need, ie (# of decimal places) you might want to multiply your floating point numbers by 100 and divide them later in excel.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/