Class: Trajectory_msgs::JointTrajectoryPoint

Inherits:
ROS::Message
  • Object
show all
Defined in:
lib/trajectory_msgs/JointTrajectoryPoint.rb

Constant Summary collapse

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ JointTrajectoryPoint

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

Parameters:

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

    keyword for initializing values

Options Hash (args):

  • :positions (float64[])

    initialize value

  • :velocities (float64[])

    initialize value

  • :accelerations (float64[])

    initialize value

  • :time_from_start (duration)

    initialize value



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/trajectory_msgs/JointTrajectoryPoint.rb', line 42

def initialize(args={})
  # message fields cannot be None, assign default values for those that are
  if args[:positions]
    @positions = args[:positions]
  else
    @positions = []
  end
  if args[:velocities]
    @velocities = args[:velocities]
  else
    @velocities = []
  end
  if args[:accelerations]
    @accelerations = args[:accelerations]
  else
    @accelerations = []
  end
  if args[:time_from_start]
    @time_from_start = args[:time_from_start]
  else
    @time_from_start = ROS::Duration.new
  end
end

Instance Attribute Details

#accelerationsObject

Returns the value of attribute accelerations.



28
29
30
# File 'lib/trajectory_msgs/JointTrajectoryPoint.rb', line 28

def accelerations
  @accelerations
end

#positionsObject

Returns the value of attribute positions.



28
29
30
# File 'lib/trajectory_msgs/JointTrajectoryPoint.rb', line 28

def positions
  @positions
end

#time_from_startObject

Returns the value of attribute time_from_start.



28
29
30
# File 'lib/trajectory_msgs/JointTrajectoryPoint.rb', line 28

def time_from_start
  @time_from_start
end

#velocitiesObject

Returns the value of attribute velocities.



28
29
30
# File 'lib/trajectory_msgs/JointTrajectoryPoint.rb', line 28

def velocities
  @velocities
end

Class Method Details

.md5sumObject



9
10
11
# File 'lib/trajectory_msgs/JointTrajectoryPoint.rb', line 9

def self.md5sum
  "84fd2dcf68773c3dc0e9db894f4e8b40"
end

.typeObject



13
14
15
# File 'lib/trajectory_msgs/JointTrajectoryPoint.rb', line 13

def self.type
  "trajectory_msgs/JointTrajectoryPoint"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



68
69
70
# File 'lib/trajectory_msgs/JointTrajectoryPoint.rb', line 68

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


97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/trajectory_msgs/JointTrajectoryPoint.rb', line 97

def deserialize(str)

  begin
    if @time_from_start == nil
      @time_from_start = ROS::Duration.new
    end
    end_point = 0
    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}")
    @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}")
    @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}")
    @accelerations = str[start..(end_point-1)].unpack(pattern)
    start = end_point
    end_point += ROS::Struct::calc_size('l2')
    (@time_from_start.secs, @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)


17
18
19
# File 'lib/trajectory_msgs/JointTrajectoryPoint.rb', line 17

def has_header?
  false
end

#message_definitionObject



21
22
23
24
25
26
27
# File 'lib/trajectory_msgs/JointTrajectoryPoint.rb', line 21

def message_definition
  "float64[] positions
float64[] velocities
float64[] accelerations
duration time_from_start
"
end

#serialize(buff) ⇒ Object

serialize message into buffer

Parameters:

  • buff (IO)

    buffer



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/trajectory_msgs/JointTrajectoryPoint.rb', line 74

def serialize(buff)
  begin
    length = @positions.length
    buff.write(@@struct_L.pack(length))
    pattern = "d#{length}"
    buff.write(*@positions.pack(pattern))
    length = @velocities.length
    buff.write(@@struct_L.pack(length))
    pattern = "d#{length}"
    buff.write(*@velocities.pack(pattern))
    length = @accelerations.length
    buff.write(@@struct_L.pack(length))
    pattern = "d#{length}"
    buff.write(*@accelerations.pack(pattern))
    buff.write(@@struct_l2.pack(@time_from_start.secs, @time_from_start.nsecs))
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end