Asked — Edited

Reading And Using Servo Values In Tracking

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


ARC Pro

Upgrade to ARC Pro

Don't limit your robot's potential – subscribe to ARC Pro and transform it into a dynamic, intelligent machine.

#17  

Ok, interesting method. I like it. Gets my gears turning. Just thinking out loud here but ... thinking about mounting both cameras on the robot and glyphs or solid color cards in the center of each of two adjoining walls . Could even be lights. Most cameras are sensitive to infrared so it could be invisible to boot.

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. :D

Anyway, good luck and if you need help with the scripting, let me know.

#18  

Hi WBS00001, Opinions and help is always accepted. Thank you.

@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

#19  

I have returned to the correct posting for my idea for a very simple navigation script. I wanted to find out if I could look at the program for the camera tracking, but found it isn't a script, but a program.

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

#20  

@ANDY ROID can you please post using the proper UBB tags.... It's really hard to read your code in a plain post....

#21  

Hi Richard,

I never got it to load. Can I still copy if it has a bunch of syntax errors?

Ron R

#22  

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) =&gt; $doorxcoordinate) # do math, equal more than
goto (math1)
 Sleep(500)

if GetDigital(D10) &lt;= $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 =&gt; 10 Forward, 200 # a near target value and speed

 if $plusdestination =&gt;1,&lt;=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 =&gt; 10 reverse, 200

 if $minusdestination =&gt;1,&lt;=9 reverse, 50

 if $minusdestination = 0, Stop

 goto (loop)

Ok I got it. I'm worst than Nomad sometimes..

#23  

For one thing you have to use a new line per command... a comma doesn't work for the next command... For example...


if($whatever&gt;10)
Reverse()
else
Forward()
endif

Quote:

Ok I got it. I'm worst than Nomad sometimes..
No your not...:)

#24  

I see I need to fix the command to set the servo for movement, forward, and set the speed which I didn't address in the script. I was more concerned about doing the math and proving it out.