Example #1
0
 public DriveService(IDriveAccountService accountService, SiteContext siteContext, DriveContext driveContext)
 {
     this.accountService = accountService;
     graph             = accountService.Graph;
     this.siteContext  = siteContext;
     this.driveContext = driveContext;
 }
 public VehicleModelRepository(DriveContext context, IMapper mapper, MapperConfiguration mapperConfiguration) : base(context)
 {
     _context             = context;
     dbSet                = _context.Set <VehicleModelEntity>();
     _mapper              = mapper;
     _mapperConfiguration = mapperConfiguration;
 }
        public AutonomousService(StateType initialStateType, GPS gate, int lrfPort, int fuckItGoForItCountDown, bool lrfTest = false)
        {
            this.driveContext   = new DriveContext(initialStateType, gate);
            this.ObstacleEvent += driveContext.HandleObstacleEvent;

            if (!lrfTest)
            {
                this.rocks_lrf_socket = new UdpClient(lrfPort);

                // Initialize async receive
                this.rocks_lrf_socket.BeginReceive(HandleSocketReceive, null);
            }
            else
            {
                this.plot = new Plot();
            }

            this.startTimeStamp         = DateTime.Now;
            this.fuckItGoForItCountDown = fuckItGoForItCountDown;
        }
Example #4
0
        public HomeController()
        {
            /*
             * DatabaseTarget target = new DatabaseTarget();
             * DatabaseParameterInfo param;
             * target.ConnectionStringName = "DriveContext";
             * target.DBDatabase = "DriveDB";
             * target.CommandText = "insert into LogEntries(Date, Level, Logger, Message) values(@Date, @Level, @Logger, @Message);";
             *
             * param = new DatabaseParameterInfo();
             * param.Name = "@Date";
             * param.Layout = "${Date}";
             * target.Parameters.Add(param);
             *
             * param = new DatabaseParameterInfo();
             * param.Name = "@Level";
             * param.Layout = "${Level}";
             * target.Parameters.Add(param);
             *
             * param = new DatabaseParameterInfo();
             * param.Name = "@Logger";
             * param.Layout = "${Logger}";
             * target.Parameters.Add(param);
             *
             * param = new DatabaseParameterInfo();
             * param.Name = "@Message";
             * param.Layout = "${Message}";
             * target.Parameters.Add(param);
             *
             * NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(target, LogLevel.Info);
             */

            context = new DriveContext();
            logger  = LogManager.GetCurrentClassLogger();
            logger.Info("Home Controller");
            context.SaveChanges();
        }
Example #5
0
 protected WriterBase(DriveContext driveContext, IMapper mapper) : base(driveContext, mapper)
 {
 }
Example #6
0
 public ContextWriter(DriveContext driveContext, IMapper mapper) : base(driveContext, mapper)
 {
 }
Example #7
0
 public DriveService(IDriveAccountService accountService, DriveContext driveContext)
 {
     _accountService = accountService;
     _graph          = accountService.Graph;
     _driveContext   = driveContext;
 }
 public DriveAccountService(DriveContext siteContext, TokenService tokenService)
 {
     this.SiteContext = siteContext;
     this.app         = tokenService.app;
     this.Graph       = tokenService.Graph;
 }
Example #9
0
 public SettingService(DriveContext context)
 {
     _context = context;
 }
Example #10
0
        public Line FindBestGap(Plot obstacles)
        {
            List <Region> regions = obstacles.Regions;

            double bestGapDistance = 0;
            Line   bestGap         = null;

            // Sanity check
            if (regions.Count == 0)
            {
                // Return Line representing gap straight in front of Ascent
                return(DriveContext.GapStraightInFront());
            }

            // Check first and last Region gaps (may be same Region if only one Region)
            Region firstRegion = regions.ElementAt(0);
            Region lastRegion  = regions.ElementAt(regions.Count - 1);

            // Check if leftmost Coordinate in the leftmost Region is on the right half of the entire FOV. If it is, make leftEdgeCoordinate where the
            // max-acceptable-range meets the left FOV line, since the FindClosestPointOnLine function return will cause errors for 180 degree FOV.
            Coordinate leftEdgeCoordinate = Line.FindClosestPointOnLine(DriveContext.LRF_LEFT_FOV_EDGE, firstRegion.StartCoordinate);

            if (firstRegion.StartCoordinate.X > 0)
            {
                leftEdgeCoordinate = new Coordinate(-AutonomousService.OBSTACLE_DETECTION_DISTANCE, 0, CoordSystem.Cartesian);
            }
            Line leftEdgeGap = new Line(leftEdgeCoordinate, firstRegion.StartCoordinate);

            // Check if rightmost Coordinate in the rightmost Region is on the left half of the entire FOV. If it is, make rightEdgeCoordinate where the
            // max-acceptable-range meets the right FOV line, since the FindClosestPointOnLine function return will cause errors for 180 degree FOV.
            Coordinate rightEdgeCoordinate = Line.FindClosestPointOnLine(DriveContext.LRF_RIGHT_FOV_EDGE, lastRegion.EndCoordinate);

            if (lastRegion.EndCoordinate.X < 0)
            {
                rightEdgeCoordinate = new Coordinate(AutonomousService.OBSTACLE_DETECTION_DISTANCE, 0, CoordSystem.Cartesian);
            }
            Line rightEdgeGap = new Line(rightEdgeCoordinate, lastRegion.EndCoordinate);

            // Check two possible edge gaps for bestGap
            Line bestEdgeGap = leftEdgeGap.Length > rightEdgeGap.Length ? leftEdgeGap : rightEdgeGap;

            if (bestEdgeGap.Length > DriveContext.ASCENT_WIDTH)
            {
                bestGap         = bestEdgeGap;
                bestGapDistance = bestEdgeGap.Length;
            }

            // Check all non-edge Regions for bestGap (only if there is more than 1 Region)
            for (int i = 0; i < regions.Count - 1; i++)
            {
                Region leftRegion  = regions.ElementAt(i);
                Region rightRegion = regions.ElementAt(i + 1);

                double gapDistance = Plot.GapDistanceBetweenRegions(leftRegion, rightRegion);

                // If gap distance is big enough for robot to fit and larger than current bestGapDistance
                if (gapDistance > DriveContext.ASCENT_WIDTH)
                {
                    if (gapDistance > bestGapDistance)
                    {
                        bestGapDistance = gapDistance;
                        bestGap         = new Line(leftRegion.EndCoordinate, rightRegion.StartCoordinate);
                    }
                }
            }

            return(bestGap);
        }
 public GenericRepository(DriveContext context)
 {
     _context = context;
     dbSet    = _context.Set <T>();
 }
Example #12
0
 public DriveAccountService(DriveContext siteContext, TokenService tokenService)
 {
     SiteContext = siteContext;
     _app        = tokenService.app;
     Graph       = tokenService.Graph;
 }
Example #13
0
 public UnitOfWork(DriveContext context)
 {
     _context = context;
 }
Example #14
0
 public UnitOfWork(DriveContext context, IRepositoryFactory factory)
 {
     _context           = context;
     _repositoryFactory = factory;
 }
Example #15
0
 public ReaderBase(DriveContext driveContext, IMapper mapper) : base(driveContext, mapper)
 {
 }
Example #16
0
 public ContextReader(DriveContext driveContext, IMapper mapper)
     : base(driveContext, mapper)
 {
 }
Example #17
0
 protected DbHandlerBase(DriveContext driveContext, IMapper mapper)
 {
     this.DriveContext = driveContext;
     this.Mapper       = mapper;
 }