Your comments
cycle problem only appear during video recoding of screen. I use https://github.com/ImtsSrl/KUKAVARPROXY (https://robodk.com/doc/en/RoboDK-Doc-EN-Robots-KUKA.pdf) on office lite VKRC. And from Unity side Python integration https://github.com/linuxsand/py_openshowvar and IronPython . May be possible to get some discount for Professional version?
this is C# code
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
using Sharp7;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using IronPython.Hosting;
using System.Globalization;
using System.Text;
namespace game4automation
{
public class Kuka_var : InterfaceThreadedBaseClass
{
[ReadOnly] public string notifybar;
[ReadOnly] public string txtJoints;
public Drive Axis1;
public Drive Axis2;
public Drive Axis3;
public Drive Axis4;
public Drive Axis5;
public Drive Axis6;
private dynamic Kuka;
public string Values_2_String(double[] dvalues)
{
if (dvalues == null || dvalues.Length < 1)
{
return "Invalid values";
}
// Not supported on .NET Framework 2.0:
//string strvalues = String.Join(" , ", dvalues.Select(p => p.ToString("0.0")).ToArray());
string strvalues = dvalues[0].ToString();
for (int i = 1; i < dvalues.Length; i++)
{
strvalues += " , " + dvalues[i].ToString();
}
return strvalues;
//return "";
}
public double[] String_2_Values(string ACT_MES)
{
char[] delimiterChars = {':', ' ', ',', ' ', ',', ' ', ',', ' ', ',', ' ', ',', ' ', ',', ' ', ',', ',', ',', ',', ',','}'};
string[] words = ACT_MES.Split(delimiterChars);
double[] joints = new double[12];
for (int i = 1; i < 6; i++)
{
joints[i] = 0;
}
NumberFormatInfo provider = new NumberFormatInfo();
provider.NumberDecimalSeparator = ".";
provider.NumberGroupSeparator = ",";
joints[0] = Convert.ToDouble(words[3],provider);
joints[1] = Convert.ToDouble(words[6], provider);
joints[2] = Convert.ToDouble(words[9], provider);
joints[3] = Convert.ToDouble(words[12], provider);
joints[4] = Convert.ToDouble(words[15], provider);
joints[5] = Convert.ToDouble(words[18], provider);
return joints;
//return "";
}
public bool Check_ROBOT(bool ignore_busy_status = false)
{
return Kuka.CheckConnect();
}
//! Updates all signals in the parallel communication thread
protected override void CommunicationThreadUpdate()
{
double[] joints = new double[12];
if (!Check_ROBOT(true)) { return; }
joints = String_2_Values(Kuka.GetActPos());
Axis1.CurrentPosition = (float)joints[0];
Axis2.CurrentPosition = (float)joints[1] + 90;
Axis3.CurrentPosition = (float)joints[2] - 90;
Axis4.CurrentPosition = (float)joints[3];
Axis5.CurrentPosition = (float)joints[4];
Axis6.CurrentPosition = (float)joints[5];
string strjoints = Values_2_String(joints);
txtJoints = strjoints;
}
public override void OpenInterface()
{
var engine = Python.CreateEngine();
ICollection searchPaths = engine.GetSearchPaths();
//Path to the folder of greeter.py
searchPaths.Add(@"D:\Users\Dmitriy_Murashov\Conv1\Assets");
//Path to the Python standard library
searchPaths.Add(@"D:\Users\Dmitriy_Murashov\Conv1\Assets\Plugins\Lib\");
engine.SetSearchPaths(searchPaths);
dynamic py = engine.ExecuteFile(@"D:\Users\Dmitriy_Murashov\Conv1\Assets\kuka.py");
Kuka = py.Kuka();
Kuka.Connect();
base.OpenInterface();
}
public override void CloseInterface()
{
Kuka.DisConnect();
base.CloseInterface();
}
private void FixedUpdate()
{
}
private void Update()
{
}
}
}
and python code
from py_openshowvar import openshowvar
class Kuka():
def __init__(self):
return 1
def Connect(self):
self.client = openshowvar('192.168.216.128', 7000)
return self.client.can_connect
def GetActPos(self):
return self.client.read('$AXIS_ACT_MEAS', debug=False)
def DisConnect(self):
self.client.close()
def CheckConnect(self):
return self.client.can_connect
def __del__(self):
self.client.close()
Thanks, will wait new release.
i just add Cube on Carton object ,
And add script OnTrigPlatform with hardcode collisions on it.
Here is source code for script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class OnTrigPlatform : MonoBehaviour
{
public GameObject StandardParent;
#region Private Variables
private MeshRenderer _meshrenderer;
private Rigidbody _rigidbody;
private Collider _collider;
private bool _isMeshrendererNotNull;
private Transform _parent;
private int loaded;
private Vector3 _distancepos;
private Quaternion _distancerot;
#endregion
#region Private Methods
#endregion
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter(Collider other)
{
Transform a;
string Name = other.gameObject.name;
if (Name == "conv" && loaded == 1)
{
//this.gameObject.transform.parent.gameObject.transform.parent = StandardParent.transform;
this.gameObject.transform.parent.gameObject.transform.parent = StandardParent.transform;
this.gameObject.transform.parent.gameObject.GetComponent().isKinematic = false;
this.gameObject.transform.parent.gameObject.GetComponent().useGravity = true;
//this.gameObject.transform.parent.gameObject.GetComponent().WakeUp();
//this.gameObject.transform.parent = StandardParent.transform;
//this.gameObject.transform.parent.gameObject.GetComponent().isKinematic = false;
loaded = 0;
}
if (Name == "Fork_001(Clone)" && loaded == 0)
{
//StandardParent = this.gameObject.transform.parent.gameObject;
//other.gameObject.transform.parent = this.gameObject.transform;
this.gameObject.transform.parent.gameObject.transform.parent = other.gameObject.transform;
this.gameObject.transform.parent.gameObject.GetComponent().isKinematic = true;
this.gameObject.transform.parent.gameObject.GetComponent().useGravity = false;
//StandardParent = this.gameObject.transform.parent.gameObject;
StandardParent = other.gameObject.transform.root.gameObject;
loaded = 1;
}
}
private void OnTriggerExit(Collider other)
{
string Name = other.gameObject.name;
if (Name == "Fork_001(Clone)" && loaded == 1)
{
// loaded = 0;
}
}
}
Not findeout better solution. But good enougth for tests
Customer support service by UserEcho
yes Voucherwill be greate, for sure i will give you a positiove rating.