覆盖鼠标的速率设置。创建我自己的鼠标速率算法

时间:2022-11-02 20:52:53

I am working with disabled children, who have cerebral palsy. One child has limited fine motor control, so she currently uses a joystick to control the mouse, and it's traverse rate is set very low. This works well for her, as she can click all buttons on the screen, but I think we could do better - when she wants to traverse the whole screen it takes an age to do so (about 10 seconds).

我正在和患有脑瘫的残疾儿童一起工作。一个孩子的精细运动控制有限,所以她目前使用操纵杆来控制鼠标,并且它的移动速度设置得非常低。这对她很有用,因为她可以点击屏幕上的所有按钮,但我认为我们可以做得更好 - 当她想要遍历整个屏幕时需要一个年龄(约10秒)。

My hypothesis is that her brain is fine, and only her motor control is poor. If that's true, I believe that a mouse that started at a low speed, but experienced a constant acceleration, would be better for her, as it would pick up speed and become quick when traversing the whole screen. If this works, then we could be tweaking PID control, and velocity/acceleration setting for a great number of disabled people, speeding up their access and hence their learning and development.

我的假设是她的大脑很好,只有她的运动控制能力差。如果这是真的,我相信一个以低速开始但经历恒定加速的鼠标对她来说会更好,因为它会提高速度并在穿越整个屏幕时变得快速。如果这样可行,那么我们可以调整PID控制,以及为大量残疾人设置速度/加速度,从而加快他们的访问速度,从而加快他们的学习和发展。

But I do not know the best way to build this - all suggestions, thoughts, links and tips welcome.

但我不知道建立这个的最佳方式 - 欢迎所有的建议,想法,链接和提示。

To begin with I have tried using Processing and Java, and using a mouseListener, and a Robot to control the cursor. I'm not convinced that this is the best way though, as I'm reading the cursor position and then writing to it, so my best attempts still make the cursor jump around, and there is not smooth movement. Is it achievable in Java? Do I need to read the mouse input from the USB using some kind of driver, and then replace the plotting of the cursor on screen with my own?

首先,我尝试使用Processing和Java,并使用mouseListener和Robot来控制光标。我不相信这是最好的方法,因为我正在读光标位置然后写入它,所以我最好的尝试仍然会让光标跳转,并且没有平稳的移动。它在Java中是否可以实现?我是否需要使用某种驱动程序从USB读取鼠标输入,然后将屏幕上的光标替换为我自己的?

I've made a couple of videos to illustrate the effect I am trying to bring about.

我制作了几个视频来说明我想要带来的效果。

The Status quo (my illustration is driving the cursor off the arrow keys) http://www.youtube.com/watch?v=3ZhQCg5DJt8

现状(我的插图是将光标从箭头键上移开)http://www.youtube.com/watch?v=3ZhQCg5DJt8

The new behaviour I want (mouse accelerates) http://www.youtube.com/watch?v=JcBK_ZCFGPs

我想要的新行为(鼠标加速)http://www.youtube.com/watch?v=JcBK_ZCFGPs

if it's any use, the Processing code I used to make those demos is copied in below:

如果它有用,我用于制作这些演示的处理代码将在下面复制:

Status quo demo:

现状演示:

import java.awt.AWTException;
import jav
a.awt.Robot;

Robot robot;
int i = 0;
int j = 0;

void setup() {
  setupDotgame();
  try { 
    robot = new Robot();
  } 
  catch (AWTException e) {
    e.printStackTrace();
  }
  robot.mouseMove(screenWidth/2, screenHeight/2);
}

void draw() {
  //println(frameCount);
  robot.mouseMove(screenWidth/2+8*i, screenHeight/2+8*j);
  drawDotgame();
}

void keyPressed() {
  if (keyCode == UP) {
    j--;
  } 
  else if (keyCode == DOWN) {
    j++;
  }
  else if (keyCode == RIGHT) {
    i++;
  }
  else if (keyCode == LEFT) {
    i--;
  }
}

Desired behaviour:

期望的行为:

import java.awt.AWTException;
import java.awt.Robot;

Robot robot;
int i = 0;
int j = 0;
int delta = 8;
int time = 0;

void setup() {
  setupDotgame();
  try { 
    robot = new Robot();
  } 
  catch (AWTException e) {
    e.printStackTrace();
  }
  robot.mouseMove(screenWidth/2, screenHeight/2);
}

void draw() {



  //println(frameCount);
  robot.mouseMove(screenWidth/2+i, screenHeight/2+j);
  drawDotgame();

}

void keyPressed() {
  if (millis() - time < 90) {
    delta += 8;
  }
  else { delta = 8; }
  time = millis();


  if (keyCode == UP) {
    j-=delta;
  } 
  else if (keyCode == DOWN) {
    j+=delta;
  }
  else if (keyCode == RIGHT) {
    i+=delta;
  }
  else if (keyCode == LEFT) {
    i-=delta;
  }
}

And the DotGame code they both reference:

他们都参考了DotGame代码:

void setupDotgame() {
  size(1000, 600);
  background(255);
  fill(255, 0, 0);
  noStroke();
  smooth();
  drawCircle();
}

void drawDotgame() {
  if (get(mouseX, mouseY) != color(255)) {
    background(255);
    drawCircle();
  }
}

void drawCircle() {
  int x = round(random(50, width-50));
  int y = round(random(50, height-50));
  int rad = round(random(20, 80));
  ellipse(x, y, rad, rad);
}

Thanks in advance

提前致谢

1 个解决方案

#1


0  

as Carl suggested, I believe the best answer short of making the mouse actually have this behavior, is some sort of jumping behavior that will get the mouse fairly close to where you need to go, then use the joystick from there.

正如卡尔建议的那样,我认为最好的答案不是让鼠标实际上有这种行为,是某种跳跃行为会使鼠标距离你需要去的地方非常接近,然后从那里使用操纵杆。

I happen to know that a program called AutoItv3 can do this sort of thing. You could set it up to recognize special hotkeys, then have that hotkey move the mouse to whatever region you wish.

我碰巧知道一个名为AutoItv3的程序可以做这种事情。您可以将其设置为识别特殊热键,然后让该热键将鼠标移动到您希望的任何区域。

Commands useful for this are HotKeySet, MouseMove, and Func/EndFunc.

对此有用的命令是HotKeySet,MouseMove和Func / EndFunc。

#1


0  

as Carl suggested, I believe the best answer short of making the mouse actually have this behavior, is some sort of jumping behavior that will get the mouse fairly close to where you need to go, then use the joystick from there.

正如卡尔建议的那样,我认为最好的答案不是让鼠标实际上有这种行为,是某种跳跃行为会使鼠标距离你需要去的地方非常接近,然后从那里使用操纵杆。

I happen to know that a program called AutoItv3 can do this sort of thing. You could set it up to recognize special hotkeys, then have that hotkey move the mouse to whatever region you wish.

我碰巧知道一个名为AutoItv3的程序可以做这种事情。您可以将其设置为识别特殊热键,然后让该热键将鼠标移动到您希望的任何区域。

Commands useful for this are HotKeySet, MouseMove, and Func/EndFunc.

对此有用的命令是HotKeySet,MouseMove和Func / EndFunc。