andrewfstratton / quando

Visual Programming for Digitally Interactive Exhibits
10 stars 7 forks source link

Handle when hand outside valid range #421

Open balraj-johal opened 2 years ago

balraj-johal commented 2 years ago

The current behaviour is that movement beyond a single axis range is ignored. However, this means that other axes continue to change (as do angles and grip strength). This option should still be available (but likely not the default)

A new option would be to define an interaction box. This equals

This needs a new Block to define the movement/valid interaction box range Need to define:

First version of Block clip given below:

[{"block_type":"inventor-function-block","values":{"_quando_blocktype":"","class":"quando-devices","box_row1":"no","_quando_boxname1":"box","box_row2":"no","_quando_boxname2":"","generator":"api","library":"leap","function":""},"boxes":[{"id":"_quando_inventorrow1","box":[{"block_type":"inventor-icon","values":{"icon":"👋"}},{"block_type":"inventor-text","values":{"text":"When","extras":"hidden","iconify":"false","bold":"false","italic":"false"}},{"block_type":"inventor-menu","values":{"name":"left_right"},"boxes":[{"id":"box","box":[{"block_type":"inventor-choice","values":{"txtval":"input","choice":"🖐","value":"either"}},{"block_type":"inventor-choice","values":{"txtval":"input","choice":"👈","value":"left"}},{"block_type":"inventor-choice","values":{"txtval":"input","choice":"👉","value":"right"}}]}]},{"block_type":"inventor-text","values":{"text":"outside","extras":"hidden","iconify":"false","bold":"false","italic":"false"}},{"block_type":"inventor-toggle","values":{"name":"return_ignore"},"boxes":[{"id":"box","box":[{"block_type":"inventor-choice","values":{"txtval":"input","choice":"ignore","value":"false"}},{"block_type":"inventor-choice","values":{"txtval":"input","choice":"return","value":"true"}}]}]},{"block_type":"inventor-show-on-toggle","values":{"name":"return_ignore","value":"true"},"boxes":[{"id":"box","box":[{"block_type":"inventor-text","values":{"text":"to middle","extras":"hidden","iconify":"false","bold":"false","italic":"false"}}]}]},{"block_type":"inventor-show-on-toggle","values":{"name":"return_ignore","value":"false"},"boxes":[{"id":"box","box":[{"block_type":"inventor-menu","values":{"name":"ignore"},"boxes":[{"id":"box","box":[{"block_type":"inventor-choice","values":{"txtval":"input","choice":"all","value":"all"}},{"block_type":"inventor-choice","values":{"txtval":"input","choice":"⇕⇔⤢ move","value":"move"}},{"block_type":"inventor-choice","values":{"txtval":"input","choice":"⤹⤸ rotate","value":"rotate"}},{"block_type":"inventor-choice","values":{"txtval":"input","choice":"🤏grip","value":"grip"}},{"block_type":"inventor-choice","values":{"txtval":"input","choice":"⇕⇔⤢ and ⤹⤸","value":"move_rotate"}},{"block_type":"inventor-choice","values":{"txtval":"input","choice":"⇕⇔⤢ and 🤏","value":"move_grip"}},{"block_type":"inventor-choice","values":{"txtval":"input","choice":"⤹⤸ and 🤏","value":"rotate_grip"}},{"block_type":"inventor-choice","values":{"txtval":"input","choice":"none","value":"none"}}]}]}]}]},{"block_type":"inventor-extras","values":{"extras_name":"extras"},"boxes":[{"id":"box","box":[{"block_type":"inventor-text","values":{"text":"Range ","extras":"hidden","iconify":"false","bold":"false","italic":"false"}},{"block_type":"inventor-icon","values":{"icon":"±"}},{"block_type":"inventor-input","values":{"input":"range_percent","default":"20","placeholder":"","extras":"hidden","type":"number","number_min":"0","number_max":"100","number_width":"4","encode":"normal"}},{"block_type":"inventor-text","values":{"text":"% ","extras":"hidden","iconify":"false","bold":"false","italic":"false"}},{"block_type":"inventor-show-on-toggle","values":{"name":"return_ignore","value":"true"},"boxes":[{"id":"box","box":[{"block_type":"inventor-raw","values":{"raw":"
"}},{"block_type":"inventor-text","values":{"text":"After","extras":"hidden","iconify":"false","bold":"false","italic":"false"}},{"block_type":"inventor-input","values":{"input":"wait_sec","default":"0","placeholder":"","extras":"hidden","type":"number","number_min":"0","number_max":"60","number_width":"4","encode":"normal"}},{"block_type":"inventor-text","values":{"text":"seconds, take","extras":"hidden","iconify":"false","bold":"false","italic":"false"}},{"block_type":"inventor-input","values":{"input":"return_sec","default":"2.5","placeholder":"","extras":"hidden","type":"number","number_min":"0","number_max":"60","number_width":"4","encode":"normal"}},{"block_type":"inventor-text","values":{"text":"seconds","extras":"hidden","iconify":"false","bold":"false","italic":"false"}}]}]}]}]}]},{"id":"_quando_inventorrow2"},{"id":"_quando_inventorrow3"},{"id":"_quando_inventorgenerator"}]}]

balraj-johal commented 2 years ago

an initial form of the valid interaction boundary has been added. The tolerance range is currently set globally for all axes / for both hands. As of right now the "ignore all movement" option is the only functional choice.

next steps

balraj-johal commented 2 years ago

added semi functional return to middle behaviour. Currently works for right hand/either hand interactions only, and "take x seconds" is currently not functional.

test clip

[{"block_type":"","values":{"left_right":"either","return":"true","ignore":"move_rotate","extras":"show","range_percent":"20","wait_sec":"0","return_sec":"2.5"}}, {"block_type":"devices-leap-when-move","values":{"hand":"Either","direction":"X","extras":"show","range":"10","inverted":"false"},"boxes":[{"id":"box","box":[{"block_type":"devices-cursor-move","values":{"direction":"left_right","extras":"hidden","mid":"50","plus_minus":"50","inverted":"false"}}]}]}, {"block_type":"devices-leap-when-move","values":{"hand":"Either","direction":"Y","extras":"show","range":"10","inverted":"false"},"boxes":[{"id":"box","box":[{"block_type":"devices-cursor-move","values":{"direction":"up_down","extras":"hidden","mid":"50","plus_minus":"50","inverted":"false"}}]}]}, {"block_type":"devices-leap-when","values":{"hand":"Either","hand_fn":"handClosed"},"boxes":[{"id":"box","box":[{"id":"0","block_type":"media-show-image","values":{"file_name":"red_light.png"}}]}]}, {"block_type":"devices-leap-when","values":{"hand":"Either","hand_fn":"handOpen"},"boxes":[{"id":"box","box":[{"id":"1","block_type":"media-show-image","values":{"file_name":"green_light.png"}}]}]}]

remaining tasks

balraj-johal commented 2 years ago

completed tasks

interpolation time functionality added

interpolation set to ease in/out

added feature: when leap is recieving in bounds hand data then suddenly stops recieving hand data (e.g. when the hand is moved too suddenly and so no out of bounds data is recieved) return to middle after 1 second

remaining tasks