Ejemplo n.º 1
0
        private static void Main(string[] args)
        {
            // sudo docker run -it --rm --name tilt --privileged derungsapp/icarus.sensors.tilt.manualtests

            // test if this test is run on ARM64 and Linux (Nvidia Jetson Nano)
            Console.WriteLine($"This test runs on {RuntimeInformation.OSDescription} {RuntimeInformation.ProcessArchitecture}");
            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.ProcessArchitecture != Architecture.Arm64)
            {
                ConsoleHelper.WriteLine("This manual test is not supported on this machine. \n Please make sure to run the test on the actual device with the sensors wired. \n Press 'c' to continue in debug mode", ConsoleColor.Red);
                var key = Console.ReadKey();

                if (key.KeyChar != 'c')
                {
                    return;
                }
            }

#if !DEBUG
            var serviceCollection = new ServiceCollection();
            TiltModule.Initialize(serviceCollection);
            var serviceProvider = serviceCollection.BuildServiceProvider();
            var tiltSensor      = serviceProvider.GetService <ITiltSensor>();
#else
            ITiltSensor tiltSensor = null;
#endif


            TestTiltSensorFlat(tiltSensor, 5);
            TestTiltSensorFrontUp45Degrees(tiltSensor, 8);
            TestTiltSensorBackUp45Degrees(tiltSensor, 8);
            TestTiltSensorLeftSideUp45Degrees(tiltSensor, 8);
            TestTiltSensorRightSideUp45Degrees(tiltSensor, 8);
            TestTiltSensorRightSideUpWhileWheelie45Degrees(tiltSensor, 10);
        }
Ejemplo n.º 2
0
        public static void Initialize(IServiceCollection serviceCollection)
        {
            MotorModule.Initialize(serviceCollection);
            HallEffectModule.Initialize(serviceCollection);
            ObjectDetectionModule.Initialize(serviceCollection);
            TiltModule.Initialize(serviceCollection);
            TofModule.Initialize(serviceCollection);

            serviceCollection.AddSingleton <DeviceController>();
        }