loading
 
"Mouse" example not working
anand from United States  [1 posts]
13 year
Hey there,

I recently downloaded RoboRealm 2.37, and I was trying to use the "Mouse_example1" program, that allows a user to use a red ball/light source to manipulate a cursor. The problem is, the cursor does not in any way respond to the center of gravity (which I can clearly see moving about on the screen). I opened up the VBscript that was part of the example, and saw that no variables were available for use (in the small box right below the scripting field). Also, when I opened the COG module, all of the COG variables (COG_X etc.) were all greyed out. I'm assuming that this means, somehow, there is no variable that stores the x and y value of the blob.

My question is, why is this, and how can I fix it so that the variables are recognized by the Mouse module?

On a side note: A couple of years ago, I downloaded RoboRealm, and the "Mouse" example was included in that version (not sure which); however, in version 2.37, it doesn't seem to be included. Also, I noticed a couple of changes in the "Mouse_example" program from before- if I'm not mistaken, the old version used a blob filter, whereas this one does not. If, in some event, I'm not able to fix this problem, would it be possible to download an older version (via FTP or something)?

Thanks
Anand
Anonymous 13 year
Anand,

We checked out the script and it seemed to operate the way we expected. There are a couple subtle concepts that are going on with that script.

1. At first the mouse will NOT move in response to a red object. Only after a couple seconds of you NOT moving the mouse too will it activate the mouse movement. This is a feature to prevent you fighting with the application for control of the mouse. So when you run the script leave the mouse along (and stable) for a bit and you should start to see the cursor move in relation to the object.

2. A mouse click is simulated by the distance of the object from the camera in terms of pixels. If the object is larger than 50 pixels (that's actually quite small) the program simulates a mouse click. When it falls below 50 pixels the mouse is lifted. So if you are using a large red object move it further back or change that 50 threshold in the VBscript to allow for a larger object to NOT simulate a mouse click.

3. If you didn't see any variables in the VBScript module the system is most likely not running. Check that the Run button in RR is pressed.

4. The COG interface is correct. It is always grayed to indicate a READ only situation ... in other words you cannot change those values in the interface as that module is producing those values. This is to avoid confusion with other GUI interfaces that do allow you to change the values.

Hopefully this helps ... note we updated the Mouse.robo to show the source image (quick tweak to the COG module). Let me know if any of this helps ...

STeven.
Manoj from India  [2 posts] 12 year
Sir I just tried the mouse interfacing module in roborealm . Everything seems to work nice and ok , but the Y- direction is inverted.
If move the blue pointed object over dark background in upward direction the mouse moves in downward direction and vice-verse. Can you please help me wit this problem. I even tried a VB script but couldn't get it to work. I am a bit week in VB script programming, so please help me with this.

I am also posting Roborealm program which I did.

program.robo
Anonymous 12 year
Manoj,

There are a couple ways to do this. You can use the Scale module to create a new variable and invert the results. For a quick and easy way you can invert the variable right in the Mouse Interface module using

[IMAGE_HEIGHT-COG_Y]

The [] mean that the stuff typed in should be evaluated as an expression. Subtracting the image height from the COG_Y will invert its movement.

See attached robofile to see if that does the trick.

STeven.
program.robo
Manoj from India  [2 posts] 12 year
OMG!!!. Thank you very much sir , It really worked for me. I had a very hard time trying to figure it out . Thank you very much for your help .

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index