Hi Acceleration Rate
Can anyone point me in the right direction on a way in which to measure the rate of acceleration(?), speed of increase/decrease of one of the analogue sticks on a ps2 controller? I am working on using it as a backward/forward motion controller for scratching and would like to be able to make the "return to normal" time of a line object acceleration/velocity (not sure what best describes it) dependant.
Are you trying to measure the speed that stick moves?
this is something i came up with (very quickly - hence it's a bit rough) - it polls the position of the controller and calculates the distance moved between each measurement - I'm not sure if this is what you want, but i'm sure my patch can be improved - it's late and time for bed...
Yes I am trying to calculate the speed the stick moves up or down and then using that acceleration to judge how fast, when released the value should return to 1 (original playing speed).
One problem I can see is that the analog stick goes from 0 65535 in the vertical direction but also gives values in the horizontal so that changes the data. Not that it matter much as it is just scratching so wouldnt be too noticable.
I was messing about with your patch and using poll 50 as thats what my hi object is set to which controls the other buttons and right analog stick. When you say on one axis do you just mean the postive vertical axis ? So upward motion on stick? Or was it just relating to vertical or horizontal motion in general?
The output of the 2 different axis will be separate - each will be prepended by an id - if you look at hi's output (using print) you will see this. If you use route with the appropriate axis id's you can separate all the different controller numbers. There are lot's of examples of this if you search the archives.
Yes I am aware of the seperate id's etc but the left analog seems to have id's 4 and 0. I am guessing the id for vertical motion is 0 but it isnt clear because it is pretty hard just to move along a straight hoziontal line to check if that is id 4. Id 4 only seems to show up when you hit full right/left in horizontal axis.
So what I have set up is a route 0 from hi's output but this still seems to output values whether your moving left/right or up/down, same goes for routing 4. So it seems quite hard to seperate the two.