public void init() { if (main.Enable) { print("go"); if (useEthernetTypeURG) { urg = new EthernetURG(ipAddress, portNumber); } else { urg = new SerialURG(portName, baudRate); } urg.StepCount360 = _stepCount; urg.Open(); urgStartStep = _startstep; urgEndStep = _endstep; distances = new long[urgEndStep - urgStartStep + 1]; meshFilter = GetComponent <MeshFilter>(); meshRenderer = GetComponent <MeshRenderer>(); mesh = new Mesh(); urgMesh = new UrgMesh(); DetectedObstacles = new Vector4[urgEndStep - urgStartStep + 1]; ScriptStart = true; } }
// Use this for initialization void Start() { if (useEthernetTypeURG) { urg = new EthernetURG(ipAddress, portNumber); } else { urg = new SerialURG(portName, baudRate); } urg.Open(); urgStartStep = urg.StartStep; urgEndStep = urg.EndStep; distances = new long[urgEndStep - urgStartStep + 1]; meshFilter = GetComponent <MeshFilter>(); meshRenderer = GetComponent <MeshRenderer>(); mesh = new Mesh(); urgMesh = new UrgMesh(); DetectedObstacles = new Vector4[urgEndStep - urgStartStep + 1]; }