public void test() { var mp = new MsgProcessor(); mp.AddHandler <HandlerA>(new HandlerA()); mp.AddHandler <HandlerB>(new HandlerB()); mp.AddHandler <HandlerC>(new HandlerC()); mp.ProcessMessage(new A()); mp.ProcessMessage(new B()); mp.ProcessMessage(new C()); }
static void Main(string[] args) { /// Enregistrement de la license SciChart en début de code SciChartSurface.SetRuntimeLicenseKey("RJWA77RbaJDdCRJpg4Iunl5Or6/FPX1xT+Gzu495Eaa0ZahxWi3jkNFDjUb/w70cHXyv7viRTjiNRrYqnqGA+Dc/yzIIzTJlf1s4DJvmQc8TCSrH7MBeQ2ON5lMs/vO0p6rBlkaG+wwnJk7cp4PbOKCfEQ4NsMb8cT9nckfdcWmaKdOQNhHsrw+y1oMR7rIH+rGes0jGGttRDhTOBxwUJK2rBA9Z9PDz2pGOkPjy9fwQ4YY2V4WPeeqM+6eYxnDZ068mnSCPbEnBxpwAldwXTyeWdXv8sn3Dikkwt3yqphQxvs0h6a8Dd6K/9UYni3o8pRkTed6SWodQwICcewfHTyGKQowz3afARj07et2h+becxowq3cRHL+76RyukbIXMfAqLYoT2UzDJNsZqcPPq/kxeXujuhT4SrNF3444MU1GaZZ205KYEMFlz7x/aEnjM6p3BuM6ZuO3Fjf0A0Ki/NBfS6n20E07CTGRtI6AsM2m59orPpI8+24GFlJ9xGTjoRA=="); /// Initialisation des modules utilisés dans le robot int robotId = 10; /// Ne pas changer cette variable ! int teamId = 0; /// Ne pas changer cette variable ! usbDriver = new USBVendor(); msgDecoder = new MsgDecoder(); msgEncoder = new MsgEncoder(); robotMsgGenerator = new MsgGenerator(); robotMsgProcessor = new MsgProcessor(robotId, competition); xBoxManette = new XBoxControllerNS.XBoxController(robotId); strategyManager = new StrategyEurobot(robotId, teamId, "224.16.32.79"); localWorldMapManager = new LocalWorldMapManager(robotId, teamId, bypassMulticast: false); positioning2Wheels = new Positioning2Wheels(robotId); trajectoryGenerator = new TrajectoryGeneratorNonHolonome(robotId); /// Création des liens entre module, sauf depuis et vers l'interface graphique usbDriver.OnUSBDataReceivedEvent += msgDecoder.DecodeMsgReceived; // Transmission des messages reçus par l'USB au Message Decoder msgDecoder.OnMessageDecodedEvent += robotMsgProcessor.ProcessRobotDecodedMessage; // Transmission les messages décodés par le Message Decoder au Message Processor //Events d'activation et configuration de l'asservissement en vitesse depuis le Strategy Manager strategyManager.On2WheelsToPolarMatrixSetupEvent += robotMsgGenerator.GenerateMessage2WheelsToPolarMatrixSet; //Transmission des messages de set-up de la matrice de transformation moteurindepeandt -> polaire en embarqué strategyManager.On2WheelsAngleSetupEvent += robotMsgGenerator.GenerateMessage2WheelsAngleSet; //Transmission des messages de set-up de la config angulaire des roues en embarqué strategyManager.OnOdometryPointToMeterSetupEvent += robotMsgGenerator.GenerateMessageOdometryPointToMeter; //Transmission des messages de set-up du coeff pointToMeter en embarqué strategyManager.On2WheelsIndependantSpeedPIDSetupEvent += robotMsgGenerator.GenerateMessage2WheelsIndependantSpeedPIDSetup; //Setup du PID independant strategyManager.OnSetAsservissementModeEvent += robotMsgGenerator.GenerateMessageSetAsservissementMode; robotMsgGenerator.OnMessageToRobotGeneratedEvent += msgEncoder.EncodeMessageToRobot; // Envoi des messages du générateur de message à l'encoder msgEncoder.OnMessageEncodedEvent += usbDriver.SendUSBMessage; // Envoi des messages en USB depuis le message encoder robotMsgProcessor.OnPolarOdometrySpeedFromRobotEvent += positioning2Wheels.OnOdometryRobotSpeedReceived; //Envoi des vitesses reçues de l'embarqué au module de calcul de positionnement positioning2Wheels.OnCalculatedLocationEvent += trajectoryGenerator.OnPhysicalPositionReceived; //Envoi du positionnement calculé au module de génération de trajectoire trajectoryGenerator.OnGhostLocationEvent += localWorldMapManager.OnGhostLocationReceived; trajectoryGenerator.OnSpeedConsigneEvent += robotMsgGenerator.GenerateMessageSetSpeedConsigneToRobot; //Transmission des commande de vitesse aux moteurs de déplacement strategyManager.OnSetSpeedConsigneToMotorEvent += robotMsgGenerator.GenerateMessageSetSpeedConsigneToMotor; //Transmission des commande de vitesse (aux moteurs annexes) positioning2Wheels.OnCalculatedLocationEvent += localWorldMapManager.OnPhysicalPositionReceived; strategyManager.InitStrategy(); //à faire après avoir abonné les events ! StartRobotInterface(); while (!exitSystem) { Thread.Sleep(500); } }
static void Main(string[] args) { /// We add an event handler to detect the closing of the application _handler += new EventHandler(Handler); SetConsoleCtrlHandler(_handler, true); msgDecoder = new MsgDecoder(); msgEncoder = new MsgEncoder(); msgGenerator = new MsgGenerator(); msgProcessor = new MsgProcessor(); serialPort = new SerialAutoConnect(); /// Creation of links between modules, except from and to the graphical interface Console.WriteLine("[MAIN] Begin Booting Sequence"); /// Creation of link between projects msgDecoder.OnMessageDecodedEvent += msgProcessor.ProcessRobotDecodedMessage; /// Management of messages sent by the robot msgGenerator.OnMessageToRobotGeneratedEvent += msgEncoder.EncodeMessageToRobot; msgEncoder.OnMessageEncodedEvent += serialPort.SendMessageToRobot; /// Management of messages received by the robot serialPort.OnDataReceivedEvent += msgDecoder.DecodeMsgReceived; msgDecoder.OnMessageDecodedEvent += msgProcessor.ProcessRobotDecodedMessage; /// management of messages to be displayed in the console serialPort.OnSerialConnectedEvent += ConsolePrint.OnPrintEvent; RegisterConsolePrintEvents(); /// Launching GUI if (usingRobotInterface) { StartRobotInterface(); } Console.Write("[MAIN] End Booting Sequence"); while (!exitSystem) { Thread.Sleep(500); } }
[STAThread] //à ajouter au projet initial static void Main(string[] args) { SciChartSurface.SetRuntimeLicenseKey(@"<LicenseContract> <Customer>University of Toulon</Customer> <OrderId>EDUCATIONAL-USE-0109</OrderId> <LicenseCount>1</LicenseCount> <IsTrialLicense>false</IsTrialLicense> <SupportExpires>11/04/2019 00:00:00</SupportExpires> <ProductCode>SC-WPF-SDK-PRO-SITE</ProductCode> <KeyCode>lwABAQEAAABZVzOfQ0zVAQEAewBDdXN0b21lcj1Vbml2ZXJzaXR5IG9mICBUb3Vsb247T3JkZXJJZD1FRFVDQVRJT05BTC1VU0UtMDEwOTtTdWJzY3JpcHRpb25WYWxpZFRvPTA0LU5vdi0yMDE5O1Byb2R1Y3RDb2RlPVNDLVdQRi1TREstUFJPLVNJVEWDf0QgB8GnCQXI6yAqNM2njjnGbUt2KsujTDzeE+k69K1XYVF1s1x1Hb/i/E3GHaU=</KeyCode> </LicenseContract>"); serialPort1 = new ReliableSerialPort("COM19", 115200, Parity.None, 8, StopBits.One); msgDecoder = new MsgDecoder(); msgEncoder = new MsgEncoder(); msgGenerator = new MsgGenerator(); msgProcessor = new MsgProcessor(); //Gestion des messages envoyé par le respirateur msgGenerator.OnMessageToRespirateurGeneratedEvent += msgEncoder.EncodeMessageToRespirateur; msgEncoder.OnMessageEncodedEvent += serialPort1.SendMessage; //Gestion des messages reçu par le respirateur serialPort1.OnDataReceivedEvent += msgDecoder.DecodeMsgReceived; msgDecoder.OnMessageDecodedEvent += msgProcessor.ProcessDecodedMessage; StartInterface(); lock (ExitLock) { // Do whatever setup code you need here // once we are done wait System.Threading.Monitor.Wait(ExitLock); } }
public Router(IMsgProcessor msgProcessor, int processorNum = 10) { _lockObj = new object(); if (processorNum <= 0) { processorNum = 10; } _key_processorID = new Dictionary <object, int>(); _processorID_processorObj = new Dictionary <int, MsgProcessor>(); _processorID_HandledKeysCount = new Dictionary <int, int>(); _routerQueue = new CustomizedQueue(); _processors = new List <MsgProcessor>(); _incomingMsgsReader = new Task(() => { RecievingMsgs(); }); _incomingMsgsReader.Start(); for (int i = 0; i < processorNum; i++) { MsgProcessor q = new MsgProcessor((IMsgProcessor)Activator.CreateInstance(msgProcessor.GetType())); _processorID_processorObj.Add(q.ID, q); _processorID_HandledKeysCount.Add(q.ID, 0); _processors.Add(q); } _nextprocessorID = _processors[0].ID; }
internal Client(OrtcClient ortcClient) { context = ortcClient; _gotOnOpenCount = 0; _permissions = new List <KeyValuePair <string, string> >(); _subscribedChannels = new RealtimeDictionary <string, ChannelSubscription>(); _multiPartMessagesBuffer = new RealtimeDictionary <string, RealtimeDictionary <int, BufferedMessage> >(); _heartbeatTimer = new Timer(_heartbeatTimer_Elapsed, context.HeartbeatTime * 1000); _connectionTimer = new Timer(_connectionTimer_Elapsed, Constants.SERVER_HB_COUNT * 1000); _reconnectTimer = new Timer(_reconnectTimer_Elapsed, context.ConnectionTimeout * 1000); _balancer = DependencyService.Get <IBalancer> (); if (_balancer == null) { throw new OrtcGenericException( "DependencyService Failed, please include the platform plugins. This may be caused linker stripping."); } _webSocketConnection = DependencyService.Get <IWebsocketConnection>(); if (_webSocketConnection == null) { throw new OrtcGenericException( "DependencyService Failed, please include the platform plugins. This may be caused linker stripping."); } _webSocketConnection.OnOpened += _webSocketConnection_OnOpened; _webSocketConnection.OnClosed += _webSocketConnection_OnClosed; _webSocketConnection.OnError += _webSocketConnection_OnError; _webSocketConnection.OnMessageReceived += _webSocketConnection_OnMessageReceived; _msgProcessor = new MsgProcessor(this); }
public Router(Type processorTyp, int processorsNum = 10, IEventLogger logger = null) { _lockObj = new object(); _routerQueue = new ProcessQueue(); _logger = logger; if (processorsNum <= 0) { processorsNum = 10; } _key_processorID = new Dictionary <object, int>(); _processorID_processorObj = new Dictionary <int, MsgProcessor>(); _processorID_HandledKeysCount = new Dictionary <int, int>(); _processors = new List <MsgProcessor>(); _incomingMsgsReader = new Task(() => { RecievingMsgs(); }); _incomingMsgsReader.Start(); for (int i = 0; i < processorsNum; i++) { MsgProcessor q = new MsgProcessor((IMsgProcessor)Activator.CreateInstance(processorTyp), logger); _processorID_processorObj.Add(q.ID, q); _processorID_HandledKeysCount.Add(q.ID, 0); _processors.Add(q); } _nextprocessorID = _processors[0].ID; }
/// <summary> /// Метод остановки сервера /// </summary> public static void Stop() { lock (SyncLock) { WriteLog("Stop CometServer:->" + Connections.Count); Connections.ForEach(delegate(CometAsyncState cas) { PushMessage( new CometMessage { Message = "Внимание! Соединение с приложением потеряно. Через 5 сек. соединение будет восстановлено и Вы сможете продолжить работу.", UserName = "", Status = 2, ClientGuid = cas.ClientGuid, Reload = 1 }, cas.ClientGuid); cas.CompleteRequest(); WriteLog("STOP APPLICATION -> " + cas.ClientGuid); }); Connections.Clear(); } MsgProcessor.Stop(); _procesor.Join(); WriteLog("End Stop CometServer"); }
internal Client(OrtcClient ortcClient) { this.context = ortcClient; _isConnecting = false; _alreadyConnectedFirstTime = false; _stopReconnecting = false; _callDisconnectedCallback = false; _waitingServerResponse = false; _gotOnOpenCount = 0; _permissions = new List <KeyValuePair <string, string> >(); _lastKeepAlive = null; _reconnectStartedAt = null; _reconnectTimer = new Reconnector();//= null; _subscribedChannels = new ConcurrentDictionary <string, ChannelSubscription>(); _multiPartMessagesBuffer = new ConcurrentDictionary <string, ConcurrentDictionary <int, BufferedMessage> >(); TimerCallback hbCb = this._heartbeatTimer_Elapsed; _heartbeatTimer = new Timer(hbCb, null, Timeout.Infinite, context.HeartbeatTime); TimerCallback cnCB = this._connectionTimer_Elapsed; _connectionTimer = new Timer(cnCB, null, System.Threading.Timeout.Infinite, Constants.SERVER_HB_COUNT); _connectionTimerIsDisposed = false; //_webSocketConnection = new Connection(_reconnectTimer); //_webSocketConnection.OnOpened += new Connection.onOpenedDelegate(_webSocketConnection_OnOpened); //_webSocketConnection.OnClosed += new Connection.onClosedDelegate(_webSocketConnection_OnClosed); //_webSocketConnection.OnError += new Connection.onErrorDelegate(_webSocketConnection_OnError); //_webSocketConnection.OnMessageReceived += new Connection.onMessageReceivedDelegate(_webSocketConnection_OnMessageReceived); _msgProcessor = new MsgProcessor(this); }
static void Main(string[] args) { // Set this code once in App.xaml.cs or application startup SciChartSurface.SetRuntimeLicenseKey("RJWA77RbaJDdCRJpg4Iunl5Or6/FPX1xT+Gzu495Eaa0ZahxWi3jkNFDjUb/w70cHXyv7viRTjiNRrYqnqGA+Dc/yzIIzTJlf1s4DJvmQc8TCSrH7MBeQ2ON5lMs/vO0p6rBlkaG+wwnJk7cp4PbOKCfEQ4NsMb8cT9nckfdcWmaKdOQNhHsrw+y1oMR7rIH+rGes0jGGttRDhTOBxwUJK2rBA9Z9PDz2pGOkPjy9fwQ4YY2V4WPeeqM+6eYxnDZ068mnSCPbEnBxpwAldwXTyeWdXv8sn3Dikkwt3yqphQxvs0h6a8Dd6K/9UYni3o8pRkTed6SWodQwICcewfHTyGKQowz3afARj07et2h+becxowq3cRHL+76RyukbIXMfAqLYoT2UzDJNsZqcPPq/kxeXujuhT4SrNF3444MU1GaZZ205KYEMFlz7x/aEnjM6p3BuM6ZuO3Fjf0A0Ki/NBfS6n20E07CTGRtI6AsM2m59orPpI8+24GFlJ9xGTjoRA=="); //On ajoute un gestionnaire d'évènement pour détecter la fermeture de l'application _handler += new EventHandler(Handler); SetConsoleCtrlHandler(_handler, true); //serialPort1 = new ReliableSerialPort(cfgSerialPort.CommName, cfgSerialPort.ComBaudrate, cfgSerialPort.Parity, cfgSerialPort.DataByte, cfgSerialPort.StopByte); //serialPort1 = new ReliableSerialPort("COM1", 115200, Parity.None, 8, StopBits.One); int teamId = (int)TeamId.Team1; int robotId = (int)RobotId.Robot1 + teamId; usbDriver = new USBVendorNS.USBVendor(); msgDecoder = new MsgDecoder(); msgEncoder = new MsgEncoder(); robotMsgGenerator = new MsgGenerator(); robotMsgProcessor = new MsgProcessor(robotId, competition); imuProcessor = new ImuProcessor.ImuProcessor(robotId); lidar_OMD60M_TCP = new LidaRxR2000(50, R2000SamplingRate._72kHz); perceptionManager = new PerceptionManager(robotId, competition); kalmanPositioning = new KalmanPositioning.KalmanPositioning(robotId, 50, 0.2, 0.2, 0.2, 0.1, 0.1, 0.1, 0.02); trajectoryPlanner = new TrajectoryGeneratorHolonome(robotId, competition); localWorldMapManager = new LocalWorldMapManager(robotId, teamId, bypassMulticast: false); globalWorldMapManager = new GlobalWorldMapManager(robotId, teamId); switch (competition) { case GameMode.RoboCup: strategyManager = new StrategyRoboCup(robotId, teamId, "224.16.32.79"); break; case GameMode.Eurobot: strategyManager = new StrategyEurobot2021(robotId, teamId, "224.16.32.79"); break; case GameMode.Demo: break; } //strategyManager = new StrategyManagerNS.StrategyManager(robotId, teamId, "224.16.32.79", competition); robotUdpMulticastSender = new UDPMulticastSender(robotId, "224.16.32.79"); robotUdpMulticastReceiver = new UDPMulticastReceiver(robotId, "224.16.32.79"); robotUdpMulticastInterpreter = new UDPMulticastInterpreter(robotId); herkulexManager = new HerkulexManager(); herkulexManager.AddServo(ServoId.BrasCentral, HerkulexDescription.JOG_MODE.positionControlJOG); herkulexManager.AddServo(ServoId.BrasDroit, HerkulexDescription.JOG_MODE.positionControlJOG); herkulexManager.AddServo(ServoId.BrasGauche, HerkulexDescription.JOG_MODE.positionControlJOG); herkulexManager.AddServo(ServoId.PorteDrapeau, HerkulexDescription.JOG_MODE.positionControlJOG); xBoxManette = new XBoxControllerNS.XBoxController(robotId); //Démarrage des interface de visualisation if (usingRobotInterface) { StartRobotInterface(); } //if (usingLogReplay) // StartReplayNavigatorInterface(); //Initialisation du logger logRecorder = new LogRecorder.LogRecorder(); //Démarrage du log replay si l'interface est utilisée et existe ou si elle n'est pas utilisée, sinon on bloque logReplay = new LogReplay.LogReplay(); //Liens entre modules //strategyManager.strategy.OnRefereeBoxCommandEvent += globalWorldMapManager.OnRefereeBoxCommandReceived; strategyManager.OnGameStateChangedEvent += trajectoryPlanner.OnGameStateChangeReceived; strategyManager.OnWaypointEvent += trajectoryPlanner.OnWaypointReceived; //Kalman perceptionManager.OnAbsolutePositionEvent += kalmanPositioning.OnAbsolutePositionCalculatedEvent; imuProcessor.OnGyroSpeedEvent += kalmanPositioning.OnGyroRobotSpeedReceived; robotMsgProcessor.OnPolarOdometrySpeedFromRobotEvent += kalmanPositioning.OnOdometryRobotSpeedReceived; kalmanPositioning.OnKalmanLocationEvent += trajectoryPlanner.OnPhysicalPositionReceived; kalmanPositioning.OnKalmanLocationEvent += perceptionManager.OnPhysicalRobotPositionReceived; kalmanPositioning.OnKalmanLocationEvent += strategyManager.OnPositionRobotReceived; //Update des données de la localWorldMap perceptionManager.OnPerceptionEvent += localWorldMapManager.OnPerceptionReceived; strategyManager.OnDestinationEvent += localWorldMapManager.OnDestinationReceived; strategyManager.OnRoleEvent += localWorldMapManager.OnRoleReceived; //Utile pour l'affichage strategyManager.OnMessageDisplayEvent += localWorldMapManager.OnMessageDisplayReceived; //Utile pour l'affichage strategyManager.OnHeatMapStrategyEvent += localWorldMapManager.OnHeatMapStrategyReceived; strategyManager.OnWaypointEvent += localWorldMapManager.OnWaypointReceived; strategyManager.OnHeatMapWayPointEvent += localWorldMapManager.OnHeatMapWaypointReceived; trajectoryPlanner.OnGhostLocationEvent += localWorldMapManager.OnGhostLocationReceived; //Gestion des events liés à une détection de collision soft trajectoryPlanner.OnCollisionEvent += kalmanPositioning.OnCollisionReceived; //trajectoryPlanner.OnSpeedConsigneEvent += robotMsgGenerator.GenerateMessageSetSpeedConsigneToRobot; strategyManager.OnMessageEvent += lidar_OMD60M_TCP.OnMessageReceivedEvent; strategyManager.On4WheelsPolarSpeedPIDSetupEvent += robotMsgGenerator.GenerateMessage4WheelsPolarSpeedPIDSetup; strategyManager.On4WheelsIndependantSpeedPIDSetupEvent += robotMsgGenerator.GenerateMessage4WheelsIndependantSpeedPIDSetup; strategyManager.On2WheelsPolarSpeedPIDSetupEvent += robotMsgGenerator.GenerateMessage2WheelsPolarSpeedPIDSetup; strategyManager.On2WheelsIndependantSpeedPIDSetupEvent += robotMsgGenerator.GenerateMessage2WheelsIndependantSpeedPIDSetup; strategyManager.OnSetAsservissementModeEvent += robotMsgGenerator.GenerateMessageSetAsservissementMode; strategyManager.OnSetSpeedConsigneToMotor += robotMsgGenerator.GenerateMessageSetSpeedConsigneToMotor; strategyManager.OnEnableDisableMotorCurrentDataEvent += robotMsgGenerator.GenerateMessageEnableMotorCurrentData; strategyManager.OnOdometryPointToMeterEvent += robotMsgGenerator.GenerateMessageOdometryPointToMeter; strategyManager.On4WheelsAngleSetEvent += robotMsgGenerator.GenerateMessage4WheelsAngleSet; strategyManager.On4WheelsToPolarSetEvent += robotMsgGenerator.GenerateMessage4WheelsToPolarMatrixSet; strategyManager.On2WheelsAngleSetEvent += robotMsgGenerator.GenerateMessage2WheelsAngleSet; strategyManager.On2WheelsToPolarSetEvent += robotMsgGenerator.GenerateMessage2WheelsToPolarMatrixSet; herkulexManager.OnHerkulexSendToSerialEvent += robotMsgGenerator.GenerateMessageForwardHerkulex; lidar_OMD60M_TCP.OnLidarDecodedFrameEvent += perceptionManager.OnRawLidarDataReceived; perceptionManager.OnLidarRawDataEvent += localWorldMapManager.OnRawLidarDataReceived; perceptionManager.OnLidarProcessedDataEvent += localWorldMapManager.OnLidarDataReceived; perceptionManager.OnLidarProcessedLandmarksEvent += localWorldMapManager.OnLidarDataReceived; perceptionManager.OnLidarProcessedSegmentsEvent += localWorldMapManager.OnLidarProcessedSegmentsReceived; //L'envoi des commandes dépend du fait qu'on soit en mode manette ou pas. //Il faut donc enregistrer les évènement ou pas en fonction de l'activation //C'est fait plus bas dans le code avec la fonction que l'on appelle ConfigControlEvents(usingXBoxController); //Gestion des messages envoyé par le robot robotMsgGenerator.OnMessageToRobotGeneratedEvent += msgEncoder.EncodeMessageToRobot; //msgEncoder.OnMessageEncodedEvent += serialPort1.SendMessage; msgEncoder.OnMessageEncodedEvent += usbDriver.SendUSBMessage; //Gestion des messages reçu par le robot //serialPort1.OnDataReceivedEvent += msgDecoder.DecodeMsgReceived; usbDriver.OnUSBDataReceivedEvent += msgDecoder.DecodeMsgReceived; msgDecoder.OnMessageDecodedEvent += robotMsgProcessor.ProcessRobotDecodedMessage; robotMsgProcessor.OnIMURawDataFromRobotGeneratedEvent += imuProcessor.OnIMURawDataReceived; robotMsgProcessor.OnIOValuesFromRobotGeneratedEvent += strategyManager.OnIOValuesFromRobot; robotMsgProcessor.OnIOValuesFromRobotGeneratedEvent += perceptionManager.OnIOValuesFromRobotEvent; landmarksExtractor = new LandmarksExtractor(); landmarksExtractor.OnLinesLandmarksExtractedEvent += perceptionManager.OnLandmarksReceived; perceptionManager.OnLidarRawDataEvent += landmarksExtractor.OnRobotLidarReceived; perceptionManager.OnAbsolutePositionEvent += landmarksExtractor.OnRobotPositionReceived; // robotMsgProcessor.OnMotorsCurrentsFromRobotGeneratedEvent += strategyManager.OnMotorCurrentReceive; //Le local Manager n'est là que pour assurer le stockage de ma local world map avant affichage et transmission des infos, il ne doit pas calculer quoique ce soit, //c'est le perception manager qui le fait. trajectoryPlanner.OnPidSpeedResetEvent += robotMsgGenerator.GenerateMessageResetSpeedPid; ////Event d'interprétation d'une globalWorldMap à sa réception dans le robot robotUdpMulticastInterpreter.OnRefBoxMessageEvent += strategyManager.OnRefBoxMsgReceived; /// Event de Transmission des Local World Map du robot vers le multicast /// Disparaitra quand on voudra jouer sans liaison multicast localWorldMapManager.OnMulticastSendLocalWorldMapEvent += robotUdpMulticastSender.OnMulticastMessageToSendReceived; /// Events de réception des localWorldMap /// Soit en direct si on se transmet à nous même, soit via le Multicast pour transmettre aux autres robots localWorldMapManager.OnLocalWorldMapToGlobalWorldMapGeneratorEvent += globalWorldMapManager.OnLocalWorldMapReceived; robotUdpMulticastInterpreter.OnLocalWorldMapEvent += globalWorldMapManager.OnLocalWorldMapReceived; /// Event généré lorsque la Global World Map a été calculée. /// Elle n'a pas vocation à être renvoyée à tous les robots puisqu'on la génère dans chaque robot en parallèle globalWorldMapManager.OnGlobalWorldMapEvent += strategyManager.OnGlobalWorldMapReceived; /// Event de Réception de data Multicast sur le robot robotUdpMulticastReceiver.OnDataReceivedEvent += robotUdpMulticastInterpreter.OnMulticastDataReceived; /// LOGGER related events perceptionManager.OnLidarRawDataEvent += logRecorder.OnRawLidarDataReceived; robotMsgProcessor.OnIMURawDataFromRobotGeneratedEvent += logRecorder.OnIMURawDataReceived; robotMsgProcessor.OnPolarOdometrySpeedFromRobotEvent += logRecorder.OnPolarSpeedDataReceived; //omniCamera.OpenCvMatImageEvent += logRecorder.OnOpenCVMatImageReceived; //strategyManagerDictionary.Add(robotId, strategyManager); trajectoryPlanner.InitRobotPosition(0, 0, 0); strategyManager.InitStrategy(robotId, teamId); while (!exitSystem) { Thread.Sleep(500); } }
static void Main(string[] args) { ConsoleFormat.InitMainConsole(); /// Enregistrement de la license SciChart en début de code SciChartSurface.SetRuntimeLicenseKey(ConstVar.SCICHART_RUNTIME_KEY); ConsoleFormat.SetupScichartLicenceKey(); /// Initialisation des modules utilisés dans le robot int robotId = (int)RobotId.Robot1; int teamId = (int)TeamId.Team1; usbDriver = new USBVendor(); msgDecoder = new MsgDecoder(); msgEncoder = new MsgEncoder(); msgGenerator = new MsgGenerator(); msgProcessor = new MsgProcessor(robotId, competition); ConsoleFormat.SetupAllCommunication(); xBoxManette = new XBoxController(robotId); ConsoleFormat.SetupXboxController(); logRecorder = new LogRecorder(); logReplay = new LogReplay(); strategyManager = new StrategyEurobot(robotId, teamId, "224.16.32.79"); #region Communication to Low Lvl /// Création des liens entre module, sauf depuis et vers l'interface graphique usbDriver.OnUSBuffReceivedEvent += msgDecoder.BuffReceived; // Transmission des messages reçus par l'USB au Message Decoder msgDecoder.OnCorrectMessageReceivedEvent += msgProcessor.ProcessRobotDecodedMessage; // Transmission les messages décodés par le Message Decoder au Message Processor msgGenerator.OnMessageToRobotGeneratedEvent += msgEncoder.EncodeAndSendMessage; // Envoi des messages du générateur de message à l'encoder msgEncoder.OnSendMessageEvent += usbDriver.SendUSBMessage; // Envoi des messages en USB depuis le message encoder #endregion #region Console // Control: bool hex_viewer = false; bool hex_sender = false; bool hex_viewer_error = true; bool hex_sender_error = true; bool hex_processor = false; bool hex_generator = false; #region USB Vendor usbDriver.OnDeviceAddedEvent += ConsoleFormat.PrintNewDeviceAdded; usbDriver.OnDeviceRemovedEvent += ConsoleFormat.PrintDeviceRemoved; usbDriver.OnUsbVendorExeptionEvent += ConsoleFormat.PrintUsbErrorExeption; #endregion #region Hex Viewer if (hex_viewer) { msgDecoder.OnUnknowByteEvent += ConsoleFormat.PrintUnknowByte; msgDecoder.OnSOFByteReceivedEvent += ConsoleFormat.PrintSOF; msgDecoder.OnFunctionMSBByteReceivedEvent += ConsoleFormat.PrintFunctionMSB; msgDecoder.OnFunctionLSBByteReceivedEvent += ConsoleFormat.PrintFunctionLSB; msgDecoder.OnPayloadLenghtMSBByteReceivedEvent += ConsoleFormat.PrintLenghtMSB; msgDecoder.OnPayloadLenghtLSBByteReceivedEvent += ConsoleFormat.PrintLenghtLSB; msgDecoder.OnPayloadByteReceivedEvent += ConsoleFormat.PrintPayloadByte; msgDecoder.OnCorrectMessageReceivedEvent += ConsoleFormat.PrintCorrectChecksum; msgDecoder.OnErrorMessageReceivedEvent += ConsoleFormat.PrintWrongChecksum; } #endregion #region Hex Viewer Error if (hex_viewer_error) { msgDecoder.OnOverLenghtMessageEvent += ConsoleFormat.PrintOverLenghtWarning; msgDecoder.OnUnknowFunctionEvent += ConsoleFormat.PrintUnknowFunctionReceived; msgDecoder.OnWrongLenghtFunctionEvent += ConsoleFormat.PrintWrongFonctionLenghtReceived; } #endregion #region Hex Sender if (hex_sender) { msgEncoder.OnSendMessageByteEvent += ConsoleFormat.PrintSendMsg; } #endregion #region Hex Sender Error if (hex_sender_error) { msgEncoder.OnSerialDisconnectedEvent += ConsoleFormat.PrintOnSerialDisconnectedError; msgEncoder.OnUnknownFunctionSentEvent += ConsoleFormat.PrintUnknowFunctionSent; msgEncoder.OnWrongPayloadSentEvent += ConsoleFormat.PrintWrongFunctionLenghtSent; } #endregion #endregion #region Lidar lidar = new SickLidar(17422959); // 18110177 lidarProcess = new LidarProcess(robotId, teamId); lidar.OnLidarDeviceConnectedEvent += lidarProcess.OnNewLidarConnected; lidar.OnLidarDeviceConnectedEvent += ConsoleFormat.NewLidarDeviceConnected; lidar.PointsAvailable += lidarProcess.OnRawPointAvailable; lidar.Start(); #endregion lidarProcess.OnRawLidarDataEvent += logRecorder.OnRawLidarDataReceived; msgProcessor.OnSpeedPolarOdometryFromRobotEvent += logRecorder.OnPolarSpeedDataReceived; #region Local World Map localWorldMap = new LocalWorldMap(robotId, teamId); localWorldMap.OnUpdateRobotLocationEvent += lidarProcess.OnRobotLocation; lidarProcess.OnRawLidarPointPolarEvent += localWorldMap.OnLidarRawPointReceived; lidarProcess.OnProcessLidarPolarDataEvent += localWorldMap.OnLidarProcessedPointReceived; lidarProcess.OnProcessLidarLineDataEvent += localWorldMap.OnLidarProcessedLineReceived; lidarProcess.OnProcessLidarCupDataEvent += localWorldMap.OnLidarProcessedCupReceived; lidarProcess.OnLidarSetupRobotLocationEvent += localWorldMap.OnRobotLocation; //lidarProcess.OnProcessLidarObjectsDataEvent += localWorldMap.OnLidarProcesObjectsReceived; localWorldMap.OnLocalWorldMapEvent += strategyManager.OnLocalWorldMapReceived; localWorldMap.Init(); #endregion #region Position2Wheels positioning2Wheels = new Positioning2Wheels(robotId); msgProcessor.OnSpeedPolarOdometryFromRobotEvent += positioning2Wheels.OnOdometryRobotSpeedReceived; positioning2Wheels.OnCalculatedLocationEvent += localWorldMap.OnRobotLocationArgs; #endregion #region TrajectoryPlanner trajectoryPlanner = new TrajectoryPlanner(robotId); trajectoryPlanner.OnNewGhostLocationEvent += localWorldMap.OnGhostLocation; trajectoryPlanner.OnNewRobotLocationEvent += localWorldMap.OnRobotLocation; trajectoryPlanner.OnDestinationReachedEvent += strategyManager.OnGhostLocationReached; #endregion #region Strategy /!\Need to be Last /! \ strategyManager.On2WheelsToPolarMatrixSetupEvent += msgGenerator.GenerateMessage2WheelsToPolarMatrixSet; //Transmission des messages de set-up de la matrice de transformation moteurindepeandt -> polaire en embarqué strategyManager.On2WheelsAngleSetupEvent += msgGenerator.GenerateMessage2WheelsAngleSet; //Transmission des messages de set-up de la config angulaire des roues en embarqué strategyManager.OnOdometryPointToMeterSetupEvent += msgGenerator.GenerateMessageOdometryPointToMeter; //Transmission des messages de set-up du coeff pointToMeter en embarqué strategyManager.OnSetAsservissementModeEvent += msgGenerator.GenerateMessageSetAsservissementMode; strategyManager.OnDestinationReachedEvent += localWorldMap.OnDestinationReached; strategyManager.OnWaypointsReachedEvent += localWorldMap.OnWaypointReached; strategyManager.OnSetActualLocationEvent += trajectoryPlanner.OnUpdateActualLocation; strategyManager.OnSetWantedLocationEvent += trajectoryPlanner.OnUpdateWantedDestination; strategyManager.OnGhostCalculationBeginEvent += trajectoryPlanner.OnLaunchCalculation; strategyManager.OnSetNewWaypointEvent += localWorldMap.AddNewWaypointsEvent; strategyManager.OnSetNewDestinationEvent += localWorldMap.SetDestinationLocationEvent; strategyManager.OnUpdateGhostCalculationOrderEvent += trajectoryPlanner.OnCalculateGhostMovement; ConsoleFormat.PrintStrategyBoot(); strategyManager.InitStrategy(); //à faire après avoir abonné les events ! #endregion if (usingMatchDisplay) { StartMatchInterface(); } else { StartRobotInterface(); } ConsoleFormat.EndMainBootSequence(); while (!exitSystem) { Thread.Sleep(500); } }
/// <summary> /// Метод запуска сервера /// </summary> public static void Process() { MsgProcessor.TryNow(); }
/// <summary> /// Отправка сообщения /// </summary> /// <param name="message">Сообщение</param> /// <param name="filter">Фильтр клиентов</param> public static void PushMessage(CometMessage message, Predicate <CometAsyncState> filter) { WriteLog($"Start PushMessage -> message: {message.Message}"); MsgProcessor.AddMessage(message, filter); WriteLog("End PushMessage"); }
// Возвращаем сообщение каждому подключенному клиенту /* * public static void PushMessage(CometMessage pushMessage, string clientGuid = "") * { * lock (_lock) * { * // Пробегаем по списку всех подключенных клиентов * foreach (var clientState in _clientStateList) * { * if (clientState.CurrentContext.Session != null) * { * if (clientGuid != "" && clientState.ClientGuid != clientGuid) continue; * // И пишем в выходной поток текущее сообщение * clientState.CurrentContext.Response.Write(pushMessage.IsV4Script * ? pushMessage.Message * : pushMessage.Serialize()); * // После чего завершаем запрос - вот именно после этого результаты * // запроса пойдут ко всем подключенным клиентам * clientState.CompleteRequest(); * } * } * } * }*/ /// <summary> /// Отправка сообщения /// </summary> /// <param name="message">Сообщение</param> /// <param name="clientGuid">Идентификатор страницы</param> public static void PushMessage(CometMessage message, string clientGuid = "") { MsgProcessor.AddMessage(message, clientGuid); }
void ProcessMsg(object msgKey, object msgObj, MsgProcessor processor) { processor.Push(msgObj); }
static void Main(string[] args) { SetConsoleCtrlHandler(new HandlerRoutine(ConsoleCtrlCheck), true); // Set this code once in App.xaml.cs or application startup SciChartSurface.SetRuntimeLicenseKey("wsCOsvBlAs2dax4o8qBefxMi4Qe5BVWax7TGOMLcwzWFYRNCa/f1rA5VA1ITvLHSULvhDMKVTc+niao6URAUXmGZ9W8jv/4jtziBzFZ6Z15ek6SLU49eIqJxGoQEFWvjANJqzp0asw+zvLV0HMirjannvDRj4i/WoELfYDubEGO1O+oAToiJlgD/e2lVqg3F8JREvC0iqBbNrmfeUCQdhHt6SKS2QpdmOoGbvtCossAezGNxv92oUbog6YIhtpSyGikCEwwKSDrlKlAab6302LLyFsITqogZychLYrVXJTFvFVnDfnkQ9cDi7017vT5flesZwIzeH497lzGp3B8fKWFQyZemD2RzlQkvj5GUWBwxiKAHrYMnQjJ/PsfojF1idPEEconVsh1LoYofNk2v/Up8AzXEAvxWUEcgzANeQggaUNy+OFet8b/yACa/bgYG7QYzFQZzgdng8IK4vCPdtg4/x7g5EdovN2PI9vB76coMuKnNVPnZN60kSjtd/24N8A=="); switch (robotMode) { case RobotMode.Standard: usingLidar = true; usingCamera = true; usingLogging = false; usingLogReplay = false; break; case RobotMode.Acquisition: usingLidar = true; usingCamera = true; usingLogging = true; usingLogReplay = false; break; case RobotMode.Replay: usingLidar = false; usingCamera = false; usingLogging = false; usingLogReplay = true; break; case RobotMode.Nolidar: usingLidar = false; usingCamera = true; usingLogging = false; usingLogReplay = false; break; case RobotMode.NoCamera: usingLidar = true; usingCamera = false; usingLogging = false; usingLogReplay = false; break; } int robotId = (int)TeamId.Team1 + (int)RobotId.Robot1; int teamId = (int)TeamId.Team1; serialPort1 = new ReliableSerialPort("COM1", 115200, Parity.None, 8, StopBits.One); msgDecoder = new MsgDecoder(); msgEncoder = new MsgEncoder(); robotMsgGenerator = new MsgGenerator(); robotMsgProcessor = new MsgProcessor(robotId, GameMode.RoboCup); robotPilot = new RobotPilot.RobotPilot(robotId); strategyManager = new StrategyRoboCup(robotId, teamId, "224.16.32.79"); waypointGenerator = new WaypointGenerator(robotId, GameMode.RoboCup); trajectoryPlanner = new TrajectoryGeneratorHolonome(robotId, GameMode.RoboCup); kalmanPositioning = new KalmanPositioning.KalmanPositioning(robotId, 50, 0.2, 0.2, 0.2, 0.1, 0.1, 0.1, 0.02); localWorldMapManager = new LocalWorldMapManager(robotId, teamId, bypassMulticast: false); perceptionManager = new PerceptionManager(robotId, GameMode.RoboCup); imuProcessor = new ImuProcessor.ImuProcessor(robotId); if (usingYolo) { yoloDetector = new YoloObjectDetector.YoloObjectDetector(false); //Instancie un detecteur avec un Wrappeur Yolo utilisant le GPU } if (usingLidar) { lidar_OMD60M_TCP = new LidaRxR2000(); } if (usingLidar || usingLogReplay) { lidarProcessor = new LidarProcessor.LidarProcessor(robotId, GameMode.RoboCup); } xBoxManette = new XBoxControllerNS.XBoxController(robotId); if (usingCamera || usingLogReplay) { imageProcessingPositionFromOmniCamera = new ImageProcessingPositionFromOmniCamera(); absolutePositionEstimator = new AbsolutePositionEstimator(robotId); } if (usingCamera) { omniCamera = new BaslerCameraAdapter(); omniCamera.CameraInit(); //omniCamera.BitmapPanoramaImageEvent += absolutePositionEstimator.AbsolutePositionEvaluation; } if (usingImageExtractor && usingCamera) { imgSaver = new ImageSaver.ImageSaver(); omniCamera.BitmapPanoramaImageEvent += imgSaver.OnSaveBitmapImage; } //Démarrage des interface de visualisation if (usingRobotInterface) { StartRobotInterface(); } if (usingCameraInterface) { StartCameraInterface(); } //Démarrage du logger si besoin if (usingLogging) { logRecorder = new LogRecorder.LogRecorder(); } //Démarrage du log replay si l'interface est utilisée et existe ou si elle n'est pas utilisée, sinon on bloque if (usingLogReplay) { logReplay = new LogReplay.LogReplay(); } //Liens entre modules strategyManager.OnDestinationEvent += waypointGenerator.OnDestinationReceived; strategyManager.OnHeatMapStrategyEvent += waypointGenerator.OnStrategyHeatMapReceived; waypointGenerator.OnWaypointEvent += trajectoryPlanner.OnWaypointReceived; //Filtre de Kalman perceptionManager.OnAbsolutePositionEvent += kalmanPositioning.OnAbsolutePositionCalculatedEvent; robotMsgProcessor.OnPolarOdometrySpeedFromRobotEvent += kalmanPositioning.OnOdometryRobotSpeedReceived; imuProcessor.OnGyroSpeedEvent += kalmanPositioning.OnGyroRobotSpeedReceived; kalmanPositioning.OnKalmanLocationEvent += trajectoryPlanner.OnPhysicalPositionReceived; kalmanPositioning.OnKalmanLocationEvent += perceptionManager.OnPhysicalRobotPositionReceived; //kalmanPositioning.OnKalmanLocationEvent += strategyManager.OnPositionRobotReceived; //L'envoi des commandes dépend du fait qu'on soit en mode manette ou pas. //Il faut donc enregistrer les évènement ou pas en fonction de l'activation //C'est fait plus bas dans le code avec la fonction que l'on appelle ConfigControlEvents(useXBoxController: true); //Gestion des messages envoyé par le robot robotMsgGenerator.OnMessageToRobotGeneratedEvent += msgEncoder.EncodeMessageToRobot; msgEncoder.OnMessageEncodedEvent += serialPort1.SendMessage; //Gestion des messages reçu par le robot serialPort1.OnDataReceivedEvent += msgDecoder.DecodeMsgReceived; msgDecoder.OnMessageDecodedEvent += robotMsgProcessor.ProcessRobotDecodedMessage; robotMsgProcessor.OnIMURawDataFromRobotGeneratedEvent += imuProcessor.OnIMURawDataReceived; //physicalSimulator.OnPhysicalRobotLocationEvent += trajectoryPlanner.OnPhysicalPositionReceived; //physicalSimulator.OnPhysicicalObjectListLocationEvent += perceptionSimulator.OnPhysicalObjectListLocationReceived; //physicalSimulator.OnPhysicalRobotLocationEvent += perceptionSimulator.OnPhysicalRobotPositionReceived; //physicalSimulator.OnPhysicalBallPositionEvent += perceptionSimulator.OnPhysicalBallPositionReceived; perceptionManager.OnPerceptionEvent += localWorldMapManager.OnPerceptionReceived; strategyManager.OnDestinationEvent += localWorldMapManager.OnDestinationReceived; waypointGenerator.OnWaypointEvent += localWorldMapManager.OnWaypointReceived; strategyManager.OnHeatMapStrategyEvent += localWorldMapManager.OnHeatMapStrategyReceived; //if (usingLidar) //{ // lidar_OMD60M_TCP.OnLidarDecodedFrameEvent += lidarProcessor.OnRawLidarDataReceived; // //lidar_OMD60M.OnLidarDecodedFrameEvent += absolutePositionEstimator.OnRawLidarDataReceived; // lidar_OMD60M_TCP.OnLidarDecodedFrameEvent += localWorldMapManager.OnRawLidarDataReceived; // lidarProcessor.OnLidarObjectProcessedEvent += localWorldMapManager.OnLidarObjectsReceived; //} if (usingLidar) { lidar_OMD60M_TCP.OnLidarDecodedFrameEvent += perceptionManager.OnRawLidarDataReceived; //lidar_OMD60M_TCP.OnLidarDecodedFrameEvent += localWorldMapManager.OnLidarDataReceived; lidarProcessor.OnLidarProcessedEvent += localWorldMapManager.OnLidarDataReceived; } //Events de recording if (usingLogging) { //lidar_OMD60M_UDP.OnLidarDecodedFrameEvent += logRecorder.OnRawLidarDataReceived; lidar_OMD60M_TCP.OnLidarDecodedFrameEvent += logRecorder.OnRawLidarDataReceived; omniCamera.BitmapFishEyeImageEvent += logRecorder.OnBitmapImageReceived; imuProcessor.OnIMUProcessedDataGeneratedEvent += logRecorder.OnIMURawDataReceived; robotMsgProcessor.OnPolarOdometrySpeedFromRobotEvent += logRecorder.OnPolarSpeedDataReceived; //omniCamera.OpenCvMatImageEvent += logRecorder.OnOpenCVMatImageReceived; } if (usingLogReplay) { logReplay.OnLidarEvent += perceptionManager.OnRawLidarDataReceived; //logReplay.OnCameraImageEvent += imageProcessingPositionFromOmniCamera.ProcessOpenCvMatImage; //logReplay.OnCameraImageEvent += absolutePositionEstimator.AbsolutePositionEvaluation; //lidarProcessor.OnLidarObjectProcessedEvent += localWorldMapManager.OnLidarObjectsReceived; } lock (ExitLock) { // Do whatever setup code you need here // once we are done wait Monitor.Wait(ExitLock); } }
private async Task ConnectAsync(ReceiveMsgDelegate mp, SocketSettings socSet, WaitHandle connwh = null) { AppDomain.CurrentDomain.ProcessExit += CurrentDomainOnProcessExit; Logger.Info("===================================="); Logger.Info($" STARTING WEBSOCKET {socSet.name} "); Logger.Info(" Manager API Client "); Logger.Info("===================================="); var factory = new Func <ClientWebSocket>(() => new ClientWebSocket { Options = { KeepAliveInterval = TimeSpan.FromSeconds(socSet.keepalive), // Proxy = ... // ClientCertificates = ... } }); if (!bRunning) { try { bRunning = true; addconn(this); var URL = new Uri("ws://" + socSet.url + ":" + socSet.port); using (IWebsocketClient client = new WebsocketClient(URL, factory)) { string received = null; oclient = client; client.Name = name; client.ReconnectTimeoutMs = (int)TimeSpan.FromSeconds(socSet.recontimeout).TotalMilliseconds; client.ErrorReconnectTimeoutMs = (int)TimeSpan.FromSeconds(socSet.errrecontimeout).TotalMilliseconds; client.ReconnectionHappened.Subscribe((Action <ReconnectionType>)((type) => { Logger.Info($"Reconnecting Manager API Client to type: {type} , url: {client.Url} , name: {name} {client.Name}"); })); client.DisconnectionHappened.Subscribe((Action <DisconnectionType>)((type) => { Logger.Info($"Disconnection Manager API Client to type: {type} , url: {client.Url}, name {name} {client.Name}"); })); client.MessageReceived.Subscribe((msg) => { try { if (msg.Text != null) { received = msg.Text; Logger.Debug($"Message To Manager API Client From : {received}, name {name} {client.Name}"); } else if (msg.Binary != null) { isaCommand cmd = MsgProcessor.CommandFactory(msg.Binary); if (cmd.command == eCommand.Ping) { Logger.Debug($"Ping To Manager API Client, Reply Pong to {name} {client.Name}"); client.Send(new Command() { command = eCommand.Pong }.ToArray()); } else if (cmd.command == eCommand.Pong) { Logger.Debug($"Manager API Received Pong from {name} {client.Name}"); } else { Logger.Info($"Manager API Received msg from {name} {client.Name}"); mp(cmd); } } } catch (Exception ex) { //isaCommand cmd = MsgProcessor.CommandFactory(msg.Binary); Logger.Error($"Message Received Manager API: " + ex.Message + Environment.NewLine + msg.ToString()); } }); await client.Start(); //new Thread(() => StartSendingPing(client)).Start(); ExitEvent.WaitOne(); } } catch (Exception e) { } finally { rmconn(this); if (connwh != null) { ((AutoResetEvent)connwh).Set(); } } } Logger.Info("===================================="); Logger.Info($" STOPPING WebSocketClient {name} "); Logger.Info(" Manager API Client "); Logger.Info("===================================="); }
public void HandleReceive(ByteBuf bb) { MsgProcessor.ProcessMsg(bb); }
void ProcessMsg(object msgKey, object msgObj, MsgProcessor processor) { lock (_lockObj) processor.Push(msgObj); }