/// <summary> /// IF the instance has allready been created, the instance created before will be given back, when calling this method. Ohterwise a new instance will be given back /// </summary> /// <param name="dhparam"></param> /// <returns></returns> public static InverseKinematics Instantiate(DHParameter dhparam, ActualPosition _ActualPosition) //static variables are shared between all class instances. { if (instance == null) //Prevents of Locking if the instance allready has been created. IF the instance has allready been created, this instance created before will be given back, when calling this method { lock (LockObj) //no new instance can be createt from any thread as long as the first one onlocks the object { if (instance == null) { instance = new InverseKinematics(dhparam, _ActualPosition); } } } return(instance); }
/// <summary> /// IF the instance has allready been created, the instance created before will be given back, when calling this method. Ohterwise a new instance will be given back /// </summary> /// <param name="dhparam"></param> /// <returns></returns> public static KinematicControl Instantiate(DHParameter dhparam, ActualPosition _ActualPosition) { if (instance == null) //Prevents of Locking if the instance allready has been created { lock (LockObj) //no new instance can be createt from any thread as long as the first one onlocks the object { if (instance == null) { instance = new KinematicControl(dhparam, _ActualPosition); } } } return(instance); }
/// <summary> /// IF the instance has allready been created, the instance created before will be given back, when calling this method. Ohterwise a new instance will be given back /// </summary> /// <param name="dhparam"></param> /// <returns></returns> public static ForewardKinematics Instantiate(DHParameter dhparam) //static variables are shared between all class instances. { if (instance == null) //Prevents of Locking if the instance allready has been created { lock (LockObj) //no new instance can be createt from any thread as long as the first one onlocks the object { if (instance == null) { instance = new ForewardKinematics(dhparam); } } } return(instance);// when using this methode, allways the same and only instance will be returned }
private static object LockObj = new Object(); //this object can only be used from one Thread at the same time (UI-Thread OR Backgroundthread, but not both at a time, can use the same Instance of this Class) //Note that instead of locking on typeof(Singleton) as some versions of this implementation do, //Lock on the value of a static variable which is private to the class. Locking on objects //which other classes can access and lock on (such as the type of this Class) risks performance issues //and even deadlocks. Wherever possible, only lock on objects specifically created for the purpose of locking, or which document that they are //to be locked on for specific purposes (e.g. for waiting/pulsing a queue). //Usually such objects should be private to the class they are used in. //This helps to make writing thread-safe applications significantly easier. ///////////////////////////////DHParam belegung //int d1 = 0; //double d2 = 0; //double d3 = 0; //int d4 = 23; //double d5 = 0; //int d6 = 10; //double a1 = 0; //int a2 = 25; //int a3 = 0; //double a4 = 0; //int a5 = 0; //double a6 = 0; //double alpha1 = -Math.PI / 2; //double alpha2 = 0; //double alpha3 = Math.PI / 2; //double alpha4 = -Math.PI / 2; //double alpha5 = Math.PI / 2; //double alpha6 = 0; private InverseKinematics(DHParameter dhparam, ActualPosition _ActualPosition) : base(dhparam) { this.ActualPosition = _ActualPosition; }
private KinematicControl(DHParameter dhparam, ActualPosition _ActualPosition) { forewardkinematics = ForewardKinematics.Instantiate(dhparam); inversekinematics = InverseKinematics.Instantiate(dhparam, _ActualPosition); }
public KinematicBase(DHParameter dhparam) { this.DHParam = dhparam; }
private ForewardKinematics(DHParameter dhparam) : base(dhparam) { }
public InverseKinematicsForNC(DHParameter dhparam) : base(dhparam) { }