C# 클래스 AForge.Robotics.TeRK.Qwerk.Servos

Provides access to Qwerk's servos' controllers.

The class allows to manipulate Qwerk's servos. The total number of available servos equals to Servos.Count.

Each servo has logical and physical positions, which may or may not be equal. Both positions may vary in the [0, 255] range. Physical and logical positions are equal, when servo's physical moving bound (range) is set to [0, 255] (see SetBound). In this case setting servo's logical position with SetPosition method results in servo's physical moving in the [0, 255] range. However, of physical bound is set to [10, 20], for example, then physically the servo will move only in this range. But logical position is still may be set in [0, 255] range, which is mapped to physical range.

Sample usage:

// get Qwerk's servos service Qwerk.Servos servos = qwerk.GetServosService( ); // stop all servos servos.StopServos( ); // set 0th servo's bounds servos.SetBound( 0, new IntRange( 10, 100 ) ); // set servo's position servos.SetPosition( 0, 50 ); // ... // get 0th servo's position int currentPosition = servos.GetPosition( 0 );
파일 보기 프로젝트 열기: holisticware-admin/MonoVersal.AForgeNET 1 사용 예제들

공개 메소드들

메소드 설명
GetBound ( int servo ) : IntRange

Get bounds for the specified servo.

GetBounds ( ) : AForge.IntRange[]

Get bounds of all servos.

GetPosition ( int servo ) : int

Get current position of a single servo.

GetPositions ( ) : int[]

Get current positions of all servos.

Servos ( AForge.Robotics.TeRK.Qwerk qwerk )

Initializes a new instance of the Qwerk.Servos class.

SetBound ( int servo, IntRange bound ) : void

Set bounds for the specified servo.

The method sets servo's physical bounds in which it may move. See documentation to Qwerk.Servos for clarification.

SetBounds ( bool mask, IntRange bounds ) : void

Set bounds for specified servos.

The method sets servos' physical bounds in which they may move. See documentation to Qwerk.Servos for clarification.

SetPosition ( int servo, int position ) : int

Set position of a single servo.

The method sets position of single Qwerk's servo, which index is specified. It is preferred to use SetPositions for setting positions of multiple servos, which does it at once.

SetPositions ( bool mask, int positions ) : int[]

Set positions of specified servos.

The mask and positions arrays specify which Qwerk's servo's state should be updated. If value of the mask array is set to , then corresponding servo's state is changed to the state, which is specified in positions array.

StopServo ( int servo ) : int

Stop specified servo.

StopServos ( ) : int[]

Stop all servos.

StopServos ( bool mask ) : int[]

Stop specified servos.

The mask array specifies which Qwerk's servo need to be stopped. If value of the mask array is set to , then corresponding servo is stopped.

비공개 메소드들

메소드 설명
CreateCommand ( ) : TeRK.ServoCommand

메소드 상세

GetBound() 공개 메소드

Get bounds for the specified servo.
Invalid servo is specified. No connection to Qwerk or its service. Connestion to Qwerk is lost.
public GetBound ( int servo ) : IntRange
servo int Servo to get bounds for, [0, ).
리턴 AForge.IntRange

GetBounds() 공개 메소드

Get bounds of all servos.
No connection to Qwerk or its service. Connestion to Qwerk is lost.
public GetBounds ( ) : AForge.IntRange[]
리턴 AForge.IntRange[]

GetPosition() 공개 메소드

Get current position of a single servo.
Invalid servo is specified. No connection to Qwerk or its service. Connestion to Qwerk is lost.
public GetPosition ( int servo ) : int
servo int Servo to get position for, [0, ).
리턴 int

GetPositions() 공개 메소드

Get current positions of all servos.
No connection to Qwerk or its service. Connestion to Qwerk is lost.
public GetPositions ( ) : int[]
리턴 int[]

Servos() 공개 메소드

Initializes a new instance of the Qwerk.Servos class.
The passed reference to object is not connected to /// Qwerk board. Failed connecting to the requested service. Failed accessing to the requested service.
public Servos ( AForge.Robotics.TeRK.Qwerk qwerk )
qwerk AForge.Robotics.TeRK.Qwerk Reference to object, which is connected to Qwerk board.

SetBound() 공개 메소드

Set bounds for the specified servo.

The method sets servo's physical bounds in which it may move. See documentation to Qwerk.Servos for clarification.

Invalid servo is specified. No connection to Qwerk or its service. Connestion to Qwerk is lost.
public SetBound ( int servo, IntRange bound ) : void
servo int Servo to set bounds for, [0, ).
bound AForge.IntRange Bounds to set for the specified servo.
리턴 void

SetBounds() 공개 메소드

Set bounds for specified servos.

The method sets servos' physical bounds in which they may move. See documentation to Qwerk.Servos for clarification.

Incorrect length of , /// or array. No connection to Qwerk or its service. Connestion to Qwerk is lost.
public SetBounds ( bool mask, IntRange bounds ) : void
mask bool Mask array specifying which servos need to be set.
bounds AForge.IntRange Array of servos' bounds. Each bound may be in [0, 255] range.
리턴 void

SetPosition() 공개 메소드

Set position of a single servo.

The method sets position of single Qwerk's servo, which index is specified. It is preferred to use SetPositions for setting positions of multiple servos, which does it at once.

Invalid servo is specified. No connection to Qwerk or its service. Connestion to Qwerk is lost.
public SetPosition ( int servo, int position ) : int
servo int Servo to set position for, [0, ).
position int Position to set for the specified servo, [0, 255].
리턴 int

SetPositions() 공개 메소드

Set positions of specified servos.

The mask and positions arrays specify which Qwerk's servo's state should be updated. If value of the mask array is set to , then corresponding servo's state is changed to the state, which is specified in positions array.

Incorrect length of or /// array. No connection to Qwerk or its service. Connestion to Qwerk is lost.
public SetPositions ( bool mask, int positions ) : int[]
mask bool Mask array specifying which servos need to be set.
positions int Array of servos' positions to set. Each position is in [0, 255] range.
리턴 int[]

StopServo() 공개 메소드

Stop specified servo.
Invalid servo is specified. No connection to Qwerk or its service. Connestion to Qwerk is lost.
public StopServo ( int servo ) : int
servo int Servo to stop, [0, ).
리턴 int

StopServos() 공개 메소드

Stop all servos.
No connection to Qwerk or its service. Connestion to Qwerk is lost.
public StopServos ( ) : int[]
리턴 int[]

StopServos() 공개 메소드

Stop specified servos.

The mask array specifies which Qwerk's servo need to be stopped. If value of the mask array is set to , then corresponding servo is stopped.

Incorrect length of array. No connection to Qwerk or its service. Connestion to Qwerk is lost.
public StopServos ( bool mask ) : int[]
mask bool Mask array specifying which servos need to stop.
리턴 int[]