C# Class CyrusBuilt.MonoPi.Components.Servos.GenericServo

A component that is an abstraction of a servo device. This is an implementation of CyrusBuilt.MonoPi.Components.Servos.Servo.
Inheritance: Servo
Afficher le fichier Open project: cyrusbuilt/MonoPi

Méthodes publiques

Méthode Description
CalcEndPointPwmDuration ( ServoOrientation orientation ) : float

Calculates end point PWM duration for the specified servo orientation.

CalcNeutralPwmDuration ( ) : float

Calculates the duration of the neutral pwm.

CalcPwmDuration ( float pos ) : Int32

Calculates the PWM duration.

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Call Dispose when you are finished using the CyrusBuilt.MonoPi.Components.Servos.GenericServo. The Dispose method leaves the CyrusBuilt.MonoPi.Components.Servos.GenericServo in an unusable state. After calling Dispose, you must release all references to the CyrusBuilt.MonoPi.Components.Servos.GenericServo so the garbage collector can reclaim the memory that the CyrusBuilt.MonoPi.Components.Servos.GenericServo was occupying.

GenericServo ( IServoDriver driver, String name ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.Components.Servos.GenericServo class with the servo driver and name. This overload will use default property values.

GenericServo ( IServoDriver driver, String name, String>.Dictionary props ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.Components.Servos.GenericServo class with the servo driver, name, and properties.

SetProperty ( String key, String value ) : void

Sets the value of the specified property. If the property does not already exist in the property collection, it will be added. Once set, the servo will re-initialize using the new property values.

ToString ( ) : String

Returns a System.String that represents the current CyrusBuilt.MonoPi.Components.Servos.GenericServo.

Méthodes protégées

Méthode Description
Init ( ) : void

Initializes the servo.

Private Methods

Méthode Description
ValidateEndPoint ( float endpoint, String propName ) : void

Validates the specified end point. If the end point is invalid an ArgumentOutOfRangeException is thrown.

ValidatePosition ( float pos ) : void

Validates the specified position value. If the position is invalid, then an ArgumentOutOfRangeException is thrown.

ValidateSubTrim ( float subtrim, String propName ) : void

Validates the specified subtrim value. If the subtrim is invalid, then an ArgumentOutOfRangeException is thrown.

Method Details

CalcEndPointPwmDuration() public méthode

Calculates end point PWM duration for the specified servo orientation.
/// An unsupported orientation was specified. /// /// The end point property value is not between /// /// and . ///
public CalcEndPointPwmDuration ( ServoOrientation orientation ) : float
orientation ServoOrientation /// The servo orientation. ///
Résultat float

CalcNeutralPwmDuration() public méthode

Calculates the duration of the neutral pwm.
/// The subtrim property value is not within the acceptable range (SUBTRIM_MAX_LEFT /// and SUBTRIM_MAX_RIGHT). ///
public CalcNeutralPwmDuration ( ) : float
Résultat float

CalcPwmDuration() public méthode

Calculates the PWM duration.
public CalcPwmDuration ( float pos ) : Int32
pos float /// Position value between -100 and +100%. ///
Résultat System.Int32

Dispose() public méthode

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Call Dispose when you are finished using the CyrusBuilt.MonoPi.Components.Servos.GenericServo. The Dispose method leaves the CyrusBuilt.MonoPi.Components.Servos.GenericServo in an unusable state. After calling Dispose, you must release all references to the CyrusBuilt.MonoPi.Components.Servos.GenericServo so the garbage collector can reclaim the memory that the CyrusBuilt.MonoPi.Components.Servos.GenericServo was occupying.
public Dispose ( ) : void
Résultat void

GenericServo() public méthode

Initializes a new instance of the CyrusBuilt.MonoPi.Components.Servos.GenericServo class with the servo driver and name. This overload will use default property values.
public GenericServo ( IServoDriver driver, String name ) : System
driver IServoDriver /// The servo driver to use. ///
name String /// The name of this servo. ///
Résultat System

GenericServo() public méthode

Initializes a new instance of the CyrusBuilt.MonoPi.Components.Servos.GenericServo class with the servo driver, name, and properties.
/// The specified end point property value is not between /// /// and . /// - or - /// The specified subtrim property value is not between /// /// and . ///
public GenericServo ( IServoDriver driver, String name, String>.Dictionary props ) : System
driver IServoDriver /// The servo driver to use. ///
name String /// The name of this servo. ///
props String>.Dictionary /// A dictionary containing servo properties. ///
Résultat System

Init() protected méthode

Initializes the servo.
/// The specified end point property value is not between /// /// and . /// - or - /// The specified subtrim property value is not between /// /// and . ///
protected Init ( ) : void
Résultat void

SetProperty() public méthode

Sets the value of the specified property. If the property does not already exist in the property collection, it will be added. Once set, the servo will re-initialize using the new property values.
public SetProperty ( String key, String value ) : void
key String /// The property name (key). ///
value String /// The value to assign to the property. ///
Résultat void

ToString() public méthode

Returns a System.String that represents the current CyrusBuilt.MonoPi.Components.Servos.GenericServo.
public ToString ( ) : String
Résultat String