rparak / Unity3D_Robotics_UR

A digital-twin of the Universal Robots UR3 integrated into the Unity3D development platform.
MIT License
142 stars 50 forks source link

connecting to two different IP (2 UR Robots) #4

Open CheAbdullah opened 1 year ago

CheAbdullah commented 1 year ago

Hi Roman Parak,

I am tring to connect to two different UR16 - on two different IPs if I use the same ur_data_processing(https://github.com/rparak/Unity3D_Robotics_UR/blob/main/Universal_Robots_Unity_App/Assets/Scripts/UR3/ur_data_processing.cs) then, the unity arm A will follow the actual Robot Arm A, but Unity Arm B will do the same as well, before it goes to the actual Robot Arm B's pose. And, this repeats over time, sometimes A copy B, and sometime B copy A.

How do I make sure that unity amr A copy actual Robot Arm A only, and the same for Arm B?

Thanks, Kind regards, Zul

CheAbdullah commented 1 year ago

IEnumerator set_FlipflopSwitch2(int which) { yield return new WaitForSeconds(delay);// (0.05f); if (which == 1) { LeftRobot.GetComponent().enabled = true; RightRobot.GetComponent().enabled = false;

        LeftRobot.GetComponent<ur_data_processing>().main_ur_state = 1;
        LeftRobot.GetComponent<ur_data_processing>().connectionStatus = true;

        RightRobot.GetComponent<ur_data_processing>().main_ur_state = 0; // go to disconnect state
        RightRobot.GetComponent<ur_data_processing>().connectionStatus = false;
    }
CheAbdullah commented 1 year ago

at the moment, I am just switching on and off the state for Arm A and Arm B. and, this results with A copying B, and A goes to the right pose for A, and then copy B again, afterwards.

rparak commented 1 year ago

Hi Zul,

sorry for the late response, but I'm really busy.

The problem is that the program "ur_data_processing.cs" contains global variables for control, data collection and also for user interface control.

My advice is that you need to create another global variable to control and collect data from robot 2. It is also necessary to change the programs for collecting data from the robot joints "ur3_link{1 .. 6}.cs". Because inside the programs there is a global variable from "ur_data_processing.cs".

I'm working on a new update so I'll probably add a feature to connect multiple robots at the same time.

Thank you for your feedback. I hope everything is clear, if not, please email me again.

Best regards, Roman Parak