02-06-2011 11:29 PM
Hello,
I am trying to implement data collection on my NXT device. Essentially what I want to do is collect motor rotation data at a specified rate and store them somewhere for later access in the automation routine. The data collection needs to happen all in one go before the robot does anything else. The ultimate goal of my project is to manually drag the robot around a contour (collecting data to construct a map), and then have it autonomously cover the entire area within this contour.
So far my approach has been to set up a while loop which samples the two motor rotation sensors every 20 ms. The problem I have run into is that there is no obvious way to store the data. I tried appending each data point to an array, but NXT does not support a feedback node. Is there a way to get around that?
Also, is there a way to access and read the log created from a "Record" function (or some other existing method to obtain chunks of data)? This would in fact be the ideal solution to my problem, rather than writing my own sampling routine.
Alternatively, can the NXT communicate in real time with a PC? I could then send individual data points to the PC for storage and processing, and then send back commands to the NXT.
Finally, do I risk running out of memory on the NXT by collecting and storing data?
Thanks for the help.
Best,
Antonio
02-08-2011 11:11 AM
Hi robo1,
It sounds like for your application you might want to use the Log Angle (red/blue/green) nodes to acquire your data. This lets you sample at a specific rate for a given amount of time and saves the data to a file called RedData.dat, BlueData.dat or GreenData.dat depending on the color of the Log Angle you chose.
When logging any data you will only have a finite amount of space based on the memory available however I do not know exactly how many data points can be stored before filling the memory of the controller.
Once you've collected the data you can then read the points back using the Easy Read File node which can be found on the File access pallet. Just specify which *.dat file you would like to read from. Then you can use these points to control the action of the motors.
An alternative may be to simply Read the rotation inside a while loop then wire the output to the edge of the loop and enable indexing. This should give you an array of all the data points. You can again use the data in the arrays to control your motors. Each data point will still use up memory space but again I do not know the Max size which would also depend on how large your program is.
<Brian A | Applications Engineering | National Instruments>