View unanswered posts | View active topics It is currently Wed Oct 22, 2014 2:26 am






Reply to topic  [ 9 posts ] 
Questions about the datalog functionality 
Author Message
Rookie

Joined: Tue Apr 03, 2007 1:35 pm
Posts: 1
Post 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.


Wed Apr 04, 2007 8:38 pm
Profile
Novice

Joined: Sun Feb 04, 2007 12:48 am
Posts: 69
Location: Australia
Post 
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


Mon Apr 23, 2007 2:05 am
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 615
Post 
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.


Thu Apr 26, 2007 9:23 am
Profile
Novice

Joined: Sun Feb 04, 2007 12:48 am
Posts: 69
Location: Australia
Post 
Hi Dick,

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

James


Sun Apr 29, 2007 6:56 am
Profile
Novice

Joined: Sun Feb 04, 2007 12:48 am
Posts: 69
Location: Australia
Post 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


Mon Jun 11, 2007 7:53 am
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 615
Post 
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.


Fri Jun 22, 2007 5:57 am
Profile
Rookie

Joined: Mon Jul 09, 2007 6:47 pm
Posts: 3
Post Datalog Continued ...
Is there a way to datalog multiple columns? or do you have to log the data in one column sequentially?


Tue Jul 10, 2007 7:25 pm
Profile
Rookie

Joined: Mon Jul 09, 2007 6:47 pm
Posts: 3
Post 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.


Tue Jul 10, 2007 8:58 pm
Profile
Novice

Joined: Sun Feb 04, 2007 12:48 am
Posts: 69
Location: Australia
Post 
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.


Sat Jul 14, 2007 10:01 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 9 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:  



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