Class: Phidgets::Spatial::SpatialGyroAxes

Inherits:
Object
  • Object
show all
Defined in:
lib/phidgets-ffi/spatial.rb

Overview

This class represents an axis of gyroscope for a PhidgetSpatial. All the properties of an gyroscope axis are stored and modified in this class.

Constant Summary collapse

Klass =
Phidgets::FFI::CPhidgetSpatial

Instance Method Summary collapse

Instance Method Details

#angular_rateFloat

Returns the angular rate of rotation for the gyro axis, in degress per second, or raises an error.

Returns:

  • (Float)

    returns the angular rate of rotation for the gyro axis, in degress per second, or raises an error.



278
279
280
281
282
# File 'lib/phidgets-ffi/spatial.rb', line 278

def angular_rate
  ptr = ::FFI::MemoryPointer.new(:double)
  Klass.getAngularRate(@handle, @index, ptr)
	  ptr.get_double(0)
end

#angular_rate_maxFloat

Returns the maximum supported angular rate for the gyro axis, or raises an error.

Returns:

  • (Float)

    returns the maximum supported angular rate for the gyro axis, or raises an error.



285
286
287
288
289
# File 'lib/phidgets-ffi/spatial.rb', line 285

def angular_rate_max
  ptr = ::FFI::MemoryPointer.new(:double)
  Klass.getAngularRateMax(@handle, @index, ptr)
  ptr.get_double(0)
end

#angular_rate_minFloat

Returns the minimum supported angular rate for the gyro axis, or raises an error.

Returns:

  • (Float)

    returns the minimum supported angular rate for the gyro axis, or raises an error.



292
293
294
295
296
# File 'lib/phidgets-ffi/spatial.rb', line 292

def angular_rate_min
  ptr = ::FFI::MemoryPointer.new(:double)
  Klass.getAngularRateMin(@handle, @index, ptr)
  ptr.get_double(0)
end

#indexInteger

Returns index of the gyroscope axis, or raises an error.

Returns:

  • (Integer)

    returns index of the gyroscope axis, or raises an error.



273
274
275
# File 'lib/phidgets-ffi/spatial.rb', line 273

def index 
	@index
end

#inspectObject

Displays data for the gyroscope axis



268
269
270
# File 'lib/phidgets-ffi/spatial.rb', line 268

def inspect
     "#<#{self.class} @angular_rate=#{angular_rate}, @angular_rate_max=#{angular_rate_max}, @angular_rate_min=#{angular_rate_min}"
end