OpenTails / CRUMPET-Android

The Brains For Your Tail Company Gear!
GNU General Public License v3.0
31 stars 7 forks source link

Shake to move #115

Closed evgenibir closed 4 years ago

evgenibir commented 4 years ago

Added the "Shake to Wag" menu item to the welcome page. ↲ Implemented reading data from accelerometer.
Added a toggle button with 2 states: "start", "stop" to record the movements. ↲ Implemented reading data from gyroscope. Added the movementStatus text label to the ShakeToWag page to show instructions and movement type. Implemented the movement recognition (Shake, Jump). Added the shake and jump commands (as TAILU1, TAILU2) when tail is connected. Added calling the shape and jump commands. Got rid of Accelerometer data. Fixed the GO button: renamed "Start" to "GO". Commented out debug info. Commented out creating user defined commands. Set Jump action to TAILER command. Set Shake action to TAILS1 command. Small cosmetical changes

leinir commented 4 years ago

Right, so... bit of a problem... This will not work when the device has the screen turned off and it's sat in somebody's pocket. It has to be done in the service, which in turn means it has to be done in c++.

Now, you've kind of got a chunk of the work done already, , and converting it to using QGyroscope shouldn't be a huge undertaking, but the functionality really needs to be in the service...

What i'd suggest would be that we need it to function similarly to the casual mode functionality, which means you create a new class (which we can call, say, ShakeToMove), based on how the IdleMode class works, except that you use a QGyroscope instance stored in your priv impl to do the detection and whatnot, instead of a timer the way IdleMode does its work. You then need to expose that to the app through RemoteObjects. You can do this either by creating a new replicant, or probably easier would be to extend AppSettings the way that's done for a bunch of the other functionality (see AppSettings.h and cpp, and SettingsProxy.rep). You then interact with that replicated object in the ui instead of interacting directly with that Gesture instance you've got in QML right now. It's a touch roundabout, but it's kind of vital if we want that "just put it in your pocket" thing to work.

However, as a basic thing, not at all bad :) i imagine the above might sound scary, but... well, if you're on telegram and need some in-person guidance, or just some pointers or whatnot, do feel free to give me a poke, i'm @leinir on there (as well as most other places), otherwise i'm happy to respond and discuss here - obviously ;) (or email if you prefer, whichever is easier for you really)

leinir commented 4 years ago

Actually, if we treat this as the initial experimental version, we can do the work i mentioned above a bit later. I'll mark a few bits that want attention now, but rather than doing the big rework in this PR, let's get it in and we can work on it more :)