myR: datacollector

We need to take a little step back introducing  the concept of the datacollector class ( in module).

Probably you notice that for each class I always added a complementary class called  something_data (for example rc class and its  rc_data).I decide to  use this approach to have a common and structured way to get access to all the data  from any class.

The datacollector class is a class that inherits from all the data class of my objects.

class datacollector(rc_data, us_sensor_data, speaker_data, server_data, camera_data):



Let’s do the example of the data input.

Using the browser I can  send a command (for example “move left”) to the rover by storing it in the server module as


In the rc module I can read the , BUT since this info has got the same name in the 2 modules and it is defined in a  common class called datacollector, the 2 data.input are the same thing (the same pointer to the memory).

If, for some reason, I would like to add an input coming, for example from the sensor,  it could be really simple: just add a data.input in the sensor_data .And without any modification in rc module, the rc module can manage the  new input coming.

Again, in my main class rover  I can access all the data from all the classes just using or or

I hope I have not been to philosophical this time…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s