Class: Phidgets::Spatial::SpatialAccelerometerAxes

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

Overview

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

Constant Summary collapse

Klass =
Phidgets::FFI::CPhidgetSpatial

Instance Method Summary collapse

Instance Method Details

#accelerationFloat

Returns the current acceleration in gs, or raises an error.

Returns:

  • (Float)

    returns the current acceleration in gs, or raises an error.



190
191
192
193
194
# File 'lib/phidgets-ffi/spatial.rb', line 190

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

#acceleration_maxFloat

Returns the maximum acceleration that the sensor can measure, or raises an error.

Returns:

  • (Float)

    returns the maximum acceleration that the sensor can measure, or raises an error.



197
198
199
200
201
# File 'lib/phidgets-ffi/spatial.rb', line 197

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

#acceleration_minFloat

Returns the minimum acceleration that the sensor can measure, or raises an error.

Returns:

  • (Float)

    returns the minimum acceleration that the sensor can measure, or raises an error.



204
205
206
207
208
# File 'lib/phidgets-ffi/spatial.rb', line 204

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

#indexInteger

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

Returns:

  • (Integer)

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



185
186
187
# File 'lib/phidgets-ffi/spatial.rb', line 185

def index 
	@index
end

#inspectObject

Displays data for the accelerometer axis



180
181
182
# File 'lib/phidgets-ffi/spatial.rb', line 180

def inspect
     "#<#{self.class} @acceleration=#{acceleration}, @acceleration_max=#{acceleration_max}, @acceleration_min=#{acceleration_min}>"
end