
sgodbole

I am trying to create an application that will track a green tennis ball but I am having problems with finding the location the ball. Here's the code that I think is incorrect, how can I change it find the location of the ball?
Thank you!
private void timer_Tick(object sender, EventArgs e)
{
camera = new Camera(ezB_Connect1.EZB);
ezB_Connect1.EZB.Movement.MovementType = EZ_B.Movement.MovementTypeEnum.ARDrone;
ObjectLocation objectLocation = camera.CameraBasicColorDetection.GetObjectLocationByColor(true, ColorDetection.ColorEnum.Green, 10, 100);
//camera.UpdatePreview();
if (!objectLocation.isFound)
tbLog.Text = "found not object";
if (objectLocation.horizontalLocation == ObjectLocation.HorizontalLocationEnum.Left)
ezB_Connect1.EZB.Movement.GoLeft();
else if (objectLocation.horizontalLocation == ObjectLocation.HorizontalLocationEnum.Right)
ezB_Connect1.EZB.Movement.GoRight();
else if (objectLocation.horizontalLocation == ObjectLocation.HorizontalLocationEnum.Middle)
ezB_Connect1.EZB.Movement.GoForward();
}
1) All detection needs to be done in the OnNewFrame event. For example, take a look at the code for Tutorial 11
2) Only set the MovementType once. Set it in the Form Load event
Code:
Code:
Also, I am not able to use
with AR Drone. My Visual Studio would not find the method. The only method that would work wasCode:
and this method would not work when dealing with following colored objects.Code:
I believe this is not the current firmware. Do I need to upgrade to the latest firmware version for the SDK to work?
You should be aware that with the latest firmware, the Drone can connect to an infrastructure network and no longer needs to create its own ad-hoc network, so being able to specify the IP address of the drone to the EZ-B controls would be a great addition (as well as the long awaited support for the V2 camera).
Alan