Asked — Edited

Non Ms Developer Studio C# App For Wireless Camera? Yes/No Question

Hi,

My main question is: Can the EZ builder embedded C# script read camera data from the wireless camera I purchased?

If so, I'll give my left little finger to anyone who can provide me with a sample C# script that does not require MS developer studio or any other complex program beyond the ARC scripting languages that does the equivalent of the C# "Tutorial 18 - Follow Motion" script.

I'm trying to give my bot video feedback for my 6 axis robotic arm mounted to the tank chassis to enable it to search for and fetch a tossed object.

I've spent about a month now reading through every post, tutorial, and readme file in the C# SDK and can't find a way to read camera data from the C# script language. The learning curve and expense in MS Developer Studio looks like it would require a career change to write a hello world script.

Here's the follow motion script from the tutorial:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EZ_B;

namespace Tutorial_11___Follow_Red_Object {

  public partial class Form1 : Form {

    EZCommunicator _ezb = new EZCommunicator();

    public Form1() {

      InitializeComponent();

      comboBox1.Items.Clear();
      foreach (DirectX.Capture.VideoCaptureDevice videoCaptureDevice in _ezb.Camera.GetVideoCaptureDeviceList())
        comboBox1.Items.Add(videoCaptureDevice.Name);

      comboBox2.Items.Clear();
      comboBox2.Items.AddRange(_ezb.GetAvailableCommunicationPorts().ToArray());

      comboBox3.Items.Clear();
      foreach (Camera.ColorEnum item in Enum.GetValues(typeof(Camera.ColorEnum)))
        comboBox3.Items.Add(item);

      comboBox3.SelectedIndex = 0;

      timer1.Interval = 200;
      timer1.Enabled = true;
    }

    private void button1_Click(object sender, EventArgs e) {

      if (_ezb.IsConnected) {

        _ezb.Disconnect();
      } else {

        if (comboBox2.SelectedItem == null)
          _ezb.AutoConnect();
        else
          _ezb.Connect(comboBox2.SelectedItem.ToString());
      }

      if (_ezb.IsConnected) {

        button1.Text = "Disconnect";

        _ezb.Servo.SetServoPosition(Servo.ServoPortEnum.RB3, Servo.SERVO_CENTER);
      } else {

        button1.Text = "Connect";
      }
    }

    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) {

      string videoCaptureDeviceName = comboBox1.SelectedItem.ToString();

      _ezb.Camera.StartCamera(_ezb.Camera.GetVideoCaptureDevicebyName(videoCaptureDeviceName), panel1, panel2);
    }

    private void button2_Click(object sender, EventArgs e) {

      _ezb.ShowDebugWindow();
    }

    private void Form1_FormClosing(object sender, FormClosingEventArgs e) {

      if (_ezb.IsConnected)
        _ezb.Servo.ReleaseAllServos();

      _ezb.Camera.StopCamera();
    }

    private void timer1_Tick(object sender, EventArgs e) {

      if (!_ezb.Camera.IsActive)
        return;

      Camera.ColorEnum color          = (Camera.ColorEnum)comboBox3.SelectedItem;
      ObjectLocation   objectLocation = _ezb.Camera.GetObjectLocation(
                                          color, 
                                          Camera.SearchObjectSize.Med, 
                                          (byte)trackBar1.Value);

      if (!objectLocation.isFound)
        return;

      if (_ezb.IsConnected) {

        int position = _ezb.Servo.GetServoPosition(Servo.ServoPortEnum.RB3);

        if (objectLocation.horizontalLocation == ObjectLocation.HorizontalLocationEnum.Left)
          position++;
        else if (objectLocation.horizontalLocation == ObjectLocation.HorizontalLocationEnum.Right)
          position--;

        _ezb.Servo.SetServoPosition(Servo.ServoPortEnum.RB3, position);
      }

      string logMsg = string.Format("Object found at {0} {1} ({2}x{3})", 
        objectLocation.horizontalLocation, 
        objectLocation.verticalLocation, 
        objectLocation.FoundX, 
        objectLocation.FoundY);

      tbLog.AppendText(logMsg);
      tbLog.AppendText(Environment.NewLine);
    }
  }
}      



ARC Pro

Upgrade to ARC Pro

Discover the limitless potential of robot programming with Synthiam ARC Pro – where innovation and creativity meet seamlessly.

#1  

I totally understand what you are saying. Microsoft Visual Studio and Robotics Studio automatically assume that you want to spend the rest of your life learning their systems.

That is the whole point and Essence of the EZ-Robot system. While D.J. has written two or three probably 35,000 line sets of code with a total of over 100,000 lines of code (guessing), just so we don't have to, we only do minor stuff to have it finished. God Bless D.J. !

I am sure he will give you an answer soon.

But, I have been there, especially BEFORE EZ-Robot. I know your frustration.

Hang in there!

;)

#3  

Thanks for the CameraCenterX and ...Y DJ. That takes care of that!