1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

XY as a Rotary Control

Discussion in 'Building With Reaktor' started by OneSwarm, May 2, 2009.

Thread Status:
Not open for further replies.
  1. OneSwarm

    OneSwarm New Member

    Messages:
    14
    Hi all,
    Just wondering if anyone has used the XY as a 360 degree rotary control? Ie: moving the cross/pointer in a full 360 degree circle (either left or right) would equal one turn, and in turn you could feed it to a counter etc.

    I did manage to get a working model knocked up in another language, but i need it to be in Reaktor and i have been racking my brain for a few days but can't seem to get my head around it. So any help will be much appreciated :)
     
  2. herw

    herw NI Product Owner

    Messages:
    6,421
    polar coordinates:
    http://en.wikipedia.org/wiki/Polar_coordinate_system

    ciao herw
     
  3. OneSwarm

    OneSwarm New Member

    Messages:
    14
    Cheers,
    But like i say, i have a working model in another language simply using IF Statements checking the X and Y Coordinates (infact it has a threshold +/- .1) in 4 positions (interms of a compass, N,E,S,W etc), and because of if statements it allows you step - ie: if this -> then if this -> then if this -> then if this -> then a full rotation.

    But in Reaktor there isn't anything similar to if statements, just extremely basic boolean compares and if im right there is no way of triggering a compare unlike an if statement triggers/processes code depending on the if conditions (like above).

    And this is where i'm stuck, how do you go about creating a stepping-style if statement? How i can process a compare based on the output of another (ie: it triggers)? ie: when the pointer is at (X, Y) 0.5,1 (so that would be centre at the top), then it would check when you go to the next position (clockwise) 1,0.5 (East as it were), then 0.5,0 (South), then 0,0.5 (West), then once back to 0.5,1 it would equal a rotation.

    Only idea i have is at every position (N,E,S,W) you would set obscure value, at the North position on the XY you would also perform a compare of the sum of these values - if it equals then you have one rotation start again.
    Although the compares return 0 once outside the condition, so is there a way to store values like a variable?

    Cheers for any help :)
     
  4. Aleksandr Smirnov

    Aleksandr Smirnov NI Product Owner

    Messages:
    1,539
    It is possible - I will post short ensemble very soon!
     
  5. OneSwarm

    OneSwarm New Member

    Messages:
    14
    Thanks :)

    I'm thinking that it could be possible to use the event table (Y=1, X=4) to store the 4 positions, then every time it hits the start/end position of the rotation you check to see if all the positions have been hit, if so increment the counter as it has completed a rotation, and then reset the event table.

    Although, that wouldn't make it strict as you could hit all of the positions but not in a circular movement and it would still count as a rotation.
     
  6. Aleksandr Smirnov

    Aleksandr Smirnov NI Product Owner

    Messages:
    1,539
    Hi!

    Here is one of solutions, however it's not complete (no reset and way of XY moving), but this might help you. It makes one turn when it is equal to 4. You have to use several modules to get what you want. In my case it works like this:

    (0.5 ; 1) - 1 is being sent to output of next event core cell, so it could start work;

    (1 ; 0.5) - 2 is being sent to output of next event core cell, so it could start to work;

    (0.5 ; 0) - 3 is being sent to output of next event core cell, so it could start to work;

    (0 ; 0.5) - 4 is being sent to final output - 4 is full turn.

    So you can't go to any other coordinates before you passed those, however you can go other way round - I didn't solve this yet. It's not easy to implement this without several hard operations with events, but it's possible. You have to use those polar coordinates to do all this properly.

    It's not hard to make reset for these modules I did - simply reset with Latch module X & Y coordinates you won't have (for example -1), as well as Merge module in the end (with 0).

    Anyway, hope that will help you a bit to develop your further solutions. With event core cells and few event modules everything what you described is possible.

    Good luck!
     

    Attached Files:

  7. OneSwarm

    OneSwarm New Member

    Messages:
    14
    Hey Aleks,
    Did try and reply earlier but the N.I site was down. But much appreciated, will have a look now.

    I did manage to get something going myself, works on a similar principal but it has a few problems, like not updating rotations properly, not strict (you can do zig zags and it'll still count it as a rotations :lol: ) and is a bit of a mess!


    But again, thanks for the help! :)
     

    Attached Files:

  8. electri-fire

    electri-fire Forum Member

    Messages:
    32
    Oohh if only we could get this to work. I've been tinkering at a Korg DS10 emulator working under a single mouse area. My goal is to have an instument for Kaoss pad with no mouse using whatsoever.

    A zip upload for your amusement, with loads of unfinished bits and pieces...

    edit:seems I can't upload my zip. I'll try again later.
     
    Last edited: May 3, 2009
  9. Aleksandr Smirnov

    Aleksandr Smirnov NI Product Owner

    Messages:
    1,539
    OneSwarm, I looked at your ensemble and I think it's much easier to implement this using event core cell and you save space in your ensemble, however this is really nice attempt! I didn't check it precisely, just quick look - you used same mechanism of compare 4 top coordinates?
     
  10. BertAnt

    BertAnt NI Product Owner

    Messages:
    414
    I found this XY idea interesting, i try to messed around with it :) Hope this is not too bad..
     

    Attached Files:

  11. Aleksandr Smirnov

    Aleksandr Smirnov NI Product Owner

    Messages:
    1,539
    Wow, really nice unusual approach! Is this part of some project, or you've made it from scratch?
     
  12. BertAnt

    BertAnt NI Product Owner

    Messages:
    414
    :D Got inspired by wall clock. Made from scratch, but using some stuff that came from past tryouts. I figure it's easier to 'record' the whole movement until it complete the cycle, then checking if the recorded movement is valid or not by comparing the 'compressed' record to two values that represents forward and reverse movements. That way if the cycle is not complete, it won't count as a cycle.
     
  13. electri-fire

    electri-fire Forum Member

    Messages:
    32
    I did an edit of BertAnt's JustAnIdea ensemble.

    I'm slow, been at it all evening, wrists ar hot from turning.

    I inserted Control Shaper 2 so you don't have to mouse along the edges to get response, but I'm sure there must be a more elegant way.

    Now it doesn't count turns but in- or decreases a value.
    It is not very smooth as there is a turn of direction every eight values. Needs some testing.

    I tried to make a timer to measure rotation speed, but how do I set the timer to zero at the mouseclick moment?
     

    Attached Files:

  14. BertAnt

    BertAnt NI Product Owner

    Messages:
    414
    Cool ! :)

    I don't think it's possible to reset the timer module, the only way i could think of is to build a core version of it.
     
  15. Aleksandr Smirnov

    Aleksandr Smirnov NI Product Owner

    Messages:
    1,539
    Maybe sending some events, however you will need to wait some time, until it resets. As for core - I think its possible, but better with audio core cell.
     
  16. BertAnt

    BertAnt NI Product Owner

    Messages:
    414
    The timer can reset after some idle time ? I've never knew that, probably it has a max time allowed limit within itself.. Yes, definitely audio core, since it needs to be feed with SrC continuously, then uses counter to count number of samples between two incoming events. But since it uses counter, we can easily make an external reset source that came from MB out of the XY.
     
  17. Aleksandr Smirnov

    Aleksandr Smirnov NI Product Owner

    Messages:
    1,539
    Well, I faced some problems, when I tried to implement Timer with core cell. It's not essential for SR.C to be used, for example you can use System Info module, because it has output, that sends events each 25 Hz. However, I was trying to implement it with SR.C first.

    It works different with Clock Oscillators and with triggering knob - however, universal solution should be found. The problem is trigger should reset itself each time it strikes again, so frequency can be counted. Probably make some compare modules if it is bigger or smaller than previous value, it goes through, otherwise it reminds the same.

    Do you have any ideas of how to fix it? But scheme is simple - one counter for SR.C, another for Triggering event.

    I also though about resetting primary timer. Basically, we just have to put Merge module after its output and send 0 when we reset it - we don't care what's going on inside timer, as we're interested in result in this particular case.
     

    Attached Files:

  18. electri-fire

    electri-fire Forum Member

    Messages:
    32
    resetable timer

    I set the clock oscillator frequency to 1000 so the counter goes up each ms. The flipflop resets the counter to zero. The separator only passes values above zero, so the last value is held. I think it works.

    Now in BertAnt's ensemble the MX gets multiplied by 10. I don't know how this works, but maybe if you could multiply by a large number or otherwise have the ValueChange put out higher values the modulo after that could have a higher B value to decrease the "reverse bump" occurring?
     

    Attached Files:

  19. electri-fire

    electri-fire Forum Member

    Messages:
    32
    What I would like to achieve for the kaosspad is multiple XY rotaries from a single XY controller.

    Here I managed to shift the line display into a corner, but the response has not yet been restricted to the area.

    An ergonomic interface would be to center the rotary on the spot of the first mouseclick.

    Then determine the size of the line by the amount of deviation from the center spot.

    Or have a knob to adjust the line lenght.

    Also have a knob to set maximum amount of rotaries, and fade it out/delete when this amount has been exceeded?

    A circular appearance would be nice. I have trouble with that sinus/cosinus/tangens stuff. Maybe Mr. Krass could help me with this please?
     

    Attached Files:

  20. BertAnt

    BertAnt NI Product Owner

    Messages:
    414
    Yes, i forgot that all we want to discard is the time calculated between idle and active period. Although with simply merging 0 on its output, the timer probably still measuring the time between the last measurement and the first event from the new measurement. It's not really crucial though, besides the timer display may showing an invalid measurement for one events :) And still this can be cleaned up with separator. I'll have a look at your timer ensemble, i also have something on core that hopefully works, with two counters, but not completed yet.

    That can also be a good way too ;)

    MX multiplied by 10 then added to MY is just a way to merge the two coordinates into one single unique value (sort of ID number :)), that can be replaced easily, rather than working with X and Y value and having multiple conditional statements that can be confusing to me :) In fact any number or some math operations will do, just that i'm inspired by the way calculator works (i built one :D) which shifts 0-9 buttons input by multiplying the old value with 10 each time a button is pressed, so the old value will be on the left of the new one. After those coordinates have a single unique value, it can easily be identified with index, that's the purpose of ValueChange macro. Then the modulo is used to convert the possible minus value that came from the subtraction of the value at MB=1 and the ones came from the rotation. That way the index will always started from 0 no matter what the coordinates are.
    ---
    It's quite easy in core, have several compare-router linked together, and you'll have a nice if-then-else combos :)
    ---
    Mine too :lol:
     
Thread Status:
Not open for further replies.