autorope / donkeycar

Open source hardware and software platform to build a small scale self driving car.
http://www.donkeycar.com
MIT License
3.12k stars 1.29k forks source link

Reoganize parts folder and refactor large files #608

Open Ezward opened 4 years ago

Ezward commented 4 years ago

The parts folder is one the most important sets of source in the donkey project, but it is not well organized. I am proposing two steps to make the parts folder more understandable and maintainable;

  1. Move parts into sub-folders organized around robotics functions
  2. Refactor large dumping ground files into smaller single-purpose files.
    • It is likely that after a refactor we will find a lot of code that really is not a 'part', in which case we would move that out of the parts folder. For instance, we may want a machine-learning folder outside of the parts folder that deals with models and learning the models. That kind of functionality should not in the 'parts' folder; probably on the inference call needs to be in the parts folder.

Here is an initial proposal. This is a simple first cut; we could go deeper into each file and confirm it's destination. Further, we could look at each file and decide how to refactor it and where those resulting files should live.

Folder are in [square-brackets]. In some cases, I've added forward-looking folders for parts that I've heard folks are working on, like obstacle detection and path planning.

sctse999 commented 4 years ago

I like the idea of having a set of agreed development guidelines so we can keep things organized and easy to follow (so more ppl can contribute easier). I think having sub-folders is a good idea because we might have similar stuff that we want to group together. Test case is something that I concern most. Maybe we want to apply something similar to the test folder.

Ezward commented 4 years ago

I agree about the test folder; it should reflect the structure of the src folder. I will open another issue after we finalize the structure of the src folder.

wallarug commented 4 years ago

I have some views on the structure. It has been improved before.

I like this new structure but need to make a suggestion on the hardware / controller folder. It in my view has always been confusing having actuation and control types for the parts and then custom boards separate. As suggested in the post, they should be refactored into separate parts and stored in the appropriate directory.

You should not have hardware output controllers (PCA9685, Robo HAT MM1, etc) in the same folder as the remote controls. It doesn't make sense and is confusing from a naming convention point of view.

The other suggestion I would like to propose is less directories than that which has been proposed. Everything should be able to fall into one of five top level categories (instead of 8 categories), as below to avoid having lots of things at the top level (as is the case with parts/ at the moment).

--

--

--

--

-- - [telemetry / communication]

I like where this is heading in general and open to see everyone else's suggestions.