threshold events and rotary encoder module

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
threshold events and rotary encoder module
#1
hello—

Is there a method for increasing the number of threshold events when using the rotary encoder and newly modified RotaryEncoderModule? The Bpod system lists 15 valid events for the rotary encoder but it appears the RotaryEncoderModule will only allow for 2.

Thank you,

Randy
Reply
#2
I am trying to use Bpod FSM v2.2 and the rotary encoder module for a 2AFC task, but the lack of an example protocol using the encoder has me a bit stumped. In particular, I'm a bit confused about the ability to set multiple thresholds--for example, one threshold to setting an "idle" period at the start of a protocol and another threshold for left/right choice. If two thresholds are declared:
Code:
R = RotaryEncoderModule('COM7');
R.thresholds = [-10 10 -40 40];
R.sendThresholdEvents = 'on';

Are these referenced as events in the state machine as RotaryEncoder1_1,  RotaryEncoder1_2, RotaryEncoder1_3 and RotaryEncoder1_4 respectively?
Reply
#3
Hi Jeff,


You can set up to 8 individual thresholds. They don't have to be negative, and the events they generate are in the order listed, for instance, for

Code:
R.Thresholds = [10 20 30 40 50 60 70 80];


crossing 10 would generate a RotaryEncoder1_1 event,
crossing 20 would genereate a RotaryEncoder1_2 event, etc.

Once a threshold is crossed, it is disabled until explicitly re-enabled. 
You can re-enable all thresholds at once by having the state machine send command 'E' to the rotary encoder module:

Code:
sma = AddState(sma, 'Name', 'MyState', ...
       'Timer', 0,...
       'StateChangeConditions', {'Tup', 'MyNextState'},...
       'OutputActions', {'RotaryEncoder1', 'E'});

So for your application, you'd set R.Thresholds to include both sets of thresholds you described. 
Your first state would enable all thresholds.
You'd set your 'WaitForTrialStart' state to return to the first state if thresholds 1 or 2 were crossed (events for thresholds 3 and 4 would be captured, but would not influence the flow of states).
After the animal successfully waits for trial start, you'd go through a state that reset the thresholds before continuing the trial.
You'd then set your 'WaitForChoice' state to handle only thresholds 3 and 4.

Please let me know if this helps!

-Josh
Reply
#4
(10-10-2019, 03:05 AM)Josh Wrote: Hi Jeff,


You can set up to 8 individual thresholds. They don't have to be negative, and the events they generate are in the order listed, for instance, for

Code:
R.Thresholds = [10 20 30 40 50 60 70 80];


crossing 10 would generate a RotaryEncoder1_1 event,
crossing 20 would genereate a RotaryEncoder1_2 event, etc.

Once a threshold is crossed, it is disabled until explicitly re-enabled. 
You can re-enable all thresholds at once by having the state machine send command 'E' to the rotary encoder module:

Code:
sma = AddState(sma, 'Name', 'MyState', ...
       'Timer', 0,...
       'StateChangeConditions', {'Tup', 'MyNextState'},...
       'OutputActions', {'RotaryEncoder1', 'E'});

So for your application, you'd set R.Thresholds to include both sets of thresholds you described. 
Your first state would enable all thresholds.
You'd set your 'WaitForTrialStart' state to return to the first state if thresholds 1 or 2 were crossed (events for thresholds 3 and 4 would be captured, but would not influence the flow of states).
After the animal successfully waits for trial start, you'd go through a state that reset the thresholds before continuing the trial.
You'd then set your 'WaitForChoice' state to handle only thresholds 3 and 4.

Please let me know if this helps!

-Josh

Perfect. Thanks, Josh!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)