AForge.Robotics.Surveyor.SRV1.EnableFailsafeMode C# (CSharp) Method

EnableFailsafeMode() public method

Enables fail safe mode - setting motors' speed after timeout.

In the case if fail safe mode is enabled and no commands are received by SRV-1 robot withing 2 seconds, motors' speed will be set to the specified values. The command is very useful to instruct robot to stop if no other commands were sent within 2 last seconds (probably lost connection).

public EnableFailsafeMode ( int leftSpeed, int rightSpeed ) : void
leftSpeed int Left motor's speed, [-127, 127].
rightSpeed int Right motor's speed, [-127, 127].
return void
        public void EnableFailsafeMode( int leftSpeed, int rightSpeed )
        {
            // check limits
            if ( leftSpeed == -128 )
                leftSpeed = -127;
            if ( rightSpeed == -128 )
                rightSpeed = -127;

            Send( new byte[] { (byte) 'F', (byte) leftSpeed, (byte) rightSpeed } );
        }