コード例 #1
0
        public void OnPerceptionReceived(object sender, EventArgsLibrary.PerceptionArgs e)
        {
            //PerceptionMonitor.PerceptionReceived();
            if (localWorldMap == null)
            {
                return;
            }
            if (localWorldMap.RobotId == e.RobotId)
            {
                //On ajoute les infos à la Local World Map
                localWorldMap.robotLocation         = e.Perception.robotKalmanLocation;
                localWorldMap.obstaclesLocationList = e.Perception.obstaclesLocationList;
                localWorldMap.ballLocationList      = e.Perception.ballLocationList;

                //On recopie les infos de la local World Map dans la structure de transfert (sans ce qui coute cher : heatmaps, lidarpoints...)
                LocalWorldMap transferLocalWorldMap = new LocalWorldMap();
                transferLocalWorldMap.RobotId               = localWorldMap.RobotId;
                transferLocalWorldMap.TeamId                = localWorldMap.TeamId;
                transferLocalWorldMap.robotLocation         = localWorldMap.robotLocation;
                transferLocalWorldMap.destinationLocation   = localWorldMap.destinationLocation;
                transferLocalWorldMap.waypointLocation      = localWorldMap.waypointLocation;
                transferLocalWorldMap.robotGhostLocation    = localWorldMap.robotGhostLocation;
                transferLocalWorldMap.robotRole             = localWorldMap.robotRole;
                transferLocalWorldMap.ballHandlingState     = localWorldMap.ballHandlingState;
                transferLocalWorldMap.messageDisplay        = localWorldMap.messageDisplay;
                transferLocalWorldMap.playingSide           = localWorldMap.playingSide;
                transferLocalWorldMap.obstaclesLocationList = localWorldMap.obstaclesLocationList;
                transferLocalWorldMap.ballLocationList      = localWorldMap.ballLocationList;

                if (transferLocalWorldMap.robotLocation != null)
                {
                    //if (bypassMulticastUdp)
                    //{
                    //    OnLocalWorldMapForDisplayOnly(localWorldMap); //Pour affichage uniquement, sinon transmission radio en, multicast
                    //}
                    //else
                    {
                        var s = ZeroFormatterSerializer.Serialize <WorldMap.ZeroFormatterMsg>(transferLocalWorldMap);

                        OnMulticastSendLocalWorldMapCommand(s); //Retiré pour test de robustesse, mais nécessaire à la RoboCup

                        //ATTENTION : appel douteux...
                        OnLocalWorldMapForDisplayOnly(localWorldMap); //Pour affichage uniquement, sinon transmission radio en, multicast

                        //LWMEmiseMonitoring.LWMEmiseMonitor(s.Length);
                    }
                }
            }
        }
コード例 #2
0
        public void OnPerceptionReceived(object sender, EventArgsLibrary.PerceptionArgs e)
        {
            //PerceptionMonitor.PerceptionReceived();
            if (localWorldMap == null)
            {
                return;
            }
            if (localWorldMap.RobotId == e.RobotId)
            {
                //On ajoute les infos à la Local World Map
                localWorldMap.robotLocation         = e.Perception.robotKalmanLocation;
                localWorldMap.obstaclesLocationList = e.Perception.obstaclesLocationList;
                localWorldMap.ballLocationList      = e.Perception.ballLocationList;

                //On recopie les infos de la local World Map dans la structure de transfert (sans ce qui coute cher : heatmaps, lidarpoints...)
                LocalWorldMap transferLocalWorldMap = new LocalWorldMap();
                transferLocalWorldMap.RobotId               = localWorldMap.RobotId;
                transferLocalWorldMap.TeamId                = localWorldMap.TeamId;
                transferLocalWorldMap.robotLocation         = localWorldMap.robotLocation;
                transferLocalWorldMap.destinationLocation   = localWorldMap.destinationLocation;
                transferLocalWorldMap.waypointLocation      = localWorldMap.waypointLocation;
                transferLocalWorldMap.robotGhostLocation    = localWorldMap.robotGhostLocation;
                transferLocalWorldMap.robotRole             = localWorldMap.robotRole;
                transferLocalWorldMap.ballHandlingState     = localWorldMap.ballHandlingState;
                transferLocalWorldMap.messageDisplay        = localWorldMap.messageDisplay;
                transferLocalWorldMap.playingSide           = localWorldMap.playingSide;
                transferLocalWorldMap.obstaclesLocationList = localWorldMap.obstaclesLocationList;
                transferLocalWorldMap.ballLocationList      = localWorldMap.ballLocationList;

                if (transferLocalWorldMap.robotLocation != null)
                {
                    var s = ZeroFormatterSerializer.Serialize <WorldMap.ZeroFormatterMsg>(transferLocalWorldMap);

                    OnMulticastSendLocalWorldMapCommand(s);                          //Envoi à destination des autres robots en multicast

                    OnLocalWorldMapToGlobalWorldMapGenerator(transferLocalWorldMap); //Envoi à destination du robot lui même en direct

                    OnLocalWorldMapForDisplayOnly(localWorldMap);                    //Pour affichage uniquement, sinon transmission radio en, multicast

                    //LWMEmiseMonitoring.LWMEmiseMonitor(s.Length);
                }
            }
        }
コード例 #3
0
        //public void OnPhysicalPositionReceived(object sender, EventArgsLibrary.LocationArgs e)
        //{
        //    if (localWorldMap == null)
        //        return;
        //    if (robotId == e.RobotId)
        //    {
        //        localWorldMap.robotLocation = e.Location;
        //        OnLocalWorldMap(robotId, localWorldMap);
        //    }
        //}

        public void OnPerceptionReceived(object sender, EventArgsLibrary.PerceptionArgs e)
        {
            if (localWorldMap == null)
            {
                return;
            }
            if (RobotId == e.RobotId)
            {
                localWorldMap.robotLocation         = e.Perception.robotLocation;
                localWorldMap.obstaclesLocationList = e.Perception.obstaclesLocationList;
                //localWorldMap.opponentLocationList = e.Perception.opponentLocationList;
                //localWorldMap.obstacleLocationList = e.Perception.obstacleLocationList;
                localWorldMap.ballLocation = e.Perception.ballLocation;

                if (localWorldMap.robotLocation != null)
                {
                    OnLocalWorldMap(localWorldMap);
                }
            }
        }