
Andy Roid
Hello,
I have two cameras mounted on servos. They are set it up in tracking color mode (red). I have an 10 foot square area. The cameras are mounted in two locations (5 feet from a corner), 90 degrees from each other, against the outside wall . While tracking, I want to read the values the servos are at, and display the value. I know I can only read the information sent, not the true value.
I want to take these values and compare them to a preset value or coordinates.
My end goal is to track a Movement Panel to these two values.
My scripting skills are minimal to say the least, but can someone point me in a direction to find examples of these concepts?
I search around and know the "servo read" is somewhere, but I can't remember where.
Rich, Dave and Richard R, posted some information about this. Any ideas?
Ron R
I am only looking at position for now. The area I want to track in is relatively small so the error of distance shouldn't screw it up to much for the test. Later maybe 3 ultra sonic pings and more math will have to be considered, especially when object avoidance is used.
Thanks,
Ron R
When the robot wants to get a fix on it's coordinates it sets the cameras to 0,0 and each sweeps until it finds the objects on each wall. The distance it moves to find it would be related to where it is in the room. In the dead center of the room, it should find both objects at it's 0,0 initial point. That would also be a way to calibrate it. Mounting the cameras on the robot would also make it more autonomous and mean that all you need is to put cards, or whatever, in each room to be navigated. That, as opposed to a set of cameras in each room. Maybe different colors or glyphs for different rooms so it knows what room it is in.
Just a thought. Don't mean to impugn your strategy in any way or worm my way into your project. For all I know that has already been suggested to you and rejected for reasons of which I have not realized.
Anyway, good luck and if you need help with the scripting, let me know.
@jstearns had built something like you mentioned in the past but, I don't know if he went any further with it. I hadn't seen him on the forum for quite a while.
I really don't want to use any external cards or markers. My final wish is an Infra red or other invisible beacon on the robot. The other issue is items in the room may block the targets on the walls. That is why I want the robot to be tracked. The cameras would be mounted where they would not be blocked tracking the robot. I am also waiting for the possibility of an ez robot wireless cameras once spoke of, coming out again. My plan is to mount cameras in the rooms I want to navigate. I would send the go-to coordinates to the robot to track to. I have an inexpensive wifi camera and I will try it once I get the initial testing done.
Between the Holidays, my R2D2 project and my poor servo-less Adventure Bot, it may be a while before this really gets going. The tests with the two servos works, so now I need to build the continuous servos for the Adventure Bot and try the tracking script Dj mentioned.
I will post my progress.
Ron R
I have written a conceptual script for moving and tracking to one coordinate. I tried to load it, but due to my lack of knowledge, I wasn't able to have it work or load. It is as follows:
GetDigital(D10) #Data, taken from tracking camera servo to show current location
$doorxcoordinate #variable, input of location desired (desired track servo value)
$minusdestination #variable, a minus value calculated from current location to desired location. Information determines travel direction and speed.
$plusdestination #variable, a plus value calculated from current location to desired location. Information determines travel direction and speed.
ClearVariables() #set all to 0
:loop
GetDigital(D10) # camera is mounted on servo D10 which is tracking the robot. Data is servo position value. ( this worked in a trial script)
GetAsByte($doorxcoordinate) # coordinate loaded from speech recognition. (this worked in a trial script)
if (GetDigital(D10) => $doorxcoordinate) # do math, equal more than
goto (math1)
Sleep(500)
if GetDigital(D10) <= $doorxcoordinate) #do math, equal less than
goto (math2)
Sleep(500)
endif
math1:
$plusdestination = (GetDigital(D10) - $doorxcoordinate #do math to find coordinate error on plus from location
$minusdestination = $doorxcoordinate - (Getdigital (D10) #do math to find coordinate error on minus from location
if $plusdestination => 10 Forward, 200 # a near target value and speed
if $plusdestination =>1,<=9 forward, 50 # a near target value and speed
if $plusdestination = 0, Stop # a target value and stop command
math2: # same description as math 1
if $minusdestination => 10 reverse, 200
if $minusdestination =>1,<=9 reverse, 50
if $minusdestination = 0, Stop
goto (loop)
I really want to continue this idea to see if it will work. Any advice would be appreciated. I want to keep this as simple as possible.
The first goal is to use Omni wheels on two continuous servos to track to locations in an Auto Position file. These files will be called on from speech recognition. The above is only 1/2 the needed script (X coordinate) for the testing. I will add the Y coordinate, if, and once this is working.
Ron R
I never got it to load. Can I still copy if it has a bunch of syntax errors?
Ron R
Code:
Ok I got it. I'm worst than Nomad sometimes..
For example...
Code:
No your not...
Thanks for the reply
Nomad has been quiet lately... I wish him well !
Ron R
* IF conditions without closing ENDIFs
* Comparing GetDigital() with integer values. As the manual states, GetDigital returns a True (1) or a False (0) only, because it is Digital. Read dictionary definition of the word Digital
* Incorrect comparison used for Greater Than Equals, should be >= not =>
* Random single line functions not assigned to variables (i.e. GetAsByte()). Also a bunch of variables with nothing being assigned specified on single lines.
* ClearVariables() being used, which i don't know why that would ever be done outside of loading a new project because it clears every variable in the stack.
My advise is to visit the LEARN section and click on ACTIVITIES course. There are lessons which explain how to do basic tracking. Once you have successfully accomplished those activities, use the EXAMPLES folder in ARC to see examples of EZ-Script functions and how they work.
Ron R
For example
Code:
I had only wanted to post "CONCEPT" not real code. That is why I listed it in thread # 20 with labels, not using the UBB Code. Dj' s reply was code issues , not concept issues, so he replied firmly.
In the future I will build my ideas in code to the best of my ability. Your advice is well taken and I will do line by line testing of my script to be sure it works. I will then post the real scripting.
I still think my idea will do what I want.
More to come...LOL
Ron R
My next problem is getting better vision/tracking. I was using a web cam, but now I think I will need to, at minimum, use the "old" Ez robot camera. I think Dj said it was better than a web cam, but not as good as the new release one. I am hoping a wireless unit once spoke of comes out soon. Otherwise I will have to buy a new one or any suggestions?
What has been found to be the best color to use for tracking? Can I use a light beacon? Any suggestions. I was thinking a maybe white because it is neutral?
I am getting closer to a full trial.
Ron R
Code:
I will be labeling the lines soon.
Ron R
@castlephelps
Maybe you could load locations? instead of numbers?
Ron R
Ron R