public KeyInputController(MotorManager motorManager, PositionCalculator positionCalculator)
 {
     this.positionCalculator = positionCalculator;
     this.motorManager = motorManager;
     //You can attach yourself to listen to the motors:
     //motorManager.addListener(this);
 }
Esempio n. 2
0
 public Motorcycle()
 {
     manager = new MotorManager();
     InitializeComponent();
     panelSide.Hide();
     panelButton.Enabled = true;
     panelInput.Enabled  = false;
     refreshDataGrid();
 }
Esempio n. 3
0
 public Linker(Viewport3D viewport)
 {
     //Now initialise the display!
     motorManager = new MotorManager();
     Robot robot = new Robot();
     platform = new ViewPlatform(viewport, motorManager, robot);
     positionCalculator = new PositionCalculator(robot, motorManager);
     keyController = new KeyInputController(motorManager, positionCalculator);
 }
Esempio n. 4
0
 /// <summary>
 /// Create a new Portable object. This class is designed specifically to be imported by other solutions. By calling this constructor,
 /// the class will provide you with a robot which appears on the screen. Calling the methods in this class will change the appearance
 /// of the robot on screen as well. You can use methods for setting degrees in this class with the normal 360 fashion too.
 /// Note: you must call "setCameraToListenToKeys" to be able to move the camera with the keyboard. Otherwise the camera
 /// can't know when to move.
 /// </summary>
 /// <param name="viewport">The viewport to use for displaying the robot.</param>
 public Portable(Viewport3D viewport)
 {
     //Now initialise the display!
     motorManager = new MotorManager();
     robot = new Robot();
     platform = new ViewPlatform(viewport, motorManager, robot);
     positionCalculator = new PositionCalculator(robot, motorManager);
     updateMotors();
 }
Esempio n. 5
0
        public KeuanganUI()
        {
            InitializeComponent();
            order            = new OrderBy();
            managerMotor     = new MotorManager();
            managerTransaksi = new TransaksiManager();

            monthBox.Text      = "Bulan";
            monthBox.ForeColor = Color.Silver;
        }
Esempio n. 6
0
 /// <summary>
 /// Create a new Portable object. This class is designed specifically to be imported by other solutions. By calling this constructor,
 /// the class will provide you with a robot which does not appear on a display, but otherwise works in the same way.
 /// You can set motor degrees through this class in the normal 360 fashion too.
 /// </summary>
 public Portable()
 {
     //Now initialise the display!
     motorManager = new MotorManager();
     robot = new Robot();
     robot.intialise(new Viewport3D());
     //Add myself as a listener for the motor manager:
     motorManager.addListener(this);
     platform = new ViewPlatform(new Viewport3D(), motorManager, robot);
     positionCalculator = new PositionCalculator(robot, motorManager);
     updateMotors();
 }
Esempio n. 7
0
        public bool Connect()
        {
            try
            {
                motorManager = MotorManager.getInstance();
                if (motorManager.Open() && motorManager.GoToHome(GlobalVariables.motorSettings.HomingBuffer))
                {
                    if (GlobalVariables.motorSettings.UseSimulator)
                    {
                        XInPosition = true;
                        YInPosition = true;
                        ZInPosition = true;
                    }
                    motorManager.MotorStateChanged    += OnMotorStateChanged;
                    motorManager.MotorPositionChanged += OnMotorPositionChanged;
                    motorManager.LaserStateChanged    += OnLaserStateChanged;
                    motorManager.LedStateChanged      += OnLedStateChanged;
                    motorManager.AxisLimitChanged     += OnAxisLimitChanged;

                    // initial motor profile after buffer homing finished
                    {
                        Thread.Sleep(200);
                        while (!XInPosition || !YInPosition || !ZInPosition)
                        {
                            Thread.Sleep(500);
                        }
                        InitialMotorProfile();

                        // move to saved ref position
                        Homing();
                    }

                    return(true);
                }
                else
                {
                    throw new Exception("Could not connect to motor manager");
                }
            }
            catch (Exception ex)
            {
                motorManager.Close();
                MessageBox.Show(ex.Message, "Error");
            }

            return(false);
        }
 //Requires the robot and the motor manager so that it can choose default positions for the motor
 //and use the robot's transformation matrices.
 public PositionCalculator(Robot robot, MotorManager motorManager)
 {
     this.motorManager = motorManager;
     this.robot = robot;
 }
 public AngleAdapter(Portable robot)
 {
     this.robot = robot;
     manager = robot.motors();
     posCalc = robot.positions();
 }
Esempio n. 10
-1
        private Robot robot; //the robot to display!

        #endregion Fields

        #region Constructors

        public ViewPlatform(Viewport3D viewport, MotorManager motorManager, Robot robot)
        {
            this.robot = robot;
            robot.intialise(viewport);
            this.motorManager = motorManager;
            //Add myself as a listener for the motor manager:
            this.motorManager.addListener(this);
            //Create a focussed camera to watch the origin:
            focussedCamera = new FocussedCamera(200, 0, 0);
            //Create the perspective camera!
            camera = getCamera(focussedCamera.Location, focussedCamera.Direction);
            viewport.Camera = camera;
            //Now to construct the light:
            light = getLight(Colors.White,focussedCamera.Direction);
            ModelVisual3D visual = new ModelVisual3D();
            visual.Content = light;
            viewport.Children.Add(visual);
            ModelVisual3D visual2 = new ModelVisual3D();
            //Now add in the robot too!
            updateMotors();
            outerModel = new Model3DGroup();
            outerModel.Children.Add(robot.getRobot());
            currentMatTransform = (MatrixTransform3D)MatrixTransform3D.Identity;
            TranslateTransform3D trans = new TranslateTransform3D();
            outerModel.Children[0] = Transforms.applyTransform((Model3DGroup)outerModel.Children[0],currentMatTransform);
            visual2.Content = outerModel;
            viewport.Children.Add(visual2);
            //Phew! That should be it...
            viewport.ClipToBounds = true;
        }