Class: Pr2_controllers_msgs::QueryTrajectoryStateResponse

Inherits:
ROS::Message
  • Object
show all
Defined in:
lib/pr2_controllers_msgs/QueryTrajectoryState.rb

Constant Summary collapse

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ QueryTrajectoryStateResponse

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

Parameters:

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

    keyword for initializing values

Options Hash (args):

  • :name (string[])

    initialize value

  • :position (float64[])

    initialize value

  • :velocity (float64[])

    initialize value

  • :acceleration (float64[])

    initialize value



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/pr2_controllers_msgs/QueryTrajectoryState.rb', line 123

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

Instance Attribute Details

#accelerationObject

Returns the value of attribute acceleration.



110
111
112
# File 'lib/pr2_controllers_msgs/QueryTrajectoryState.rb', line 110

def acceleration
  @acceleration
end

#nameObject

Returns the value of attribute name.



110
111
112
# File 'lib/pr2_controllers_msgs/QueryTrajectoryState.rb', line 110

def name
  @name
end

#positionObject

Returns the value of attribute position.



110
111
112
# File 'lib/pr2_controllers_msgs/QueryTrajectoryState.rb', line 110

def position
  @position
end

#velocityObject

Returns the value of attribute velocity.



110
111
112
# File 'lib/pr2_controllers_msgs/QueryTrajectoryState.rb', line 110

def velocity
  @velocity
end

Class Method Details

.md5sumObject



89
90
91
# File 'lib/pr2_controllers_msgs/QueryTrajectoryState.rb', line 89

def self.md5sum
  "1f1a6554ad060f44d013e71868403c1a"
end

.typeObject



93
94
95
# File 'lib/pr2_controllers_msgs/QueryTrajectoryState.rb', line 93

def self.type
  "pr2_controllers_msgs/QueryTrajectoryStateResponse"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



149
150
151
# File 'lib/pr2_controllers_msgs/QueryTrajectoryState.rb', line 149

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


183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/pr2_controllers_msgs/QueryTrajectoryState.rb', line 183

def deserialize(str)

  begin
    end_point = 0
    start = end_point
    end_point += 4
    (length,) = @@struct_L.unpack(str[start..(end_point-1)])
    @name = []
    length.times do
      start = end_point
      end_point += 4
      (length,) = @@struct_L.unpack(str[start..(end_point-1)])
      start = end_point
      end_point += length
      val1 = str[start..(end_point-1)]
      @name.push(val1)
    end
    start = end_point
    end_point += 4
    (length,) = @@struct_L.unpack(str[start..(end_point-1)])
    pattern = "d#{length}"
    start = end_point
    end_point += ROS::Struct::calc_size("#{pattern}")
    @position = str[start..(end_point-1)].unpack(pattern)
    start = end_point
    end_point += 4
    (length,) = @@struct_L.unpack(str[start..(end_point-1)])
    pattern = "d#{length}"
    start = end_point
    end_point += ROS::Struct::calc_size("#{pattern}")
    @velocity = str[start..(end_point-1)].unpack(pattern)
    start = end_point
    end_point += 4
    (length,) = @@struct_L.unpack(str[start..(end_point-1)])
    pattern = "d#{length}"
    start = end_point
    end_point += ROS::Struct::calc_size("#{pattern}")
    @acceleration = str[start..(end_point-1)].unpack(pattern)
    return self
  rescue => exception
    raise "message DeserializationError: #{exception}" #most likely buffer underfill
  end
end

#has_header?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/pr2_controllers_msgs/QueryTrajectoryState.rb', line 97

def has_header?
  false
end

#message_definitionObject



101
102
103
104
105
106
107
108
109
# File 'lib/pr2_controllers_msgs/QueryTrajectoryState.rb', line 101

def message_definition
  "string[] name
float64[] position
float64[] velocity
float64[] acceleration


"
end

#serialize(buff) ⇒ Object

serialize message into buffer

Parameters:

  • buff (IO)

    buffer



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/pr2_controllers_msgs/QueryTrajectoryState.rb', line 155

def serialize(buff)
  begin
    length = @name.length
    buff.write(@@struct_L.pack(length))
    for val1 in @name
      length = val1.length
      buff.write([length, val1].pack("La#{length}"))
    end
    length = @position.length
    buff.write(@@struct_L.pack(length))
    pattern = "d#{length}"
    buff.write(*@position.pack(pattern))
    length = @velocity.length
    buff.write(@@struct_L.pack(length))
    pattern = "d#{length}"
    buff.write(*@velocity.pack(pattern))
    length = @acceleration.length
    buff.write(@@struct_L.pack(length))
    pattern = "d#{length}"
    buff.write(*@acceleration.pack(pattern))
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end