Class: Std_msgs::UInt32

Inherits:
ROS::Message
  • Object
show all
Defined in:
lib/std_msgs/UInt32.rb

Constant Summary collapse

@@struct_L =
::ROS::Struct.new("L")
@@slot_types =
['uint32']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ UInt32

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

Parameters:

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

    keyword for initializing values

Options Hash (args):

  • :data (uint32)

    initialize value



34
35
36
37
38
39
40
41
# File 'lib/std_msgs/UInt32.rb', line 34

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

Instance Attribute Details

#dataObject

Returns the value of attribute data.



24
25
26
# File 'lib/std_msgs/UInt32.rb', line 24

def data
  @data
end

Class Method Details

.md5sumObject



8
9
10
# File 'lib/std_msgs/UInt32.rb', line 8

def self.md5sum
  "304a39449588c7f8ce2df6e8001c5fce"
end

.typeObject



12
13
14
# File 'lib/std_msgs/UInt32.rb', line 12

def self.type
  "std_msgs/UInt32"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



45
46
47
# File 'lib/std_msgs/UInt32.rb', line 45

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


62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/std_msgs/UInt32.rb', line 62

def deserialize(str)

  begin
    end_point = 0
    start = end_point
    end_point += ROS::Struct::calc_size('L')
    (@data,) = @@struct_L.unpack(str[start..(end_point-1)])
    return self
  rescue => exception
    raise "message DeserializationError: #{exception}" #most likely buffer underfill
  end
end

#has_header?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/std_msgs/UInt32.rb', line 16

def has_header?
  false
end

#message_definitionObject



20
21
22
23
# File 'lib/std_msgs/UInt32.rb', line 20

def message_definition
  "uint32 data
"
end

#serialize(buff) ⇒ Object

serialize message into buffer

Parameters:

  • buff (IO)

    buffer



51
52
53
54
55
56
57
58
# File 'lib/std_msgs/UInt32.rb', line 51

def serialize(buff)
  begin
    buff.write(@@struct_L.pack(@data))
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end