Asked — Edited

Vr Options?

Does anyone know if the SDK of the Oculus Rift package would work with EZB if there was a plug in developed for it? It doesn't really need to be something as big and bulky as that. Very unfortunate that Vuzix is no longer offering support with EZB. That would work great.

Like the Vuzix, I'd like to pull from the IMU data to move servos and transfer the camera feed from the EZ camera to the goggles over two complete separate computers in different places.

Any ideas or suggestions on how to POC this, would be grateful.


ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.

PRO
Canada
#153  

Love it, very cool.

#154  

So I corrected the scripts, and this is the WIP for Virtual JD back for more progress to come! I set up one arm, so the rotations will be send to ARC, the gripper will have to have its own controls in the future! I realized the JD was setup a bit strange...all rotations should range from -90/90 within BioIK, which I corrected, but this made the IK act a bit strange! So I guess we will have to set it up again. I just thought I will upload the scene once more so the new scripts are included and anyone can try to get stuff working out correctly!

I experienced dropouts from the Wifi with my EZ-B IoTiny, but I am not sure if this is due to server flooding or just a bad Wifi channel...I havent had this issue before, so please confirm if this is a general issue!

I am having no issues on my robot being controlled with another server/board so please let me know about any issues so we can resolve this!:)

Unity is great and the Virtual JD will be a huge benefit for ARC! Lets keep on exploring what it can do for us...:)

If you experience any difficulties setting up Unity in tandem with ARC, please let me know!

https://we.tl/Wznfe7QDWz

#155  

I did some further checking and I guess it is not a Wifi related problem...as soon as I am sending more than one value over to ARC, the board drops out! So I guess since it is working good with the sliders, it must be an issue with flooding... I set the scripts in a way that values are only being send if there is a value change, so I would need to know how to correctly send them without the EZ-B dropping out!

If there is anyone here that could help, I guess we can go on...otherwise we are stuck!

My other robot is connected via Ethernet and runs a local REST server, this scenario works flawless...so I guess we will just have to find a way to sent the data correctly, without the EZ-B or the ARCs server dropping out!:)

#156  

This is the code I am using to send the values over to the ARCs HTTP server...

using System.Collections;
using UnityEngine;
using UnityEngine.Networking;

namespace BioIK
{
    public class RotNew : MonoBehaviour
    {

        public float Value = 0f;
        public int position;
        public bool Changed = true;

        IEnumerator GetText()
        {
            while (true)
            {
                if (Changed)
                {
                    var request = (string.Format("http://192.168.178.20/Exec?password=admin&script=Servo(D{0},{1})", name, position + 90));
                    print(request);
                    UnityWebRequest www = UnityWebRequest.Get(request);
                    yield return www.SendWebRequest();
                    if (www.isNetworkError || www.isHttpError)
                    {
                        Debug.Log(www.error);
                    }
                    else
                    {
                        // Show results as text
                        Debug.Log(www.downloadHandler.text);

                        // Or retrieve results as binary data
                        byte[] results = www.downloadHandler.data;
                    }

                    Changed = false;


                }
                yield return 0;
            }
        }

        void Start()
        {
            StartCoroutine(GetText());
        }

        void Update()
        {
            BioJoint joint = this.GetComponent<BioJoint>();
            double value = joint.Y.GetTargetValue();
            position = Mathf.RoundToInt((float)value);

            if (Value != position)
            {
                Value = position;
                Changed = true;
            }
        }
    }
}
#157  

I even tried to use really long delay between sending those values...and did not get it to work, I hope somebody out there has an idea how to fix this! confused

PRO
USA
#158  

@mickey, do you have any of your EZBs set up with the usb/serial direct connection? You could try that, and if it works maybe you are getting buffer overflow on wifi?

#159  

I have never known about a connection like that...I only connected my EZ-B using Wifi! But if you have this connection available please check if the scene works for you!

PRO
USA
#160  

@Mickey666Maus:

  1. Download EZB Mono SDK, extract the EZ_B.dll and add to the Project assets.

  2. Replace your RotNew class (post #157) with this code:


namespace BioIK
{
    using System;
    using EZ_B;
    using UnityEngine;

    public class RotNew : MonoBehaviour
    {
        public void Start()
        {
            EZBController.Instance.Connect("192.168.1.1" );
        }

        public void OnApplicationQuit()
        {
            EZBController.Instance.Disconnect();
        }

        public void Update()
        {
            BioJoint joint = this.GetComponent<BioJoint>();
            var value = joint.Y.GetTargetValue();
            var position = Mathf.RoundToInt((float)value);

            if (value == position)
            {
                return;
            }

            EZBController.Instance.SetServo(this.name, position + 90 );
        }

        private class EZBController
        {
            private EZB ezb;
            private object lockObject = new object();

            private EZBController()
            {
                this.ezb = new EZB("MyEzb" );
                this.ezb.OnConnectionChange += this.EzbOnConnectionChange;
            }

            public static EZBController Instance
            {
                get { return Creator.Singleton; }
            }

            public void Connect(string hostname)
            {
                lock (this.lockObject)
                {
                    if (!this.ezb.IsConnected)
                    {
                        Debug.Log("Connecting to EZB hostname:" + hostname);
                        this.ezb.Connect(hostname);
                    }
                }
            }

            public void Disconnect()
            {
                lock (this.lockObject)
                {
                    if (this.ezb.IsConnected)
                    {
                        this.ezb.Disconnect();
                    }
                }
            }

            public void SetServo(string port, int position)
            {
                if (!this.ezb.IsConnected)
                {
                    Debug.LogWarning("EZB is not connected, SetServo will be ignored");
                    return;
                }

                try
                {
                    var servoPort = (Servo.ServoPortEnum)Enum.Parse(typeof(Servo.ServoPortEnum), "D" + port);
                    this.ezb.Servo.SetServoPosition(servoPort, position);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
            private void EzbOnConnectionChange(bool isConnected)
            {
                Debug.Log("EZB connection changed to: " + (isConnected ? "Connected" : "Disconnect"));
            }

            private sealed class Creator
            {
                private static readonly EZBController instance = new EZBController();

                internal static EZBController Singleton
                {
                    get { return instance; }
                }
            }
        }
    }
}

Note1: Check the EZB address and correct if necessary

Good Luck !