loading
 
setting target color variable on user command
honor_the_ways from United States  [9 posts]
13 year
I'm working on a robot that can follow a person around using a laptop's webcam.

I have a good program that can follow a color as long as the color is predefined in the RoboRealm program. I would like to modify this program so that it can follow whatever color is at the center of the video feed when a timer runs down, when the user presses a certain key on the keyboard, or on a certain audio cue.

To keep things simple I started with the Keyboard_Read module. Right now I have Sample_color module running against the video and set the coordinates so that the sample_color is analyzing the color of a small box in the middle of the video. I then put in Keyboard_Read and set it up so that when the t key was pressed it would set the variable TARGET_COLOR (a variable I created) to the value of the COLOR_SAMPLE variable from the SAMPLE_COLOR module.

When I watch the variable I see that when t is pressed TARGET_COLOR just takes the literal string value of "COLOR_SAMPLE" or "[COLOR_SAMPLE]" when I tried surrounding it with brackets.

Any tips?


<Keyboard_Read>
  <VARIABLE_0>TARGET_COLOR</VARIABLE_0>
  <SET_ON_RELEASE_0>FALSE</SET_ON_RELEASE_0>
  <KEY_0>t</KEY_0>
  <ACTION_0>SET</ACTION_0>
  <VALUE_0>[COLOR_SAMPLE]</VALUE_0>
</Keyboard_Read>
program.robo
Anonymous 13 year
We've updated RR to work with the way that you specified the variable. Previously we only anticipated static numbers to be used within the keyboard read module ... but your approach makes sense so v2.13.9 is updated to work with the script that you posted.

Please download and give things a try and let us know if you need any other additions to help get your project working.

STeven.

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