Class: Sensor_msgs::JoyFeedbackArray

Inherits:
ROS::Message
  • Object
show all
Defined in:
lib/sensor_msgs/JoyFeedbackArray.rb

Constant Summary collapse

@@struct_C2f =
::ROS::Struct.new("C2f")
@@struct_L =
::ROS::Struct.new("L")
@@slot_types =
['sensor_msgs/JoyFeedback[]']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ JoyFeedbackArray

Constructor. You can set the default values using keyword operators.

Parameters:

  • args (Hash) (defaults to: {})

    keyword for initializing values

Options Hash (args):

  • :array (sensor_msgs/JoyFeedback[])

    initialize value



55
56
57
58
59
60
61
62
# File 'lib/sensor_msgs/JoyFeedbackArray.rb', line 55

def initialize(args={})
  # message fields cannot be None, assign default values for those that are
  if args[:array]
    @array = args[:array]
  else
    @array = []
  end
end

Instance Attribute Details

#arrayObject

Returns the value of attribute array.



44
45
46
# File 'lib/sensor_msgs/JoyFeedbackArray.rb', line 44

def array
  @array
end

Class Method Details

.md5sumObject



9
10
11
# File 'lib/sensor_msgs/JoyFeedbackArray.rb', line 9

def self.md5sum
  "cde5730a895b1fc4dee6f91b754b213d"
end

.typeObject



13
14
15
# File 'lib/sensor_msgs/JoyFeedbackArray.rb', line 13

def self.type
  "sensor_msgs/JoyFeedbackArray"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



66
67
68
# File 'lib/sensor_msgs/JoyFeedbackArray.rb', line 66

def _get_types
  @slot_types
end

#deserialize(str) ⇒ Object

unpack serialized message in str into this message instance

@param [String] str: byte array of serialized message


88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/sensor_msgs/JoyFeedbackArray.rb', line 88

def deserialize(str)

  begin
    end_point = 0
    start = end_point
    end_point += 4
    (length,) = @@struct_L.unpack(str[start..(end_point-1)])
    @array = []
    length.times do
      val1 = Sensor_msgs::JoyFeedback.new
      _x = val1
      start = end_point
      end_point += ROS::Struct::calc_size('C2f')
      (_x.type, _x.id, _x.intensity,) = @@struct_C2f.unpack(str[start..(end_point-1)])
      @array.push(val1)
    end
    return self
  rescue => exception
    raise "message DeserializationError: #{exception}" #most likely buffer underfill
  end
end

#has_header?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/sensor_msgs/JoyFeedbackArray.rb', line 17

def has_header?
  false
end

#message_definitionObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/sensor_msgs/JoyFeedbackArray.rb', line 21

def message_definition
  "# This message publishes values for multiple feedback at once. 
JoyFeedback[] array
================================================================================
MSG: sensor_msgs/JoyFeedback
# Declare of the type of feedback
uint8 TYPE_LED    = 0
uint8 TYPE_RUMBLE = 1
uint8 TYPE_BUZZER = 2

uint8 type

# This will hold an id number for each type of each feedback.
# Example, the first led would be id=0, the second would be id=1
uint8 id

# Intensity of the feedback, from 0.0 to 1.0, inclusive.  If device is
# actually binary, driver should treat 0<=x<0.5 as off, 0.5<=x<=1 as on.
float32 intensity


"
end

#serialize(buff) ⇒ Object

serialize message into buffer

Parameters:

  • buff (IO)

    buffer



72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/sensor_msgs/JoyFeedbackArray.rb', line 72

def serialize(buff)
  begin
    length = @array.length
    buff.write(@@struct_L.pack(length))
    for val1 in @array
      _x = val1
      buff.write(@@struct_C2f.pack(_x.type, _x.id, _x.intensity))
    end
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end