Esempio n. 1
0
 public C_Packet(C_Motor _mot, byte _instructionByte, List <byte> _lsParameters = null)
 {
     byteId                 = _mot.id;
     rotMotor               = _mot.rotMotor;
     returnStatusLevel      = _mot.StatusReturnLevel;
     byteInstructionOrError = _instructionByte;
     Par = _lsParameters;
 }
Esempio n. 2
0
 public void SYNC_WRITE_defaultMoveSpeed()
 {
     // write speed and goal position to 3 motors synchronously at once
     C_Motor.SEND_packetToAll(C_DynAdd.INS_SYNC_WRITE, new List <object> {
         C_DynAdd.GOAL_POS_L, 4,
         Yaw.id, Yaw.angleWanted.HexDefault, Yaw.speedWanted.HexDefault,
         Pitch.id, Pitch.angleWanted.HexDefault, Pitch.speedWanted.HexDefault,
         Roll.id, Roll.angleWanted.HexDefault, Roll.speedWanted.HexDefault
     });
 }
Esempio n. 3
0
        private void SET_motStringsFromRegister(C_Motor mot)
        {
            e_rot rot = mot.rotMotor;

            // show it as byte
            SET_motStrings(rot,
                           string.Format("0x{0:X2}=\t{0}", //{0,4:###0}",
                                         mot.Reg.GET(address, regByteType).Val
                                         ));
        }
Esempio n. 4
0
        // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        #endregion INIT
        // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        private void btnStartMotors_Click(object sender, RoutedEventArgs e)
        {
            foreach (C_Motor m in Ms)
            {
                UPDATE_motorFromSlider(m.rotMotor);
                //m.angle.Dec = 160;
                m.REGISTER_move();
            }
            C_Motor.ORDER_ActionToAll();
        }
Esempio n. 5
0
        public void INIT_individualMotors()
        {
            INIT_listElementsOfAllMotors();

            // Motor Yaw
            Yaw = new C_Motor(e_rot.yaw, 1,                                // id
                              new C_Value(C_Value.angleFull, 0, 360, 180), // angle
                              new C_Value(C_Value.speedFull, 0, 101, 20)   // speed
                              );
            // Motor Pitch
            Pitch = new C_Motor(e_rot.pitch, 2,                                // id
                                new C_Value(C_Value.angleFull, 111, 292, 200), // angle
                                new C_Value(C_Value.speedFull, 0, 101, 20)     // speed
                                );
            // Motor Roll
            Roll = new C_Motor(e_rot.roll, 3,                                 // id
                               new C_Value(C_Value.angleFull, 156, 248, 205), // angle
                               new C_Value(C_Value.speedFull, 0, 101, 20)     // speed
                               );

            //Yaw.SEND_example(0);
            //Pitch.SEND_example(0);
            //Roll.SEND_example(0);
        }
Esempio n. 6
0
        public void SEARCH_motors()
        {
            // not functional yet
            // should be in C_Motor
            // should use background worker

            // send pings and get responses - add items to [Ms] motor list
            // - use local Search motor for pinging and changing of id..
            byte     id    = C_DynAdd.ID_MIN;
            C_Motor  srchM = new C_Motor(id);
            C_Packet querryPacket;

            for (id = C_DynAdd.ID_MIN; id < C_DynAdd.ID_MAX; id++)
            {
                srchM.id = id;

                C_SPI.spi.DiscardInBuffer();

                srchM.ORDER_ping();

                querryPacket = new C_Packet(srchM, C_DynAdd.INS_PING);
                C_Packet.SEND_packet(querryPacket);
            }
        }