View unanswered posts | View active topics It is currently Sat Apr 19, 2014 11:12 pm






Reply to topic  [ 14 posts ] 
Can ROBOTC handle a database? 
Author Message
Rookie

Joined: Wed Jan 04, 2012 5:32 pm
Posts: 4
Post Can ROBOTC handle a database?
Hello all,

I am new both in ROBOTC and Mindstorms, can you please let me know if ROBOTC is able to hande a database? I didn't find much relevant info about this in the ROBOTC manual.

Thanks a million in advance,
Horeg


Wed Jan 04, 2012 5:56 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1343
Post Re: Can ROBOTC handle a database?
horeg wrote:
Hello all,

I am new both in ROBOTC and Mindstorms, can you please let me know if ROBOTC is able to hande a database? I didn't find much relevant info about this in the ROBOTC manual.

Thanks a million in advance,
Horeg

What do you mean by "handle a database"?


Wed Jan 04, 2012 6:03 pm
Profile
Rookie

Joined: Wed Jan 04, 2012 5:32 pm
Posts: 4
Post Re: Can ROBOTC handle a database?
Something like for instance I can store data in an external file and then load it into the running software as needed? In other words, I would like to construct a robot that can store a large amount of data in an external file (database) and then recall fragments of data from this background storage.


Wed Jan 04, 2012 6:11 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1343
Post Re: Can ROBOTC handle a database?
RobotC does support file I/O. The simplest way to do it is to store the file in .csv format (comma separated fields in a text file). You can then transfer the file to a Windows PC and have Excel to open it or you can create the CSV file on a Windows PC, transfer it to the NXT and have RobotC open and read the data.


Wed Jan 04, 2012 6:15 pm
Profile
Rookie

Joined: Wed Jan 04, 2012 5:32 pm
Posts: 4
Post Re: Can ROBOTC handle a database?
MHTS wrote:
RobotC does support file I/O. The simplest way to do it is to store the file in .csv format (comma separated fields in a text file). You can then transfer the file to a Windows PC and have Excel to open it or you can create the CSV file on a Windows PC, transfer it to the NXT and have RobotC open and read the data.


Perfect, thanks a lot!


Wed Jan 04, 2012 6:21 pm
Profile
Moderator
Moderator
User avatar

Joined: Thu Dec 22, 2011 7:42 am
Posts: 43
Post Re: Can ROBOTC handle a database?
horeg wrote:
... ROBOTC is able to hande a database?

Hi horeg,

If you plan to create a database-like program in NXT, with intensive write cycles, you should know that the NXT's main processor (Atmel AT91SAM7S256) is rated at 10,000 write cycles: http://www.keil.com/dd/docs/datashts/atmel/at91sam7s256_ds.pdf
;-)

_________________
Visit my project RainBot v0.11 on source forge, a 6 wheels robot featuring A* & Dijkstra's path finding, motors & sensors emulation, small font, fifo & sorted list libraries, using Xander's drivers for HT Compass, and documented with doxygen.


Wed Jun 20, 2012 2:27 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3105
Location: Rotterdam, The Netherlands
Post Re: Can ROBOTC handle a database?
If you're a very good programmer, you could use some kind of tiered approach with a WiFi sensor and a database server with a front-end on a Linux or Windows box. The NXT does transactions over WiFi to the DB server.

How big is the amount of data you're planning to store? 10K? 100K? As far as I know, files need to be contiguous, that is, not fragmented. The bigger the files, the harder it will be to satisfy this requirement. That is also why you need to specify the size of the file you wish to write to when you create it.

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Wed Jun 20, 2012 2:34 am
Profile WWW
Expert

Joined: Tue Feb 28, 2012 3:10 pm
Posts: 195
Post Re: Can ROBOTC handle a database?
The short answer: yes, as many have pointed out. The longer answer: probably not.

If you intend you write a database on the NXT, the lack of pointers is going to slow you down to a stop almost completely. If you take the approach of using wifi, as Xander suggested (and I would as well if you're brave) you will find the technology in its early stages, and you will probably have to discover, diagnose, work around as much with the communications protocol as you would the database protocol. With a ton of patience, you probably can do it, and you will be the first and only so far.

If (more and likely it sounds like) you are just looking for data storage, as opposed to a database, then the file IO is ok for small amounts of data, or large amounts only if you want to access it sequentially in entirety each time, or append only when writing. There are no read/write at offset type functions that I am aware of, and are critical to accessing 'records'.

I hate to be the pessimist, but I am also the realist. If you have a particular plan for data in mind, run it by us here. maybe someone will have some ideas.

_________________
Mike aka Spiked3
http://www.spiked3.com


Wed Jun 20, 2012 3:49 am
Profile
Rookie

Joined: Wed Jan 04, 2012 5:32 pm
Posts: 4
Post Re: Can ROBOTC handle a database?
Hello guys,

Thank you very much for your answers and I apologize for being back so late. My robot project was on hold for a year but I am now about to get a fresh start. This will be really a fresh one as I have only limited experience in programming, some experience with C back in 1997 and Basic 3.14 back in 1986. I want to try to write a sw that can learn. I have a kind of (psychological-logical) theoretical model for that that I would like now to implement into a sw. I believe in learning by doing so my model is far from being complete. For first I think I will try to connect visual and tactile information with each other so that the robot would herself make the abstractions by continuously grouping and regrouping the acquired information. This grouping and regrouping must take place in an external database/data storage as the memory of the brick will be very probably too small for this. But I was not sure if RobotC is able to handle such a database or I should look for some other SW.


Tue Jan 22, 2013 11:15 am
Profile
Novice

Joined: Sun Oct 21, 2012 10:01 pm
Posts: 76
Post Re: Can ROBOTC handle a database?
You'll be happy to know that the RobotC folks added official support for pointers. There're still some bugs (dereferencing a pointer that's not set to an initialized variable's location crashes the NXT), and there's no dynamic memory access, but you can do a lot more now.


Tue Jan 22, 2013 3:17 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3105
Location: Rotterdam, The Netherlands
Post Re: Can ROBOTC handle a database?
amcerbu,

I actually ported a pretty crude alloc/free thing the other night to ROBOTC. It seems to work :) Still quite rough around the edges, though, so it'll need some more work.

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Tue Jan 22, 2013 3:35 pm
Profile WWW
Novice

Joined: Sun Oct 21, 2012 10:01 pm
Posts: 76
Post Re: Can ROBOTC handle a database?
mightor wrote:
amcerbu,

I actually ported a pretty crude alloc/free thing the other night to ROBOTC. It seems to work :) Still quite rough around the edges, though, so it'll need some more work.

= Xander

Awesome! Is it a workaround (I've heard people mention using a large array and dividing it into sections to simulate allocation), or an actual RobotC hack?

Out of curiosity, what happens when you don't free allocated blocks of memory? :D


Tue Jan 22, 2013 6:46 pm
Profile
Expert

Joined: Thu Sep 29, 2011 11:09 pm
Posts: 184
Location: Michigan USA
Post Re: Can ROBOTC handle a database?
If you don't free memory, then you run the risk of running out of memory. In that case, you won't be able to allocate any more.

_________________
Matt


Tue Jan 22, 2013 9:44 pm
Profile WWW
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3105
Location: Rotterdam, The Netherlands
Post Re: Can ROBOTC handle a database?
Quote:
Awesome! Is it a workaround (I've heard people mention using a large array and dividing it into sections to simulate allocation), or an actual RobotC hack?

Yeah, it uses a large heap of memory and allocates the request amount and marks it as used. When it is freed, it will try to reuse that chunk if possible.
Quote:
Out of curiosity, what happens when you don't free allocated blocks of memory?

You get a NULL pointer back, just like the real thing and if you don't check for that, you'll probably crash your brick, just like the real thing!
Quote:
If you don't free memory, then you run the risk of running out of memory. In that case, you won't be able to allocate any more.

That is the case with all finite resources, is it not?

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Wed Jan 23, 2013 1:32 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 14 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.