Deeplocal / android-things-handbot

Android Things HandBot
MIT License
2 stars 3 forks source link

Data-driven gesture #6

Open proppy opened 6 years ago

proppy commented 6 years ago

Currently most of the gesture are hardcoded in https://github.com/Deeplocal/android-things-handbot/blob/master/app/src/main/java/com/example/sewl/androidthingssample/HandController.java as a series of functions call that translate to fixed angle for the servo controller: https://github.com/Deeplocal/android-things-handbot/blob/master/app/src/main/java/com/example/sewl/androidthingssample/FingerController.java#L37 https://github.com/Deeplocal/android-things-handbot/blob/master/app/src/main/java/com/example/sewl/androidthingssample/ForearmController.java#L40

Instead you may want to consider encoded the gesture as data resources, so that it's more convenient to add new one without editing any code?

sewl-dl commented 6 years ago

@proppy -- I really like this in theory, but as soon as I started refactoring, I realized you would still need to make code changes to map the current game state to the new action (since wrist and forearm actions are specific to to the sign and game you're in). Not a huge deal, but as soon as I started writing the mapping I started to feel like it was getting a little convoluted.

proppy commented 6 years ago

since wrist and forearm actions are specific to to the sign and game you're in

couldn't that be solved with another mapping from actions to gesture per game?