speedlim temporarily ignores threshold setting

Mar 26, 2007 at 3:09pm

speedlim temporarily ignores threshold setting

Hello everyone,

Below is a subpatch taken from a larger patch that I am building to intuitively move around openGL space in Jitter using a mouse and keyboard. I’m running into one annoying problem.

I’m calculating the speeds of movement along the x and y axes and scaling those values to change the time settings on some speedlims. As the angle of rotation reaches one axis the speed values (speedlim thresh) get drastically slower for the other axis. This is expected, of course, but what I can’t figure out is why the speedlims temporarily “space-out” when these rotational extremes are reached/passed.

Try slowly moving the top number box from 195 to 205 and watch the bangs beneath the speedlims. This doesn’t seem to be an event queue problem, does it? Maybe the numbers at the extremes are too large and are wrapping around on themselves? I’m sure someone here will quickly see what has been eluding me. Thanks in advance!

max v2;
#N vpatcher 52 109 678 743;
#P window setfont “Sans Serif” 12.;
#P window linecount 1;
#P comment 4 103 416 131137548 Is this an event queue issue??;
#P comment 4 82 416 131137548 The correction on the right only helps slightly;
#P window setfont “Sans Serif” 9.;
#P message 502 436 36 131137545 set $1;
#P number 502 510 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 423 510 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 423 436 36 131137545 set $1;
#P comment 222 415 43 131137545 y speed;
#P hidden message 9 464 14 131137545 1;
#P hidden newex 9 443 47 131137545 loadbang;
#P button 156 489 15 0;
#P button 77 489 15 0;
#P newex 73 151 66 131137545 sel 0 200 400;
#P newex 159 390 30 131137545 sel 0;
#P newex 80 391 30 131137545 sel 0;
#P toggle 143 444 15 0;
#P toggle 64 444 15 0;
#P button 143 546 15 0;
#P button 64 546 15 0;
#P newex 143 510 46 131137545 speedlim;
#P newex 64 510 46 131137545 speedlim;
#P newex 143 466 41 131137545 metro 1;
#P newex 64 466 41 131137545 metro 1;
#P number 73 131 35 9 0 400 3 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 127 176 53 131137545 split 0 200;
#P comment 207 232 44 131137545 degrees;
#P flonum 170 232 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 170 210 95 131137545 scale 400 200 90. 0.;
#P number 179 414 42 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 159 370 62 131137545 expr 100/$f1;
#P number 100 414 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 80 370 62 131137545 expr 100/$f1;
#P comment 147 329 13 131137545 y;
#P comment 65 329 13 131137545 x;
#P flonum 159 351 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 159 329 20 131137545 sin;
#P newex 80 210 85 131137545 scale 0 200 90. 0.;
#P comment 117 232 44 131137545 degrees;
#P flonum 80 232 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 80 279 34 131137545 / 180.;
#P newex 80 258 55 131137545 * 3.141593;
#P flonum 80 300 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 117 301 44 131137545 radians;
#P flonum 80 351 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 80 329 23 131137545 cos;
#P comment 136 415 43 131137545 x speed;
#P window setfont “Sans Serif” 12.;
#P window linecount 2;
#P comment 4 47 416 131137548 Speedlim seems not pay attention to the smaller numbers for a short while after it has received a very large number;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 545 415 43 131137545 y speed;
#P hidden message 332 464 14 131137545 1;
#P hidden newex 332 443 47 131137545 loadbang;
#P newex 396 151 66 131137545 sel 0 200 400;
#P newex 482 390 30 131137545 sel 0;
#P newex 403 391 30 131137545 sel 0;
#P toggle 466 444 15 0;
#P toggle 387 444 15 0;
#P button 466 567 15 0;
#P button 387 567 15 0;
#P newex 466 531 46 131137545 speedlim;
#P newex 387 531 46 131137545 speedlim;
#P newex 466 466 41 131137545 metro 1;
#P newex 387 466 41 131137545 metro 1;
#P number 396 131 35 9 0 400 3 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 450 176 53 131137545 split 0 200;
#P comment 530 232 44 131137545 degrees;
#P flonum 493 232 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 493 210 95 131137545 scale 400 200 90. 0.;
#P number 502 414 42 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 482 370 62 131137545 expr 100/$f1;
#P number 423 414 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 403 370 62 131137545 expr 100/$f1;
#P comment 470 329 13 131137545 y;
#P comment 388 329 13 131137545 x;
#P flonum 482 351 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 482 329 20 131137545 sin;
#P newex 403 210 85 131137545 scale 0 200 90. 0.;
#P comment 440 232 44 131137545 degrees;
#P flonum 403 232 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 403 279 34 131137545 / 180.;
#P newex 403 258 55 131137545 * 3.141593;
#P flonum 403 300 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 440 301 44 131137545 radians;
#P flonum 403 351 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 403 329 23 131137545 cos;
#P window setfont “Sans Serif” 12.;
#P comment 4 26 412 131137548 Move from high 190′s to low 200′s (where the y speed slows significantly);
#P window setfont “Sans Serif” 9.;
#P comment 459 415 43 131137545 x speed;
#P hidden connect 75 0 76 0;
#P hidden connect 76 0 68 0;
#P connect 68 0 62 0;
#P connect 62 0 64 0;
#P connect 64 0 66 0;
#P connect 61 0 72 0;
#P connect 62 0 73 0;
#P fasten 60 0 48 0 132 198 85 198;
#P connect 48 0 46 0;
#P fasten 58 0 44 0 175 253 85 253;
#P connect 46 0 44 0;
#P connect 44 0 45 0;
#P connect 45 0 43 0;
#P connect 43 0 40 0;
#P connect 40 0 41 0;
#P connect 41 0 53 0;
#P connect 53 0 70 0;
#P connect 70 1 54 0;
#P connect 54 0 64 1;
#P connect 72 3 60 0;
#P hidden connect 76 0 69 0;
#P connect 69 0 63 0;
#P connect 63 0 65 0;
#P connect 65 0 67 0;
#P connect 63 0 74 0;
#P fasten 43 0 49 0 85 322 164 322;
#P connect 49 0 50 0;
#P connect 50 0 55 0;
#P connect 55 0 71 0;
#P connect 60 1 57 0;
#P connect 57 0 58 0;
#P connect 71 1 56 0;
#P connect 56 0 65 1;
#P hidden connect 35 0 36 0;
#P hidden connect 36 0 30 0;
#P connect 30 0 24 0;
#P connect 24 0 26 0;
#P connect 26 0 28 0;
#P connect 23 0 34 0;
#P fasten 22 0 10 0 455 198 408 198;
#P connect 10 0 8 0;
#P connect 8 0 6 0;
#P fasten 20 0 6 0 498 253 408 253;
#P connect 6 0 7 0;
#P connect 7 0 5 0;
#P connect 5 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 15 0;
#P connect 15 0 32 0;
#P connect 32 1 16 0;
#P connect 16 0 78 0;
#P connect 24 0 79 0;
#P connect 78 0 79 0;
#P connect 79 0 26 1;
#P connect 34 3 22 0;
#P hidden connect 36 0 31 0;
#P connect 31 0 25 0;
#P connect 25 0 27 0;
#P connect 27 0 29 0;
#P fasten 5 0 11 0 408 322 487 322;
#P connect 11 0 12 0;
#P connect 12 0 17 0;
#P connect 17 0 33 0;
#P connect 22 1 19 0;
#P connect 19 0 20 0;
#P connect 33 1 18 0;
#P connect 18 0 81 0;
#P connect 25 0 80 0;
#P connect 81 0 80 0;
#P connect 80 0 27 1;
#P pop;

#31030
Mar 26, 2007 at 3:45pm

The speedlim does slow down, but it seems to me that’s normal behaviour. When i see the ‘x speed’ and ‘y speed’ number boxes near the bottom, they get very high values when you’re close to 0 or PI on your circle (normal when using sin & cos).

Those values (12732 for input 199, 6366 for input 198) are then put into the speedlim’s right inlet, which specifies the delay it uses in ms. 12.7 seconds and 6.4 seconds seems to work correctly. When you go over 200 input, the delays go down relatively fast again.

I think you’ve made a mistake in your thinking. Please note that speedlim will only take a new delay time into account when the previous one that was started has completely finished . This means your bang will not arrive for those 12 seconds, after which it will start a new delay which is as long as your latest input. Good luck!

#100263
Mar 26, 2007 at 4:07pm

Thanks for the input. This makes sense, it had occured to me but for some reason I thought the solution on the right would fix it.

Here’s a solution. Thanks for knocking my brain into action.

max v2;
#N vpatcher 52 109 368 688;
#P button 160 512 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 141 488 29 131137545 t b b;
#P newex 141 465 44 131137545 togEdge;
#P newex 141 443 48 131137545 >=;
#P number 141 420 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 141 397 40 131137545 clocker;
#P hidden message 43 61 23 131137545 100;
#P hidden newex 25 34 47 131137545 loadbang;
#P button 81 511 15 0;
#P newex 62 487 29 131137545 t b b;
#P newex 62 464 44 131137545 togEdge;
#P newex 62 442 48 131137545 >=;
#P number 62 419 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 62 396 40 131137545 clocker;
#P window setfont “Sans Serif” 12.;
#P comment 110 83 72 131137548 scrub here;
#P window setfont “Sans Serif” 9.;
#P comment 222 368 43 131137545 y speed;
#P newex 73 104 66 131137545 sel 0 200 400;
#P newex 159 343 30 131137545 sel 0;
#P newex 80 344 30 131137545 sel 0;
#P number 73 84 35 9 0 400 3 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 127 129 53 131137545 split 0 200;
#P comment 207 185 44 131137545 degrees;
#P flonum 170 185 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 170 163 95 131137545 scale 400 200 90. 0.;
#P number 179 367 42 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 159 323 62 131137545 expr 100/$f1;
#P number 100 367 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 80 323 62 131137545 expr 100/$f1;
#P comment 147 282 13 131137545 y;
#P comment 65 282 13 131137545 x;
#P flonum 159 304 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 159 282 20 131137545 sin;
#P newex 80 163 85 131137545 scale 0 200 90. 0.;
#P comment 117 185 44 131137545 degrees;
#P flonum 80 185 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 80 232 34 131137545 / 180.;
#P newex 80 211 55 131137545 * 3.141593;
#P flonum 80 253 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 117 254 44 131137545 radians;
#P flonum 80 304 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 80 282 23 131137545 cos;
#P comment 136 368 43 131137545 x speed;
#P hidden connect 34 0 35 0;
#P hidden connect 34 0 28 0;
#P fasten 32 0 28 0 67 511 51 511 51 386 67 386;
#P connect 28 0 29 0;
#P connect 29 0 30 0;
#P connect 30 0 31 0;
#P connect 31 0 32 0;
#P hidden connect 35 0 22 0;
#P connect 22 0 25 0;
#P fasten 21 0 9 0 132 151 85 151;
#P connect 9 0 7 0;
#P fasten 19 0 5 0 175 206 85 206;
#P connect 7 0 5 0;
#P connect 5 0 6 0;
#P connect 6 0 4 0;
#P connect 4 0 1 0;
#P connect 1 0 2 0;
#P connect 2 0 14 0;
#P connect 14 0 23 0;
#P connect 32 1 33 0;
#P connect 23 1 15 0;
#P connect 15 0 30 1;
#P connect 25 3 21 0;
#P hidden connect 34 0 36 0;
#P fasten 40 0 36 0 146 512 130 512 130 387 146 387;
#P connect 36 0 37 0;
#P connect 37 0 38 0;
#P connect 38 0 39 0;
#P connect 39 0 40 0;
#P fasten 4 0 10 0 85 275 164 275;
#P connect 10 0 11 0;
#P connect 11 0 16 0;
#P connect 16 0 24 0;
#P connect 40 1 41 0;
#P connect 21 1 18 0;
#P connect 18 0 19 0;
#P connect 24 1 17 0;
#P connect 17 0 38 1;
#P pop;

#100264
Mar 27, 2007 at 11:18am

Hi zseldess,

Your new patch seems to do nearly the same as your old patch to me. The output is still slow when you move near 200. Right now, I don’t really understand what you are trying to achieve using the speedlims.

From your explanation, it seems like you just want to move an object at a certain angle (and speed). In that case, I wouldn’t use speedlim, but I’d do it like in the patch below. I hope it is of any use, otherwise please clarify what you’re trying to do…
Good luck!

#P window setfont “Sans Serif” 12.;
#P window linecount 1;
#P comment 112 72 62 196620 direction;
#P window setfont “Sans Serif” 9.;
#P message 225 163 31 196617 0.05;
#P message 205 163 14 196617 0;
#P newex 128 262 27 196617 i;
#P newex 46 181 40 196617 % 360;
#P newex 46 140 46 196617 * -360.;
#P newex 46 161 37 196617 + 630;
#P newex 46 52 69 196617 loadmess 0.75;
#P user jsui 46 72 64 64 1 0 0 jsui_360dial.js;
#P window setfont “Sans Serif” 12.;
#P comment 320 206 112 196620 reset position;
#P button 300 206 15 0;
#P window setfont “Sans Serif” 9.;
#P hidden message 241 403 14 196617 0;
#P hidden message 360 399 81 196617 position 0. 0. 0.;
#P newex 205 184 69 196617 loadmess 0.01;
#P newex 128 403 29 196617 * 1.;
#P newex 188 403 29 196617 * 1.;
#P newex 128 503 83 196617 prepend position;
#P flonum 205 205 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Sans Serif” 12.;
#P comment 242 205 45 196620 speed;
#P window setfont “Sans Serif” 9.;
#P newex 128 482 66 196617 pack 0. 0. 0.;
#P newex 128 454 27 196617 f;
#P newex 188 454 27 196617 f;
#P newex 188 431 27 196617 + 0.;
#P newex 128 431 27 196617 + 0.;
#P newex 297 378 45 196617 jit.qball;
#P newex 297 399 58 196617 t b erase b;
#P toggle 297 337 15 0;
#P newex 297 356 52 196617 metro 40;
#P newex 325 440 361 196617 jit.gl.gridshape move @depth_enable 1 @smooth_shading 1 @lighting_enable 1;
#P newex 297 493 157 196617 jit.window move @depthbuffer 1;
#P newex 297 470 163 196617 jit.gl.render move @camera 0 0 8;
#P comment 171 372 13 196617 y;
#P comment 110 371 13 196617 x;
#P flonum 188 371 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 188 349 20 196617 sin;
#P flonum 128 371 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 128 349 23 196617 cos;
#P flonum 128 324 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 128 304 48 196617 / 180.;
#P newex 128 283 69 196617 * 3.141593;
#P number 46 203 35 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Sans Serif” 12.;
#P comment 88 204 112 196620 angle in degrees;
#P hidden connect 31 0 30 0;
#P lcolor 1;
#P hidden connect 31 0 29 0;
#P lcolor 1;
#P hidden fasten 30 0 18 1 246 424 150 424;
#P lcolor 1;
#P hidden fasten 30 0 19 1 246 424 210 424;
#P lcolor 1;
#P connect 24 0 27 1;
#P lcolor 11;
#P connect 24 0 26 1;
#P lcolor 11;
#P connect 21 0 22 0;
#P connect 21 0 18 1;
#P fasten 20 0 22 1 193 476 161 476;
#P connect 20 0 19 1;
#P connect 4 0 5 0;
#P connect 4 0 7 0;
#P connect 40 0 24 0;
#P connect 39 0 24 0;
#P connect 16 2 38 0;
#P connect 38 0 2 0;
#P connect 1 0 38 1;
#P lcolor 10;
#P connect 37 0 1 0;
#P connect 35 0 37 0;
#P connect 36 0 35 0;
#P connect 33 0 36 0;
#P connect 34 0 33 0;
#P connect 28 0 24 0;
#P hidden connect 29 0 13 0;
#P lcolor 1;
#P connect 17 0 16 0;
#P connect 16 0 11 0;
#P connect 16 1 11 0;
#P connect 27 0 18 0;
#P connect 26 0 19 0;
#P connect 8 0 26 0;
#P connect 6 0 27 0;
#P connect 18 0 21 0;
#P connect 25 0 13 0;
#P connect 22 0 25 0;
#P connect 13 0 11 0;
#P connect 19 0 20 0;
#P connect 14 0 17 0;
#P connect 15 0 14 0;
#P connect 5 0 6 0;
#P connect 7 0 8 0;
#P connect 3 0 4 0;
#P connect 2 0 3 0;
#P window clipboard copycount 42;

#100265
Mar 28, 2007 at 1:12am

Hi Bas van der Graaff,

As I stated in my last post, I found a solution. And as my new patch shows, I’m NOT using speedlim.

This is one very small aspect of a much larger project – there’s no need to go into the details here. As I said in my first post, I needed to calculate the speed of movement along the x and y axes based on rotation. In this situation, the speed of movement equates to the speed of a repeated bang. I was just going about this the wrong way with speedlim. Thanks for the input.

Here it is again, slightly modified. Again, changing the speed of bangs for each axes (== speed of movement in this scenario) based on the rotation on the x and y axes:

max v2;
#N vpatcher 317 78 673 575;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 113 155 14 131137545 0;
#P message 63 155 14 131137545 0;
#P newex 29 155 29 131137545 t b 1;
#P newex 79 155 29 131137545 t b 1;
#P toggle 170 266 15 0;
#P toggle 91 266 15 0;
#P message 79 87 14 131137545 0;
#P newex 29 134 44 131137545 togEdge;
#P newex 112 87 27 131137545 t 1 f;
#P message 29 87 14 131137545 0;
#P newex 79 134 44 131137545 togEdge;
#P newex 29 61 111 131137545 sel 90 0;
#P button 189 410 15 0;
#P newex 170 386 29 131137545 t b b;
#P newex 170 363 44 131137545 togEdge;
#P newex 170 341 48 131137545 >=;
#P number 170 318 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 170 295 40 131137545 clocker;
#P button 110 409 15 0;
#P newex 91 385 29 131137545 t b b;
#P newex 91 362 44 131137545 togEdge;
#P newex 91 340 48 131137545 >=;
#P number 91 317 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 91 294 40 131137545 clocker;
#P comment 251 251 43 131137545 y speed;
#P number 208 250 42 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 208 225 62 131137545 expr 100/$f1;
#P number 129 250 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 129 225 62 131137545 expr 100/$f1;
#P comment 196 184 13 131137545 y;
#P comment 152 184 13 131137545 x;
#P flonum 208 206 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 208 184 20 131137545 sin;
#P comment 66 39 70 131137545 0 – 90 degrees;
#P flonum 29 39 35 9 0. 90. 3 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 129 134 34 131137545 / 180.;
#P newex 129 113 55 131137545 * 3.141593;
#P flonum 129 155 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 166 156 44 131137545 radians;
#P flonum 129 206 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 129 184 23 131137545 cos;
#P comment 165 251 43 131137545 x speed;
#P connect 7 0 30 0;
#P connect 30 0 32 0;
#P connect 33 0 34 0;
#P connect 32 0 34 0;
#P connect 34 0 39 0;
#P connect 34 1 40 0;
#P connect 30 1 35 0;
#P connect 33 0 31 0;
#P connect 35 0 31 0;
#P connect 31 0 38 0;
#P connect 40 0 36 0;
#P connect 39 1 36 0;
#P connect 36 0 18 0;
#P fasten 22 0 18 0 96 409 80 409 80 284 96 284;
#P connect 18 0 19 0;
#P connect 19 0 20 0;
#P connect 20 0 21 0;
#P connect 21 0 22 0;
#P connect 39 0 23 0;
#P connect 22 1 23 0;
#P fasten 30 2 33 0 134 82 117 82;
#P connect 31 1 41 0;
#P connect 33 1 5 0;
#P connect 5 0 6 0;
#P connect 6 0 4 0;
#P connect 4 0 1 0;
#P connect 1 0 2 0;
#P connect 2 0 13 0;
#P connect 13 0 14 0;
#P connect 14 0 20 1;
#P connect 41 0 37 0;
#P connect 38 1 37 0;
#P connect 37 0 24 0;
#P fasten 28 0 24 0 175 410 159 410 159 285 175 285;
#P connect 24 0 25 0;
#P connect 25 0 26 0;
#P connect 26 0 27 0;
#P connect 27 0 28 0;
#P connect 38 0 29 0;
#P connect 28 1 29 0;
#P fasten 4 0 9 0 134 177 213 177;
#P connect 9 0 10 0;
#P connect 10 0 15 0;
#P connect 15 0 16 0;
#P connect 16 0 26 1;
#P pop;

#100266

You must be logged in to reply to this topic.