Пример #1
0
        public Form1()
        {
            InitializeComponent();

            // start a new instance of the xbox one controller
            xb1c = new XInputController();

            // if there is a connection then update the current values
            if (xb1c.connected)
            {
                base_val     = xb1c.leftThumb.X;
                shoulder_val = xb1c.leftThumb.Y;
                elbow_val    = xb1c.rightThumb.Y;
                gripper_val  = xb1c.rightThumb.X;
            }
            else
            {
                MessageBox.Show(this, "The Xbox One controller did not connect properly.\n", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            //init xbees
            comms = new Comms(THIS_ID);
            comms.InitConnection(TransportProtocol.ZIGBEE_LINK, "COM3", "", 57600);
            comms.AddAddress(UGV_ID, "0013A20040917A31", 0);
            comms.LinkCallback(new NGCP.ArmPosition(0, 0, 0, 0), new CallBack(ArmPositionCallBack));
            comms.LoadKey("NGCP Project 2016");
            comms.Run();
            // set timer event to start reading and updating from the controller
            timer1.Start();
        }
Пример #2
0
        public Form1()
        {
            InitializeComponent();

            // start a new instance of the xbox one controller
            xb1c = new XInputController();

            // if there is a connection then update the current values
            if (xb1c.connected)
            {
                base_val     = xb1c.leftThumb.X;
                shoulder_val = xb1c.leftThumb.Y;
                elbow_val    = xb1c.rightThumb.Y;
                gripper_val  = xb1c.rightThumb.X;
            }
            else
            {
                MessageBox.Show(this, "The Xbox One controller did not connect properly.\n", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            // set timer event to start reading and updating from the controller
            timer1.Start();
        }