Class: PhidgetsNative::AdvancedServo
- Inherits:
-
Device
- Object
- Device
- PhidgetsNative::AdvancedServo
- Defined in:
- ext/phidgets_native/advancedservo_ruby.c,
ext/phidgets_native/advancedservo_ruby.c
Overview
This class is a stub, and is currently in need of an actual implementation. Nonetheless, all of the methods from its parent class PhidgetsNative::Device are available.
Instance Method Summary collapse
-
#acceleration(Fixnumindex, Floatvalue = nil) ⇒ Float
If a value is passed, the acceleration of a servo is set to the specified value at the provided index.
-
#acceleration_max ⇒ Array
Returns an array of Floats which specify the maximum acceleration value that can be configured on each servo, or nil if the device has yet to be connected.
-
#acceleration_min ⇒ Array
Returns an array of Floats which specify the minimum acceleration value that can be configured on each servo, or nil if the device has yet to be connected.
-
#currents ⇒ Array
Returns an array of Floats which represent the current draw of each servo attached to the system, or nil if the device is disconnected.
-
#engaged(Fixnumindex, Boolean) ⇒ Boolean
Sets the “engagement” of the servo at the provided index.
-
#engaged?(Fixnumindex) ⇒ Boolean
Returns either true or false, depending on whether the servo at the provided index is engaged (aka - whether the motor is powered or not).
-
#new(serial_number) ⇒ Object
constructor
All phidget objects are created from the device serial number.
-
#motor_count ⇒ Fixnum
Returns an integer which represents the number of motor interfaces provided by this advanced servo controller, or nil if the device has yet to be connected.
-
#position(Fixnumindex, Floatvalue = nil) ⇒ Float
Sets the servo position of the servo at the provided index.
-
#position_max(Fixnumindex, Floatvalue = nil) ⇒ Float
If a value is passed, the position_max of a servo is set to the specified value at the provided index.
-
#position_min(Fixnumindex, Floatvalue = nil) ⇒ Float
If a value is passed, the position_min of a servo is set to the specified value at the provided index.
-
#positions ⇒ Array
Returns an array of Floats which represent the positions of each servo attached to the system, or nil if the device has yet to be connected.
-
#sample_rates ⇒ Array
The advancedservo object tracks the sample rate of each servo individually.
-
#servo_parameters(Fixnumindex, Floatmin_us, Floatmax_us, Floatdegrees, Floatvelocity_max) ⇒ Qnil
Sets the “servo parameters” of the servo at the provided index.
-
#servo_type(Fixnumindex, Floatvalue = nil) ⇒ Symbol
If a value is passed, the type of servo is set to the specified value at the provided index.
-
#speed_ramping(Fixnumindex, Boolean) ⇒ Boolean
Sets the “speed ramping” of the servo at the provided index.
-
#speed_ramping?(Fixnumindex) ⇒ Boolean
Returns either true or false, depending on whether the servo at the provided index is configured to speed ramp.
-
#stopped?(Fixnumindex) ⇒ Boolean
Returns either true or false, depending on whether the servo at the provided index is stopped (aka - whether the motor is currently moving or not).
-
#velocities ⇒ Array
Returns an array of Floats which represent the velocities of each servo attached to the system, or nil if the device is disconnected.
-
#velocity_limit(Fixnumindex, Floatvalue = nil) ⇒ Float
If a value is passed, the velocity_limit of a servo is set to the specified value at the provided index.
-
#velocity_max ⇒ Array
Returns an array of Floats which specify the maximum velocity value that can be configured on each servo, or nil if the device has yet to be connected.
-
#velocity_min ⇒ Array
Returns an array of Floats which specify the minimum velocity value that can be configured on each servo, or nil if the device is disconnected.
Constructor Details
#new(serial_number) ⇒ Object
All phidget objects are created from the device serial number. Serial numbers are required to be Fixnums (aka “unsigned integers”).
Instance Method Details
#acceleration(Fixnumindex, Floatvalue = nil) ⇒ Float
If a value is passed, the acceleration of a servo is set to the specified value at the provided index. Returns a float representing the “acceleration” of the servo at the provided index. This value comes directly from the CPhidgetAdvancedServo_getAcceleration function.
#acceleration_max ⇒ Array
Returns an array of Floats which specify the maximum acceleration value that can be configured on each servo, or nil if the device has yet to be connected.
#acceleration_min ⇒ Array
Returns an array of Floats which specify the minimum acceleration value that can be configured on each servo, or nil if the device has yet to be connected.
#currents ⇒ Array
Returns an array of Floats which represent the current draw of each servo attached to the system, or nil if the device is disconnected.
#engaged(Fixnumindex, Boolean) ⇒ Boolean
Sets the “engagement” of the servo at the provided index. This value is sent directly to the CPhidgetAdvancedServo_setEngaged function.
#engaged?(Fixnumindex) ⇒ Boolean
Returns either true or false, depending on whether the servo at the provided index is engaged (aka - whether the motor is powered or not). This value comes directly from the CPhidgetAdvancedServo_getEngaged function.
#motor_count ⇒ Fixnum
Returns an integer which represents the number of motor interfaces provided by this advanced servo controller, or nil if the device has yet to be connected.
#position(Fixnumindex, Floatvalue = nil) ⇒ Float
Sets the servo position of the servo at the provided index. Returns the passed position. This value comes directly from the CPhidgetAdvancedServo_setPosition function.
#position_max(Fixnumindex, Floatvalue = nil) ⇒ Float
If a value is passed, the position_max of a servo is set to the specified value at the provided index. Returns a float representing the “maximum position” of the servo at the provided index. This value comes directly from the CPhidgetAdvancedServo_getPositionMax function.
#position_min(Fixnumindex, Floatvalue = nil) ⇒ Float
If a value is passed, the position_min of a servo is set to the specified value at the provided index. Returns a float representing the “minimum position” of the servo at the provided index. This value comes directly from the CPhidgetAdvancedServo_getPositionMin function.
#positions ⇒ Array
Returns an array of Floats which represent the positions of each servo attached to the system, or nil if the device has yet to be connected.
#sample_rates ⇒ Array
The advancedservo object tracks the sample rate of each servo individually. This method returns an array containing the sample rates of each servo
#servo_parameters(Fixnumindex, Floatmin_us, Floatmax_us, Floatdegrees, Floatvelocity_max) ⇒ Qnil
Sets the “servo parameters” of the servo at the provided index. This value is sent directly to the CPhidgetAdvancedServo_setServoParameters function.
#servo_type(Fixnumindex, Floatvalue = nil) ⇒ Symbol
If a value is passed, the type of servo is set to the specified value at the provided index. Returns a symbol indicating the model/type of the servo at the provided index. This value comes directly from the CPhidgetAdvancedServo_getServoType function.
Currently, the following servo types are returned:
-
:default
-
:raw_us_mode
-
:hitec_hs322hd
-
:hitec_hs5245mg
-
:hitec_805bb
-
:hitec_hs422
-
:towerpro_mg90
-
:hitec_hsr1425cr
-
:hitec_hs785hb
-
:hitec_hs485hb
-
:hitec_hs645mg
-
:hitec_815bb
-
:firgelli_l12_30_50_06_r
-
:firgelli_l12_50_100_06_r
-
:firgelli_l12_50_210_06_r
-
:firgelli_l12_100_50_06_r
-
:firgelli_l12_100_100_06_r
-
:springrc_sm_s2313m
-
:springrc_sm_s3317m
-
:springrc_sm_s3317sr
-
:springrc_sm_s4303r
-
:springrc_sm_s4315m
-
:springrc_sm_s4315r
-
:springrc_sm_s4505b
-
:unknown
NOTE: Servo types cannot be set to :unknown, though :unknown is possibly returned if an unrecognized servo type is returned by the phidget libraries.
#speed_ramping(Fixnumindex, Boolean) ⇒ Boolean
Sets the “speed ramping” of the servo at the provided index. This value is sent directly to the CPhidgetAdvancedServo_setSpeedRampingOn function.
#speed_ramping?(Fixnumindex) ⇒ Boolean
Returns either true or false, depending on whether the servo at the provided index is configured to speed ramp. This value comes directly from the CPhidgetAdvancedServo_getSpeedRampingOn function.
#stopped?(Fixnumindex) ⇒ Boolean
Returns either true or false, depending on whether the servo at the provided index is stopped (aka - whether the motor is currently moving or not). This value comes directly from the CPhidgetAdvancedServo_getStopped function.
#velocities ⇒ Array
Returns an array of Floats which represent the velocities of each servo attached to the system, or nil if the device is disconnected.
#velocity_limit(Fixnumindex, Floatvalue = nil) ⇒ Float
If a value is passed, the velocity_limit of a servo is set to the specified value at the provided index. Returns a float representing the “velocity limit” of the servo at the provided index. This value comes directly from the CPhidgetAdvancedServo_getVelocityLimit function.
#velocity_max ⇒ Array
Returns an array of Floats which specify the maximum velocity value that can be configured on each servo, or nil if the device has yet to be connected.
#velocity_min ⇒ Array
Returns an array of Floats which specify the minimum velocity value that can be configured on each servo, or nil if the device is disconnected.