Skip to content

Commit

Permalink
dynamic_status -> flags
Browse files Browse the repository at this point in the history
  • Loading branch information
wbrannon committed Jul 24, 2024
1 parent 6127670 commit d0189b8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
12 changes: 7 additions & 5 deletions python/fusion_engine_client/messages/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class PoseMessage(MessagePayload):

INVALID_UNDULATION = -32768

FLAG_STATIONARY = 0x1

_STRUCT = struct.Struct('<Bx h ddd fff ddd fff ddd fff fff')

def __init__(self):
Expand All @@ -26,7 +28,7 @@ def __init__(self):

self.solution_type = SolutionType.Invalid

self.dynamic_status = np.nan
self.flags = 0x0

# Added in version 1.1.
self.undulation_m = np.nan
Expand Down Expand Up @@ -62,7 +64,7 @@ def pack(self, buffer: bytes = None, offset: int = 0, return_buffer: bool = True
self._STRUCT.pack_into(
buffer, offset,
int(self.solution_type),
self.dynamic_status,
self.flags,
undulation_cm,
self.lla_deg[0], self.lla_deg[1], self.lla_deg[2],
self.position_std_enu_m[0], self.position_std_enu_m[1], self.position_std_enu_m[2],
Expand All @@ -87,7 +89,7 @@ def unpack(self, buffer: bytes, offset: int = 0, message_version: int = MessageP
offset += self.gps_time.unpack(buffer, offset)

(solution_type_int,
dynamic_status,
flags,
undulation_cm,
self.lla_deg[0], self.lla_deg[1], self.lla_deg[2],
self.position_std_enu_m[0], self.position_std_enu_m[1], self.position_std_enu_m[2],
Expand All @@ -108,7 +110,7 @@ def unpack(self, buffer: bytes, offset: int = 0, message_version: int = MessageP

self.solution_type = SolutionType(solution_type_int)

self.dynamic_status = dynamic_status
self.flags = flags

return offset - initial_offset

Expand Down Expand Up @@ -158,7 +160,7 @@ def to_numpy(cls, messages):
'p1_time': np.array([float(m.p1_time) for m in messages]),
'gps_time': np.array([float(m.gps_time) for m in messages]),
'solution_type': np.array([int(m.solution_type) for m in messages], dtype=int),
'dynamic_status': np.array([m.dynamic_status for m in messages]),
'flags': np.array([m.flags for m in messages]),
'undulation': np.array([m.undulation_m for m in messages]),
'lla_deg': np.array([m.lla_deg for m in messages]).T,
'ypr_deg': np.array([m.ypr_deg for m in messages]).T,
Expand Down
8 changes: 4 additions & 4 deletions src/point_one/fusion_engine/messages/solution.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ struct P1_ALIGNAS(4) PoseMessage : public MessagePayload {
static constexpr uint8_t MESSAGE_VERSION = 1;
static constexpr int16_t INVALID_UNDULATION = INT16_MIN;

static constexpr uint8_t NONSTATIONARY = 0x00000000;
static constexpr uint8_t STATIONARY = 0x00000001;
/** Set this flag if the device is stationary. */
static constexpr uint8_t FLAG_STATIONARY = 0x01;

/** The time of the message, in P1 time (beginning at power-on). */
Timestamp p1_time;
Expand All @@ -54,8 +54,8 @@ struct P1_ALIGNAS(4) PoseMessage : public MessagePayload {
/** The type of this position solution. */
SolutionType solution_type;

/** Signals device dynamic status (stationary or nonstationary). */
uint8_t dynamic_status = NONSTATIONARY;
/** A bitmask of flags associated with the pose data. */
uint8_t flags = 0x0;

/**
* The geoid undulation at at the current location (i.e., the difference
Expand Down

0 comments on commit d0189b8

Please sign in to comment.