Property | Type | Description | |
---|---|---|---|
CommunicationThread | void | ||
DiscardIncomingData | void | ||
Reconnect | void |
Method | Description | |
---|---|---|
Connect ( string ip, int port ) : void |
Connect to SRV-1 Blackfin robot/camera. The method establishes connection to SRV-1 Blackfin robot/camera. If it succeeds then other methods can be used to manipulate the robot. |
|
ControlMotors ( MotorCommand command ) : void |
Control SRV-1 robot's motors using predefined commands. |
|
ControlServos ( int leftServo, int rightServo ) : void |
Direct servos control of SRV-1 robot. Servo settings represent timing pulse widths ranging from 1ms to 2ms. 0 corresponds to a 1ms pulse, 100 corresponds to a 2ms pulse, and 50 is midrange with a 1.5ms pulse. |
|
DisableFailsafeMode ( ) : void |
Disable fail safe mode. The method disable fail safe mode, which was set using EnableFailsafeMode method. |
|
Disconnect ( ) : void |
Disconnect from SRV-1 Blackfin robot. The method disconnects from SRV-1 robot making all other methods unavailable (except Connect method). In the case if user obtained instance of camera using GetCamera method, the video will be stopped automatically (and those SRV1Camera instances should be discarded). |
|
EnableFailsafeMode ( int leftSpeed, int rightSpeed ) : void |
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). |
|
FlipVideo ( bool isFlipped ) : void |
Flip video capture or not (for use with upside-down camera).
|
|
GetCamera ( ) : |
Get camera object for the SRV-1 Blackfin robot/camera. The method provides an instance of SRV1Camera, which can be used for receiving continuous video frames from the SRV-1 Blackfin camera. In the case if only one image is required, the GetImage method can be used. Sample usage: // get SRV-1 camera SRV1Camera camera = srv.GetCamera( ); // set NewFrame event handler camera.NewFrame += new NewFrameEventHandler( video_NewFrame ); // start the video source camera.Start( ); // ... private void video_NewFrame( object sender, NewFrameEventArgs eventArgs ) { // get new frame Bitmap bitmap = eventArgs.Frame; // process the frame } |
|
GetImage ( ) : |
Get single image from the SRV-1 Blackfin camera. The method provides single video frame retrieved from the SRV-1 Blackfin camera. However in many cases it is required to receive video frames one after another, so the GetCamera method is more preferred for continuous video frames. |
|
GetRunningTime ( ) : long |
Get SRV-1 running time.
|
|
GetVersion ( ) : string |
Get SRV-1 firmware version string.
|
|
I2CReadByte ( byte deviceID, byte register ) : byte |
Read byte from I2C device.
|
|
I2CReadWord ( byte deviceID, byte register ) : ushort |
Read word from I2C device.
|
|
I2CWriteByte ( byte deviceID, byte register, byte byteToWrite ) : void |
Write byte to I2C device.
|
|
I2CWriteWord ( byte deviceID, byte register, byte firstByteToWrite, byte secondByteToWrite ) : void |
Write two bytes to I2C device.
|
|
RunMotors ( int leftSpeed, int rightSpeed, int duration ) : void |
Run motors connected to SRV-1 robot. The method provides direct access to motors setting specified, speed to both motors connected to the SRV-1 robot. The maximum absolute speed equals to 127, but the sign specifies direction of motor's rotation (forward or backward). |
|
SRV1 ( ) : System |
Initializes a new instance of the SRV1 class.
|
|
Send ( byte request ) : void |
Enqueue communication request. The method puts specified command into communication queue and leaves immediately. Once internal communication thread becomes free from sending/receiving previous commands/replies, it will send the queued command. The method is useful for those SRV-1 commands, which does not assume any response data in the command's reply. |
|
SendAndReceive ( byte request, byte responseBuffer ) : int |
Enqueue communication request and wait for reply. The method puts specified command into communication queue and waits until the command is sent to SRV-1 Blackfin robot and reply is received. |
|
SetQuality ( int quality ) : void |
Set video quality. The method sets video quality, which is specified in [1, 8] range - 1 is the highest quality level, 8 is the lowest quality level. |
|
SetResolution ( VideoResolution resolution ) : void |
Set video resolution. |
|
StopMotors ( ) : void |
Stop both motors. The method stops both motors connected to the SRV-1 robot by calling RunMotors method specifying 0 for motors' speed. |
|
UltrasonicPing ( ) : float[] |
Ping ultrasonic ranging modules. The method sends 'p' SRV-1 command (see SRV-1 Control Protocol), which gets values from ultrasonic ranging modules attached to pins 27, 28, 29, 30 with trigger on pin 18. Supports Maxbotics EZ0 and EZ1 ultrasonic modules. |
Method | Description | |
---|---|---|
CommunicationThread ( ) : void | ||
DiscardIncomingData ( Socket socket, |
||
Reconnect ( ) : void |
public Connect ( string ip, int port ) : void | ||
ip | string | IP address of SRV-1 robot. |
port | int | Port number to connect to. |
return | void |
public ControlMotors ( MotorCommand command ) : void | ||
command | MotorCommand | Motor command to send to the SRV-1 Blackfin robot. |
return | void |
public ControlServos ( int leftServo, int rightServo ) : void | ||
leftServo | int | Left servo setting, [0, 100]. |
rightServo | int | Right servo setting, [0, 100]. |
return | void |
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 FlipVideo ( bool isFlipped ) : void | ||
isFlipped | bool | Specifies if video should be flipped ( |
return | void |
public I2CReadByte ( byte deviceID, byte register ) : byte | ||
deviceID | byte | I2C device ID (7 bit notation). |
register | byte | I2C device register to read. |
return | byte |
public I2CReadWord ( byte deviceID, byte register ) : ushort | ||
deviceID | byte | I2C device ID (7 bit notation). |
register | byte | I2C device register to read. |
return | ushort |
public I2CWriteByte ( byte deviceID, byte register, byte byteToWrite ) : void | ||
deviceID | byte | I2C device ID (7 bit notation). |
register | byte | I2C device register to write to. |
byteToWrite | byte | Byte to write to the specified register of the specified device. |
return | void |
public I2CWriteWord ( byte deviceID, byte register, byte firstByteToWrite, byte secondByteToWrite ) : void | ||
deviceID | byte | I2C device ID (7 bit notation). |
register | byte | I2C device register to write to. |
firstByteToWrite | byte | First byte to write to the specified register of the specified device. |
secondByteToWrite | byte | Second byte to write to the specified register of the specified device. |
return | void |
public RunMotors ( int leftSpeed, int rightSpeed, int duration ) : void | ||
leftSpeed | int | Left motor's speed, [-127, 127]. |
rightSpeed | int | Right motor's speed, [-127, 127]. |
duration | int | Time duration to run motors measured in number /// of 10 milliseconds (0 for infinity), [0, 255]. |
return | void |
public Send ( byte request ) : void | ||
request | byte | Array of bytes (command) to send to SRV-1 Blackfin robot/camera. |
return | void |
public SendAndReceive ( byte request, byte responseBuffer ) : int | ||
request | byte | Array of bytes (command) to send to SRV-1 Blackfin robot/camera. |
responseBuffer | byte | Buffer to read response into. |
return | int |
public SetQuality ( int quality ) : void | ||
quality | int | Video quality to set, [1, 8]. |
return | void |
public SetResolution ( VideoResolution resolution ) : void | ||
resolution | VideoResolution | Video resolution to set. |
return | void |