Class: Phidgets::Spatial::SpatialAccelerometerAxes
- Inherits:
-
Object
- Object
- Phidgets::Spatial::SpatialAccelerometerAxes
- 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
-
#acceleration ⇒ Float
Returns the current acceleration in gs, or raises an error.
-
#acceleration_max ⇒ Float
Returns the maximum acceleration that the sensor can measure, or raises an error.
-
#acceleration_min ⇒ Float
Returns the minimum acceleration that the sensor can measure, or raises an error.
-
#index ⇒ Integer
Returns index of the accelerometer axis, or raises an error.
-
#inspect ⇒ Object
Displays data for the accelerometer axis.
Instance Method Details
#acceleration ⇒ 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_max ⇒ 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_min ⇒ 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 |
#index ⇒ 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 |
#inspect ⇒ Object
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 |