First time here? Check out the FAQ!
x

How can I reset accumulateWithHalfLife ?

0 votes
353 views

"This version of the accumulate message is lossy — it gradually tries to return to 0 over time, so when your controller outputs zero and stops changing, the value of the accumulateWithHalfLife: expression will eventually return to zero."

Unlike the other accumulate messages, this one can't be instantly reset to an initial state. What would be the workaround, to allow for a reset mechanism?

asked Apr 4, 2022 in Capytalk & Smalltalk by cristian-vogel (Master) (8,440 points)

1 Answer

0 votes

There's no reset on that version of the accumulate expression. You could experiment with this as a temporary kludge:

((!Reset true: -1000 false: !Fader)  accumulateWithHalfLife: !Tc s) max: 0

 

We've made a note to look at adding a reset: tag to the expression in the future.

answered Apr 5, 2022 by ssc (Savant) (128,080 points)
That works for me, as does this, a similar solution

```(!WindingRate * !Direction sign) accumulateWithHalfLife: ( !gate true: !SpinDownRate  false: 0.001 )```
...