Esempio n. 1
0
        public void update(Environment env, List <Robot> robots, CollisionManager cm)
        {
            bool hitRobot;

            offsetx = Math.Cos(owner.heading + delta_theta) * delta_r;
            offsety = Math.Sin(owner.heading + delta_theta) * delta_r;
            Point2D         location = new Point2D(offsetx + owner.location.x, offsety + owner.location.y);
            SimulatorObject hit;

            distance = cm.Raycast(angle, max_range, location, owner, out hit);

            if (hit is Robot)
            {
                seeRobot = true;
            }
            else
            {
                seeRobot = false;
            }
            //apply sensor noise

            /*
             * if(noise>0.0) {
             *      distance*= 1.0 + (noise * (owner.rng.NextDouble()-0.5)*2.0);
             *      if(distance>max_range)
             *              distance=max_range;
             *      if(distance<0.0)
             *              distance=0.0;
             * }
             */
            Debug.Assert(!Double.IsNaN(distance), "NaN in inputs");
        }
Esempio n. 2
0
		public void update(Environment env, List<Robot> robots,CollisionManager cm)
		{
			bool hitRobot;
            offsetx = Math.Cos(owner.heading+delta_theta)*delta_r;
			offsety = Math.Sin(owner.heading+delta_theta)*delta_r;
			Point2D location = new Point2D(offsetx + owner.location.x, offsety + owner.location.y);
			SimulatorObject hit;			
			distance = cm.Raycast(angle,max_range,location,owner,out hit);

			if (hit is Robot) {
				seeRobot=true;			
			}
			else {
				seeRobot=false;
			}
			//apply sensor noise
			/*
			if(noise>0.0) {
				distance*= 1.0 + (noise * (owner.rng.NextDouble()-0.5)*2.0);				
				if(distance>max_range)
					distance=max_range;
				if(distance<0.0)
					distance=0.0;
			}
			*/
            Debug.Assert(!Double.IsNaN(distance), "NaN in inputs");
		}