AForge.NET

Testimonials
Features
Samples
Tools
Documentation
License
Downloads
Sources
Discussions
Partners
Projects
Members
Donate

AForge.NET Framework
2.2.5 version is available!

Surveyor Robotics

AForge.NET framework provides set of classes allowing manipulation of different Surveyor's robotics kits.

SRV-1 Blackfin robot
SRV-1 Blackfin robot
The SRV1 class allows to control Surveyor's SRV-1 Blackfin robot providing access to its video feed, motors, servos, ultrasonic modules. Also it allows to send commands directly to the robot, which are defined by SRV-1 Control Protocol.

// connect to SRV-1 robot
SRV1 srv = new SRV1( );
srv.Connect( "169.254.0.10", 10001 );
// set video properties
srv.SetQuality( 7 );
srv.SetResolution( SRV1.VideoResolution.Small );
srv.FlipVideo( false );
// run motors
srv.RunMotors( 50, 50, 0 );
// run predefined motor' command
srv.ControlMotors( SRV1.MotorCommand.DriftRight );
// stop
srv.StopMotors( );
// get version
string version = srv.GetVersion( );
// get running time (ms)
long runningTime = srv.GetRunningTime( );

// send direct command - turn on lasers
srv.Send( new byte[] { (byte) 'l' } );
// get single image from the robot's camera
Bitmap image = srv.GetImage( );

// get continuous video feed
SRV1Camera camera = srv.GetCamera( );
camera.NewFrame += new NewFrameEventHandler( video_NewFrame );
camera.Start( );

...

private void video_NewFrame( object sender,
                             NewFrameEventArgs eventArgs )
{
    // get new frame
    Bitmap bitmap = eventArgs.Frame;
    // process the frame
}

Stereo Vision System
Stereo Vision System
Similar to the above, the SVS class allows to control Surveyor's Stereo Vision System board providing access to its both cameras, motors, servos, ultrasonic modules. Also it allows to send commands directly to the board, which are defined by SRV-1 Control Protocol.

// connect to SVS board
SVS svs = new SVS( );
svs.Connect( "169.254.0.10" );
// set video properties
svs.SetQuality( 7 );
svs.SetResolution( SRV1.VideoResolution.Small );
svs.FlipVideo( false );
// run motors
svs.RunMotors( 50, 50, 0 );
// run predefined motor' command
svs.ControlMotors( SRV1.MotorCommand.DriftRight );
// stop
svs.StopMotors( );
// send direct command to the first (left) SRV-1
svs.GetDirectAccessToSRV1( SVS.Camera.Left ).Send(
    new byte[] { (byte) 'y' } );
// get single image from the left camera
Bitmap image = svs.GetImage( SVS.Camera.Left );

// get continuous video feed from the right camera
SRV1Camera camera = svs.GetCamera( SVS.Camera.Right );
camera.NewFrame += new NewFrameEventHandler( video_NewFrame );
camera.Start( );

...

private void video_NewFrame( object sender,
                             NewFrameEventArgs eventArgs )
{
    // get new frame
    Bitmap bitmap = eventArgs.Frame;
    // process the frame
}

Check the next article for additional information about Surveyor SVS board: Starting with Surveyor's Stereo Vision System board.