Troop191Robotics
Hello Gang,
I tried to use relative tracking, within a script. It does not drive the motors that are in the modified servo Movement Panel The command that I used is: ControlCommand("Camera",CameraServoTrackRelativeEnable) I tired with and without quotes. The full script is listed below.
Any thoughts?
Thanks again. I think we are close. Then again, we blew out 8 EZ Robot ports. 4 of which we never connected to? I use a current limited LED and a diagnostic script.
The video is coming!
This script attempts to track glyphs
Enable Ping Colision to stop at min range.
:Initialize #Initialize Camera servo Say(Initializing) servo(D0,01) sleep(1000) #Allow time for detection
:Scan #If track then Center, else Scan Say(Scanning) $ServoPosition = GetServo(D0) If($CameraIsTracking = 1) Say(Detection) If($CameraIsTracking = 1) GoTo(Center) ServoUp(D0,10) #incriment camera servo position sleep(5000) If(GetServo(D0)>98) GoTo(Initialize) GoTo(Scan)
:Center #If Centered then Track, Else Center
Say(Centering)
$ServoPosition = GetServo(D0)
If($CameraIsTracking = 0)
GoTo(Scan)
If(GetServo(D0),60)
Say(Drive Right)
Right(66,200)
If(getServo(D0)40)
$Centered = 1
Say(Centered)
GoTo(Track)
GoTo(Center)
:Track #If truck is centered and glyph detected the track Say(Tracking) If($CameraIsTracking = 0) GoTo(Scan) If($Centered = 0) GoTo(Center) ControlCommand("Camera",CameraServoTrackRelativeEnable)
I'm by no way an expert as I also am starting to write simple code. However I think I see one possible problem. Try placing a space between: , and CameraServo
What you have now: ControlCommand("Camera",CameraServoTrackRelativeEnable) Try this: ControlCommand("Camera", CameraServoTrackRelativeEnable)
Hope this helps. I know how frustrating this stuff can be. I spent all weekend trying to work out a coding problem. Still don't have it right.
Dave Schulpius
Relative servo Tracking is part of the "Servo Tracking" section within the camera Configuration section. The "Movement Tracking" options are to the right of that.
Relative servo Tracking assumes the camera is mounted stationary on your robot. The servos are then moved into a position that is relative to the location of the detected object.
Here are two videos that may help you understand how Relative servo tracking behaves...
In this video, the two servos of the robot are are configured to point at the detected object.
In this video, the two servos of the robot's eyes are configured to look toward the direction of the detected object.
To enable movement tracking, and have your robot drive by detected objects - use the options in the Configuration menu that are to the right of the "Servo Tracking". You are looking for "Movement Tracking" section