Class: Player::Sensor

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-player/sensor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index, ranger) ⇒ Sensor

Returns a new instance of Sensor.



23
24
25
26
27
28
29
# File 'lib/ruby-player/sensor.rb', line 23

def initialize(index, ranger)
  @index, @ranger = index, ranger
  @state = { ranger: 0.0, intensity: 0.0 }
  @geom = {px: 0.0, py: 0.0, pz: 0.0, proll: 0.0, ppitch: 0.0, pyaw: 0.0,
    sw: 0.0, sl: 0.0, sh: 0.0
  }
end

Instance Attribute Details

#geomObject (readonly)

Returns the value of attribute geom.



21
22
23
# File 'lib/ruby-player/sensor.rb', line 21

def geom
  @geom
end

#stateHash (readonly)

State of sensor

Returns:

  • (Hash)

    { :range, :intensity }



20
21
22
# File 'lib/ruby-player/sensor.rb', line 20

def state
  @state
end

Instance Method Details

#intensityFloat

Intensity data [m].

Returns:

  • (Float)


39
40
41
# File 'lib/ruby-player/sensor.rb', line 39

def intensity
  @state[:intensity]
end

#rangeFloat

Range data [m]

Returns:

  • (Float)


33
34
35
# File 'lib/ruby-player/sensor.rb', line 33

def range
  @state[:range]
end