Class: PhidgetsNative::AdvancedServo

Inherits:
Device
  • Object
show all
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

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.

Returns:

  • (Float)

#acceleration_maxArray

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.

Returns:

  • (Array)

#acceleration_minArray

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.

Returns:

  • (Array)

#currentsArray

Returns an array of Floats which represent the current draw of each servo attached to the system, or nil if the device is disconnected.

Returns:

  • (Array)

#engaged(Fixnumindex, Boolean) ⇒ Boolean

Sets the “engagement” of the servo at the provided index. This value is sent directly to the CPhidgetAdvancedServo_setEngaged function.

Returns:

  • (Boolean)

#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.

Returns:

  • (Boolean)

#motor_countFixnum

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.

Returns:

  • (Fixnum)

#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.

Returns:

  • (Float)

#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.

Returns:

  • (Float)

#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.

Returns:

  • (Float)

#positionsArray

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.

Returns:

  • (Array)

#sample_ratesArray

The advancedservo object tracks the sample rate of each servo individually. This method returns an array containing the sample rates of each servo

Returns:

  • (Array)

#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.

Returns:

  • (Qnil)

#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.

Returns:

  • (Symbol)

#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.

Returns:

  • (Boolean)

#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.

Returns:

  • (Boolean)

#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.

Returns:

  • (Boolean)

#velocitiesArray

Returns an array of Floats which represent the velocities of each servo attached to the system, or nil if the device is disconnected.

Returns:

  • (Array)

#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.

Returns:

  • (Float)

#velocity_maxArray

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.

Returns:

  • (Array)

#velocity_minArray

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.

Returns:

  • (Array)