Class: Pr2_controllers_msgs::JointTrajectoryControllerState

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

Constant Summary collapse

@@struct_L3 =
::ROS::Struct.new("L3")
@@struct_l2 =
::ROS::Struct.new("l2")
@@struct_L =
::ROS::Struct.new("L")
@@slot_types =
['Header','string[]','trajectory_msgs/JointTrajectoryPoint','trajectory_msgs/JointTrajectoryPoint','trajectory_msgs/JointTrajectoryPoint']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ JointTrajectoryControllerState

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

Parameters:

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

    keyword for initializing values

Options Hash (args):

  • :header (Header)

    initialize value

  • :joint_names (string[])

    initialize value

  • :desired (trajectory_msgs/JointTrajectoryPoint)

    initialize value

  • :actual (trajectory_msgs/JointTrajectoryPoint)

    initialize value

  • :error (trajectory_msgs/JointTrajectoryPoint)

    initialize value



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/pr2_controllers_msgs/JointTrajectoryControllerState.rb', line 72

def initialize(args={})
  # message fields cannot be None, assign default values for those that are
  if args[:header]
    @header = args[:header]
  else
    @header = Std_msgs::Header.new
  end
  if args[:joint_names]
    @joint_names = args[:joint_names]
  else
    @joint_names = []
  end
  if args[:desired]
    @desired = args[:desired]
  else
    @desired = Trajectory_msgs::JointTrajectoryPoint.new
  end
  if args[:actual]
    @actual = args[:actual]
  else
    @actual = Trajectory_msgs::JointTrajectoryPoint.new
  end
  if args[:error]
    @error = args[:error]
  else
    @error = Trajectory_msgs::JointTrajectoryPoint.new
  end
end

Instance Attribute Details

#actualObject

Returns the value of attribute actual.



56
57
58
# File 'lib/pr2_controllers_msgs/JointTrajectoryControllerState.rb', line 56

def actual
  @actual
end

#desiredObject

Returns the value of attribute desired.



56
57
58
# File 'lib/pr2_controllers_msgs/JointTrajectoryControllerState.rb', line 56

def desired
  @desired
end

#errorObject

Returns the value of attribute error.



56
57
58
# File 'lib/pr2_controllers_msgs/JointTrajectoryControllerState.rb', line 56

def error
  @error
end

#headerObject

Returns the value of attribute header.



56
57
58
# File 'lib/pr2_controllers_msgs/JointTrajectoryControllerState.rb', line 56

def header
  @header
end

#joint_namesObject

Returns the value of attribute joint_names.



56
57
58
# File 'lib/pr2_controllers_msgs/JointTrajectoryControllerState.rb', line 56

def joint_names
  @joint_names
end

Class Method Details

.md5sumObject



11
12
13
# File 'lib/pr2_controllers_msgs/JointTrajectoryControllerState.rb', line 11

def self.md5sum
  "b11d532a92ee589417fdd76559eb1d9e"
end

.typeObject



15
16
17
# File 'lib/pr2_controllers_msgs/JointTrajectoryControllerState.rb', line 15

def self.type
  "pr2_controllers_msgs/JointTrajectoryControllerState"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



103
104
105
# File 'lib/pr2_controllers_msgs/JointTrajectoryControllerState.rb', line 103

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


168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/pr2_controllers_msgs/JointTrajectoryControllerState.rb', line 168

def deserialize(str)

  begin
    if @header == nil
      @header = Std_msgs::Header.new
    end
    if @desired == nil
      @desired = Trajectory_msgs::JointTrajectoryPoint.new
    end
    if @actual == nil
      @actual = Trajectory_msgs::JointTrajectoryPoint.new
    end
    if @error == nil
      @error = Trajectory_msgs::JointTrajectoryPoint.new
    end
    end_point = 0
    start = end_point
    end_point += ROS::Struct::calc_size('L3')
    (@header.seq, @header.stamp.secs, @header.stamp.nsecs,) = @@struct_L3.unpack(str[start..(end_point-1)])
    start = end_point
    end_point += 4
    (length,) = @@struct_L.unpack(str[start..(end_point-1)])
    start = end_point
    end_point += length
    @header.frame_id = str[start..(end_point-1)]
    start = end_point
    end_point += 4
    (length,) = @@struct_L.unpack(str[start..(end_point-1)])
    @joint_names = []
    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)]
      @joint_names.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}")
    @desired.positions = 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}")
    @desired.velocities = 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}")
    @desired.accelerations = str[start..(end_point-1)].unpack(pattern)
    start = end_point
    end_point += ROS::Struct::calc_size('l2')
    (@desired.time_from_start.secs, @desired.time_from_start.nsecs,) = @@struct_l2.unpack(str[start..(end_point-1)])
    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}")
    @actual.positions = 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}")
    @actual.velocities = 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}")
    @actual.accelerations = str[start..(end_point-1)].unpack(pattern)
    start = end_point
    end_point += ROS::Struct::calc_size('l2')
    (@actual.time_from_start.secs, @actual.time_from_start.nsecs,) = @@struct_l2.unpack(str[start..(end_point-1)])
    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}")
    @error.positions = 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}")
    @error.velocities = 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}")
    @error.accelerations = str[start..(end_point-1)].unpack(pattern)
    start = end_point
    end_point += ROS::Struct::calc_size('l2')
    (@error.time_from_start.secs, @error.time_from_start.nsecs,) = @@struct_l2.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)


19
20
21
# File 'lib/pr2_controllers_msgs/JointTrajectoryControllerState.rb', line 19

def has_header?
  true
end

#message_definitionObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/pr2_controllers_msgs/JointTrajectoryControllerState.rb', line 23

def message_definition
  "Header header
string[] joint_names
trajectory_msgs/JointTrajectoryPoint desired
trajectory_msgs/JointTrajectoryPoint actual
trajectory_msgs/JointTrajectoryPoint error  # Redundant, but useful

================================================================================
MSG: std_msgs/Header
# Standard metadata for higher-level stamped data types.
# This is generally used to communicate timestamped data 
# in a particular coordinate frame.
# 
# sequence ID: consecutively increasing ID 
uint32 seq
#Two-integer timestamp that is expressed as:
# * stamp.secs: seconds (stamp_secs) since epoch
# * stamp.nsecs: nanoseconds since stamp_secs
# time-handling sugar is provided by the client library
time stamp
#Frame this data is associated with
# 0: no frame
# 1: global frame
string frame_id

================================================================================
MSG: trajectory_msgs/JointTrajectoryPoint
float64[] positions
float64[] velocities
float64[] accelerations
duration time_from_start
"
end

#serialize(buff) ⇒ Object

serialize message into buffer

Parameters:

  • buff (IO)

    buffer



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/pr2_controllers_msgs/JointTrajectoryControllerState.rb', line 109

def serialize(buff)
  begin
    buff.write(@@struct_L3.pack(@header.seq, @header.stamp.secs, @header.stamp.nsecs))
    _x = @header.frame_id
    length = _x.length
    buff.write([length, _x].pack("La#{length}"))
    length = @joint_names.length
    buff.write(@@struct_L.pack(length))
    for val1 in @joint_names
      length = val1.length
      buff.write([length, val1].pack("La#{length}"))
    end
    length = @desired.positions.length
    buff.write(@@struct_L.pack(length))
    pattern = "d#{length}"
    buff.write(*@desired.positions.pack(pattern))
    length = @desired.velocities.length
    buff.write(@@struct_L.pack(length))
    pattern = "d#{length}"
    buff.write(*@desired.velocities.pack(pattern))
    length = @desired.accelerations.length
    buff.write(@@struct_L.pack(length))
    pattern = "d#{length}"
    buff.write(*@desired.accelerations.pack(pattern))
    buff.write(@@struct_l2.pack(@desired.time_from_start.secs, @desired.time_from_start.nsecs))
    length = @actual.positions.length
    buff.write(@@struct_L.pack(length))
    pattern = "d#{length}"
    buff.write(*@actual.positions.pack(pattern))
    length = @actual.velocities.length
    buff.write(@@struct_L.pack(length))
    pattern = "d#{length}"
    buff.write(*@actual.velocities.pack(pattern))
    length = @actual.accelerations.length
    buff.write(@@struct_L.pack(length))
    pattern = "d#{length}"
    buff.write(*@actual.accelerations.pack(pattern))
    buff.write(@@struct_l2.pack(@actual.time_from_start.secs, @actual.time_from_start.nsecs))
    length = @error.positions.length
    buff.write(@@struct_L.pack(length))
    pattern = "d#{length}"
    buff.write(*@error.positions.pack(pattern))
    length = @error.velocities.length
    buff.write(@@struct_L.pack(length))
    pattern = "d#{length}"
    buff.write(*@error.velocities.pack(pattern))
    length = @error.accelerations.length
    buff.write(@@struct_L.pack(length))
    pattern = "d#{length}"
    buff.write(*@error.accelerations.pack(pattern))
    buff.write(@@struct_l2.pack(@error.time_from_start.secs, @error.time_from_start.nsecs))
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end