private void StartSimulation()
{
VREPWrapper.simxGetObjectHandle(_clientId, R.WheelLeft0, out _handleLeftMotor, simx_opmode.oneshot_wait);
VREPWrapper.simxGetObjectHandle(_clientId, R.WheelRight0, out _handleRightMotor, simx_opmode.oneshot_wait);
VREPWrapper.simxGetObjectHandle(_clientId, R.SICKS300, out _handleSick, simx_opmode.oneshot_wait);
VREPWrapper.simxGetObjectHandle(_clientId, R.Origo, out _handleRelative, simx_opmode.oneshot_wait);
Debug.WriteLine("Handle left motor: " + _handleLeftMotor);
Debug.WriteLine("Handle right motor: " + _handleRightMotor);
Debug.WriteLine("Handle laser scanner: " + _handleSick);
Localization.ClientId = _clientId;
Localization.HandleSick = _handleSick;
Localization.HandleRelative = _handleRelative;
MapBuilder.RequestLaserScannerDataRefresh += RequestLaserScannerDataRefresh;
MapBuilder.CalculatePose += CalculatePose;
_mapBuilderThread = new Thread(MapBuilder.BuildLayers);
try
{
_mapBuilderThread.Start();
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
VREPWrapper.simxStartSimulation(_clientId, simx_opmode.oneshot_wait);
SimulationIsRunning = true;
}