AForge.Robotics.TeRK.Qwerk.Motors.SetMotorVelocity C# (CSharp) Метод

SetMotorVelocity() публичный Метод

Set velocity of specified motor.

The method sets specified motor's velocity, which is measured in ticks per second. "Ticks" is a made-up term, which does not depend on specific motor, but is an unknown in distance and rotation (see Qwerk documentation for details).

Invalid motor is specified. No connection to Qwerk or its service. Connestion to Qwerk is lost.
public SetMotorVelocity ( int motor, int velocity ) : void
motor int Motor to set velocity for, [0, ).
velocity int Velocity to set.
Результат void
            public void SetMotorVelocity( int motor, int velocity )
            {
                if ( ( motor < 0 ) || ( motor >= Count ) )
                {
                    throw new ArgumentOutOfRangeException( "Invalid motor is specified." );
                }

                // prepare command
                TeRKIceLib.MotorCommand command = CreateCommand( );

                command.motorMask[motor]          = true;
                command.motorModes[motor]         = TeRKIceLib.MotorMode.MotorSpeedControl;
                command.motorVelocities[motor]    = velocity;
                command.motorAccelerations[motor] = DefaultAcceleration;

                ExecuteCommand( command );
            }