We need to take a little step back introducing the concept of the datacollector class ( in datacollector.py 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 self.data.input.
In the rc module I can read the self.data.input , 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 self.data.speed or self.data.input or self.data.distance.
I hope I have not been to philosophical this time…