/// <summary> /// Shuts down the communicator and unsubscribes from channels, whatnot /// </summary> public void Shutdown() { try { if (vehicleStateChannel != null) { // unsubscribe from channels vehicleStateChannel.Unsubscribe(vehicleStateChannelToken); observedObstacleChannel.Unsubscribe(observedObstacleChannelToken); observedVehicleChannel.Unsubscribe(observedVehicleChannelToken); vehicleSpeedChannel.Unsubscribe(vehicleSpeedChannelToken); arbiterOutputChannel.Unsubscribe(arbiterOutputChannelToken); arbiterInformationChannel.Unsubscribe(arbiterInformationChannelToken); sideObstacleChannel.Unsubscribe(sideObstacleChannelToken); this.arbiterRemote = null; this.operationalFacade = null; // notify RemoraOutput.WriteLine("Unsubscribed from channels", OutputType.Remora); } } catch (Exception e) { // notify RemoraOutput.WriteLine("Error in shutting down registered channels", OutputType.Remora); Console.WriteLine(e.ToString()); } }
public void ResgisterWithClient() { try { // get vehicle state channel vehicleStateChannel = channelFactory.GetChannel("ArbiterSceneEstimatorPositionChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); vehicleStateChannelToken = vehicleStateChannel.Subscribe(messagingListener); // get observed obstacle channel observedObstacleChannel = channelFactory.GetChannel("ObservedObstacleChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); observedObstacleChannelToken = observedObstacleChannel.Subscribe(messagingListener); // get observed vehicle channel observedVehicleChannel = channelFactory.GetChannel("ObservedVehicleChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); observedVehicleChannelToken = observedVehicleChannel.Subscribe(messagingListener); // get vehicle speed channel vehicleSpeedChannel = channelFactory.GetChannel("VehicleSpeedChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); vehicleSpeedChannelToken = vehicleSpeedChannel.Subscribe(messagingListener); // get output channel arbiterOutputChannel = channelFactory.GetChannel("ArbiterOutputChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); arbiterOutputChannelToken = arbiterOutputChannel.Subscribe(messagingListener); // get information channel arbiterInformationChannel = channelFactory.GetChannel("ArbiterInformationChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); arbiterInformationChannelToken = arbiterInformationChannel.Subscribe(messagingListener); // get side obstacle channel sideObstacleChannel = channelFactory.GetChannel("SideObstacleChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); sideObstacleChannelToken = sideObstacleChannel.Subscribe(messagingListener); // get ai this.arbiterRemote = (ArbiterAdvancedRemote)objectDirectory.Resolve("ArbiterAdvancedRemote" + this.RemotingSuffix); // get the operational layer this.operationalFacade = (OperationalFacade)objectDirectory.Resolve("OperationalService" + this.RemotingSuffix); // register RemoraOutput.WriteLine("Resgistered To Client with suffix: " + this.RemotingSuffix, OutputType.Remora); } catch (Exception e) { RemoraOutput.WriteLine("Error registering with client: " + e.ToString(), OutputType.Remora); } }
private static void HandleResetStage2(bool initialize) { // if we're initializing, send the stop to both the scene estimator and local map // wait until we have confirmation that they're stopped, then restart them // wait until we get data // restart AI if (initialize) { forceTimeout = true; watchdogResetComplete = false; stage2Timer = null; watchdogResetEvent.Set(); OperationalTrace.WriteWarning("signaling restart to sensor fusion"); } else if (watchdogResetComplete) { stage2Timer = Stopwatch.StartNew(); watchdogResetComplete = false; OperationalTrace.WriteWarning("sensor fusion restart complete"); } else if (stage2Timer != null && stage2Timer.Elapsed > TimeSpan.FromSeconds(10)) { // possibly could wait until we have data to do this, but whatever OperationalTrace.WriteWarning("resetting arbiter"); // time to reset the AI stage2Timer.Reset(); try { ArbiterAdvancedRemote remote = GetRemote(); if (remote != null) { remote.Reset(); OperationalTrace.WriteWarning("arbiter reset complete"); } } catch (Exception ex) { OperationalTrace.WriteError("Error resetting AI in stage 2: {0}", ex); } } }