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

Elevate your robot's capabilities to the next level with Synthiam ARC Pro, unlocking a world of possibilities in robot programming.

#1  

Normally you can't query the location that a servo is at. You would have to do this in one of three ways that I can think of.

  1. Take the servo apart and attach wire leads to the pot that is in the servo. These leads would connect to an analog port on the ezb. I haven't done it this way but you should be able to read the location of the pot. The concern would be that the power or volts going to the ezb from the servo would be too high and cause damage. I dink know.

  2. Use a script for your movement of the camera and set a variable for where you told the servo to stop

  3. Use an arduino or pic to drive the motor in the servo and read the pot to know when to stop. Serial commands can be used to query the location of the pot, which would cause the arduino or pic to read the location of the pot. This is the far more difficult approach but the one that offers the most options. This is the path that I choose to go down.

Someone else might have some other suggestions that would be easier to impliment.

#2  

Hello Dave, I really want to stay on the simpler side. I want to read the value I.e. 0 to 180 degrees or the numeric values being sent to the servo by the ezb.

Ron R

#3  

Your number 2 answer is the way I want to go for now. My future idea will be to get actual feedback from another ezb.

We had a discussion about a similar concept in the past. This test is a very simple idea I want to try. I have the hardware, but need to learn more about the scripting to make it work.

Ron R

#4  

I totally understand. I dont know if it is possible in ARC to catch the locations being set to the servos from the tracking piece of the camera control. If it isnt being set to variables from the control, you would probably not be able to get it. DJ would have to make a code change to make this happen for you I think. I think it could be done. To know where the servo is at though, you would need to query the pot. I dont think this is essential to what you are doing (querying the pot) as I think that it would probably be fine to just know where the servo was told to go last instead of a "Where am I now" type of query.

#5  

The script command you are looking for is GetServo(port)

From the script manual:


GetServo( Port )
#Returns the last specified servo Position value of the servo port.
#Servo position is between 1 and 180
#Example: $x = GetServo(d0)

#6  

There you go:). I haven't been scripting much at all lately so I have become rusty on all of the commands.

Thanks Alan

#7  

Thanks Dave, Alan found what I am looking for. I warned everyone, Im not rusty, I am unknowing.. LOL .. With this information I can start playing around. My next step is to compare the servo value to a preset value and figure how to track to it. This way as I move it updates my current location by the servo/camera values, both in an x and y axis.

Any ideas will be appreciated.

Thanks Alan.. I knew it was somewhere.

Ron R

#8  

I'm pretty rusty Ron also but this may be what you're looking for. This is untested:


Servo( D1, 100 ) #moves servo attached to port D1 to position 100
Sleep( 500 ) #pause to move servo - value must be adjusted to your needs
$Servopostion = GetServo(D1) #sets the variable $Servopostion form servo command :GetServo" 

You can now use the $Servopostion variable in your next script or command to reference where the servo attached to D1 should be. If that servo moves by some other means outside of ARC or without using the Servo() command then this variable may be useless.

Also each time you move the servo using ARC with the Servo() command you need to use the "$Servopostion = GetServo(D1)" again to get the new position.

Hope this helps. ;)