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

Experience early access to the latest features and updates. You'll have everything that is needed to unleash your robot's potential.

#25  

I just got your reply. Do you see what I am trying to do and am I on the right track? I think, for a simple idea, it should work.

#26  

I have to go out now, but I will try to make it more basic and rewrite it. This way I will learn more and build an example to use.

Thanks for the reply

Nomad has been quiet lately... I wish him well !

Ron R

PRO
Synthiam
#27  

Sorry Andy, absolutely none of that code makes any sense.

  • 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.

#28  

I will continue to work at learning more about scripting. Thanks for the constructive criticism.

Ron R

#29  

@ANDY ROID Approach ARC scripting like Lego... Get a small piece working then build from there... It's best to download other people's code or look at the built in examples in ARC....

For example


$plusdestination = GetDigital(D10)
if($plusdestination =1) #true
Reverse() #or whatever you want to do
else
Forward()
endif

#30  

Thanks Richard,

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

#31  

I got the test script working. I can load a verbal command (Goto A) which loads a coordinate. It runs the continuous servos until the camera servo value matches the coordinate.

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

#32  

This is the Test script. It is not fully completed but it worked for testing. I am aware it needs additional work. Posted for @castlephelps.

#Navigation Test Code 1-4-2016

# $xcoordinate is loaded from speech recognition robot go to door or robot go home


:loop

$apos = GetServo(D10)
 
if ($apos >= $xcoordinate)
goto(math1)
endif 
sleep (500)

if($apos <= $xcoordinate)    # for reverse test

endif 
sleep (500)



:math1
$plusdestination = ($apos - $xcoordinate)
if ($plusdestination >= 0+1)
Servo(d0,119)
Servo(d1,99)
endif
if ($plusdestination = 0)
Servo (d0,109)
Servo(d1,109)
 endif 
:math2
$minusdestination = ($apos - $xcoordinate)
if ($minusdestination <= 0-1)
Servo(d0,99)
Servo(d1,119)
endif
if ($minusdestination = 0)
Servo (d0,109)
Servo(d1,109)
 endif 
  
 Goto(loop)

I will be labeling the lines soon.

Ron R