Class: Sensor_msgs::NavSatFix

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

Constant Summary collapse

COVARIANCE_TYPE_UNKNOWN =

Pseudo-constants

0
COVARIANCE_TYPE_APPROXIMATED =
1
COVARIANCE_TYPE_DIAGONAL_KNOWN =
2
COVARIANCE_TYPE_KNOWN =
3
@@struct_L3 =
::ROS::Struct.new("L3")
@@struct_cSd3 =
::ROS::Struct.new("cSd3")
@@struct_d9 =
::ROS::Struct.new("d9")
@@struct_C =
::ROS::Struct.new("C")
@@struct_L =
::ROS::Struct.new("L")
@@slot_types =
['Header','sensor_msgs/NavSatStatus','float64','float64','float64','float64[9]','uint8']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ NavSatFix

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

  • :status (sensor_msgs/NavSatStatus)

    initialize value

  • :latitude (float64)

    initialize value

  • :longitude (float64)

    initialize value

  • :altitude (float64)

    initialize value

  • :position_covariance (float64[9])

    initialize value

  • :position_covariance_type (uint8)

    initialize value



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/sensor_msgs/NavSatFix.rb', line 141

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[:status]
    @status = args[:status]
  else
    @status = Sensor_msgs::NavSatStatus.new
  end
  if args[:latitude]
    @latitude = args[:latitude]
  else
    @latitude = 0.0
  end
  if args[:longitude]
    @longitude = args[:longitude]
  else
    @longitude = 0.0
  end
  if args[:altitude]
    @altitude = args[:altitude]
  else
    @altitude = 0.0
  end
  if args[:position_covariance]
    @position_covariance = args[:position_covariance]
  else
    @position_covariance = [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
  end
  if args[:position_covariance_type]
    @position_covariance_type = args[:position_covariance_type]
  else
    @position_covariance_type = 0
  end
end

Instance Attribute Details

#altitudeObject

Returns the value of attribute altitude.



121
122
123
# File 'lib/sensor_msgs/NavSatFix.rb', line 121

def altitude
  @altitude
end

#headerObject

Returns the value of attribute header.



121
122
123
# File 'lib/sensor_msgs/NavSatFix.rb', line 121

def header
  @header
end

#latitudeObject

Returns the value of attribute latitude.



121
122
123
# File 'lib/sensor_msgs/NavSatFix.rb', line 121

def latitude
  @latitude
end

#longitudeObject

Returns the value of attribute longitude.



121
122
123
# File 'lib/sensor_msgs/NavSatFix.rb', line 121

def longitude
  @longitude
end

#position_covarianceObject

Returns the value of attribute position_covariance.



121
122
123
# File 'lib/sensor_msgs/NavSatFix.rb', line 121

def position_covariance
  @position_covariance
end

#position_covariance_typeObject

Returns the value of attribute position_covariance_type.



121
122
123
# File 'lib/sensor_msgs/NavSatFix.rb', line 121

def position_covariance_type
  @position_covariance_type
end

#statusObject

Returns the value of attribute status.



121
122
123
# File 'lib/sensor_msgs/NavSatFix.rb', line 121

def status
  @status
end

Class Method Details

.md5sumObject



10
11
12
# File 'lib/sensor_msgs/NavSatFix.rb', line 10

def self.md5sum
  "2d3a8cd499b9b4a0249fb98fd05cfa48"
end

.typeObject



14
15
16
# File 'lib/sensor_msgs/NavSatFix.rb', line 14

def self.type
  "sensor_msgs/NavSatFix"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



182
183
184
# File 'lib/sensor_msgs/NavSatFix.rb', line 182

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


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
# File 'lib/sensor_msgs/NavSatFix.rb', line 205

def deserialize(str)

  begin
    if @header == nil
      @header = Std_msgs::Header.new
    end
    if @status == nil
      @status = Sensor_msgs::NavSatStatus.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 += ROS::Struct::calc_size('cSd3')
    (@status.status, @status.service, @latitude, @longitude, @altitude,) = @@struct_cSd3.unpack(str[start..(end_point-1)])
    start = end_point
    end_point += 8
    @position_covariance = @@struct_d9.unpack(str[start..(end_point-1)])
    start = end_point
    end_point += ROS::Struct::calc_size('C')
    (@position_covariance_type,) = @@struct_C.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)


18
19
20
# File 'lib/sensor_msgs/NavSatFix.rb', line 18

def has_header?
  true
end

#message_definitionObject



22
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/sensor_msgs/NavSatFix.rb', line 22

def message_definition
  "# Navigation Satellite fix for any Global Navigation Satellite System
#
# Specified using the WGS 84 reference ellipsoid

# header.stamp specifies the ROS time for this measurement (the
#        corresponding satellite time may be reported using the
#        sensor_msgs/TimeReference message).
#
# header.frame_id is the frame of reference reported by the satellite
#        receiver, usually the location of the antenna.  This is a
#        Euclidean frame relative to the vehicle, not a reference
#        ellipsoid.
Header header

# satellite fix status information
sensor_msgs/NavSatStatus status

# Latitude [degrees]. Positive is north of equator; negative is south.
float64 latitude

# Longitude [degrees]. Positive is east of prime meridian; negative is west.
float64 longitude

# Altitude [m]. Positive is above the WGS 84 ellipsoid
# (quiet NaN if no altitude is available).
float64 altitude

# Position covariance [m^2] defined relative to a tangential plane
# through the reported position. The components are East, North, and
# Up (ENU), in row-major order.
#
# Beware: this coordinate system exhibits singularities at the poles.

float64[9] position_covariance

# If the covariance of the fix is known, fill it in completely. If the
# GPS receiver provides the variance of each measurement, put them
# along the diagonal. If only Dilution of Precision is available,
# estimate an approximate covariance from that.

uint8 COVARIANCE_TYPE_UNKNOWN = 0
uint8 COVARIANCE_TYPE_APPROXIMATED = 1
uint8 COVARIANCE_TYPE_DIAGONAL_KNOWN = 2
uint8 COVARIANCE_TYPE_KNOWN = 3

uint8 position_covariance_type

================================================================================
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: sensor_msgs/NavSatStatus
# Navigation Satellite fix status for any Global Navigation Satellite System

# Whether to output an augmented fix is determined by both the fix
# type and the last time differential corrections were received.  A
# fix is valid when status >= STATUS_FIX.

int8 STATUS_NO_FIX =  -1        # unable to fix position
int8 STATUS_FIX =      0        # unaugmented fix
int8 STATUS_SBAS_FIX = 1        # with satellite-based augmentation
int8 STATUS_GBAS_FIX = 2        # with ground-based augmentation

int8 status

# Bits defining which Global Navigation Satellite System signals were
# used by the receiver.

uint16 SERVICE_GPS =     1
uint16 SERVICE_GLONASS = 2
uint16 SERVICE_COMPASS = 4      # includes BeiDou.
uint16 SERVICE_GALILEO = 8

uint16 service

"
end

#serialize(buff) ⇒ Object

serialize message into buffer

Parameters:

  • buff (IO)

    buffer



188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/sensor_msgs/NavSatFix.rb', line 188

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}"))
    buff.write(@@struct_cSd3.pack(@status.status, @status.service, @latitude, @longitude, @altitude))
    buff.write(@@struct_d9.pack(*@position_covariance))
    buff.write(@@struct_C.pack(@position_covariance_type))
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end