-
Notifications
You must be signed in to change notification settings - Fork 0
Unify gamepad and sensor control into two seperate super classes #61
Comments
This is definately a possbility, the DrillProcess would benefit from this as well. The only reason I'm a little bit hesitant, is that all three modules end up using the joysticks in slightly different ways, for example the arm might use joysticks to control motor position, the drive process will select between rpm and current control, and braking, the arm might use two axes (the triggers) instead of one to turn a positive/negative direction, etc. The way I'm envisioning the code right now, we would end up overriding every method of the super class anyway, negating the benefits of the common parent class. That being said, you might have better ideas of how to structure this change to avoid the problem I listed above. My proposal is to keep things the way they are for the month of Feburary to make sure everything works for the critical design review. After that, we can refactor the Drive, Arm and Drill processes to take advantage of a common super class. |
I currently have three plans for which I can approach this issue. These two plans deal with implementing the classes in the current rover system:
The third plan (and probably my best one) deals with implementing the classes in the new rover system:
This approach should meet around 5-6 recommendations that were specified in SoftwareOverview2017.pdf published on the software channel. |
Option 2 is what I would like to see for now. I was originaly thinking something like this:
This will blow up if your scaling function doesn't take in or return the right data types, but that can be checked. We'll discus next years plans in detail sometime after the competition in a month, I especially like your point b about being able to test functional units individually. As long as the rover software doesn't end up like this we'll be good :) |
After looking at the drive and arm processes, it came to my mind that the ArmProcess and the DriveProcess can extend from a super class because they use similar functions and subscription keys. For good object-oriented programming practice, it makes alot more sense to create a super class for a group of classes that share functionality.
For example, since the DriveProcess and the ArmProcess share functionality they can both inherit the similar functionality from a super class (something like a "JoystickProcess" class that extends the RoverProcess class). The JoystickProcess class can then handle the similar functionality universally of all of its subclasses and then the subclasses can deal with all the methods that can only be distinctly invoked for their own specified processes.
The text was updated successfully, but these errors were encountered: