Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions c/include/libsbp/cpp/message_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,12 @@ struct MessageTraits<msg_ins_updates_t> {
};


template<>
struct MessageTraits<msg_gnss_time_offset_t> {
static constexpr u16 id = 65287;
};


template<>
struct MessageTraits<msg_heartbeat_t> {
static constexpr u16 id = 65535;
Expand Down
5 changes: 5 additions & 0 deletions c/include/libsbp/imu.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ SBP_PACK_START
* gyroscope readings. The sense of the measurements are to be aligned with
* the indications on the device itself. Measurement units, which are specific to the
* device hardware and settings, are communicated via the MSG_IMU_AUX message.
* If using "time since startup" time tags, the receiving end will expect a
* `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise IMU measurements
* with GNSS.
*
* The time-tagging mode should not change throughout a run.
*/
#define SBP_MSG_IMU_RAW 0x0900
typedef struct SBP_ATTR_PACKED {
Expand Down
15 changes: 15 additions & 0 deletions c/include/libsbp/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,21 @@ typedef struct SBP_ATTR_PACKED {
} msg_ins_updates_t;


/** Offset of the local time with respect to GNSS time
*
* The GNSS time offset message contains the information that is needed to translate messages
* tagged with a local timestamp (e.g. IMU or wheeltick messages) to GNSS time for the sender
* producing this message.
*/
#define SBP_MSG_GNSS_TIME_OFFSET 0xFF07
typedef struct SBP_ATTR_PACKED {
s16 weeks; /**< Weeks portion of the time offset [weeks] */
s32 milliseconds; /**< Milliseconds portion of the time offset [ms] */
s16 microseconds; /**< Microseconds portion of the time offset [microseconds] */
u8 flags; /**< Status flags (reserved) */
} msg_gnss_time_offset_t;


/** \} */

SBP_PACK_END
Expand Down
6 changes: 6 additions & 0 deletions c/include/libsbp/vehicle.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ SBP_PACK_START
* the definition and origin of the user frame are defined through the device settings interface.
* There are 4 possible user-defined sources of this message which are labeled arbitrarily
* source 0 through 3.
* If using "processor time" time tags, the receiving end will expect a
* `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise odometry measurements
* with GNSS.
*/
#define SBP_MSG_ODOMETRY 0x0903
typedef struct SBP_ATTR_PACKED {
Expand All @@ -57,6 +60,9 @@ for the exact source of this timestamp.
* from 0 to 255.
* The timestamp associated with this message should represent the time when the accumulated
* tick count reached the value given by the contents of this message as accurately as possible.
* If using "local CPU time" time tags, the receiving end will expect a
* `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise wheeltick measurements
* with GNSS.
*/
#define SBP_MSG_WHEELTICK 0x0904
typedef struct SBP_ATTR_PACKED {
Expand Down
Binary file modified docs/sbp.pdf
Binary file not shown.
5 changes: 4 additions & 1 deletion haskell/src/SwiftNav/SBP/Imu.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ msgImuRaw = 0x0900
-- gyroscope readings. The sense of the measurements are to be aligned with
-- the indications on the device itself. Measurement units, which are specific
-- to the device hardware and settings, are communicated via the MSG_IMU_AUX
-- message.
-- message. If using "time since startup" time tags, the receiving end will
-- expect a `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to
-- synchronise IMU measurements with GNSS. The time-tagging mode should not
-- change throughout a run.
data MsgImuRaw = MsgImuRaw
{ _msgImuRaw_tow :: !Word32
-- ^ Milliseconds since reference epoch and time status.
Expand Down
6 changes: 6 additions & 0 deletions haskell/src/SwiftNav/SBP/Msg.hs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ data SBPMsg =
| SBPMsgFwd MsgFwd Msg
| SBPMsgGloBiases MsgGloBiases Msg
| SBPMsgGnssCapb MsgGnssCapb Msg
| SBPMsgGnssTimeOffset MsgGnssTimeOffset Msg
| SBPMsgGpsTime MsgGpsTime Msg
| SBPMsgGpsTimeDepA MsgGpsTimeDepA Msg
| SBPMsgGroupDelay MsgGroupDelay Msg
Expand Down Expand Up @@ -327,6 +328,7 @@ instance Binary SBPMsg where
| _msgSBPType == msgFwd = SBPMsgFwd (decode (fromStrict (unBytes _msgSBPPayload))) m
| _msgSBPType == msgGloBiases = SBPMsgGloBiases (decode (fromStrict (unBytes _msgSBPPayload))) m
| _msgSBPType == msgGnssCapb = SBPMsgGnssCapb (decode (fromStrict (unBytes _msgSBPPayload))) m
| _msgSBPType == msgGnssTimeOffset = SBPMsgGnssTimeOffset (decode (fromStrict (unBytes _msgSBPPayload))) m
| _msgSBPType == msgGpsTime = SBPMsgGpsTime (decode (fromStrict (unBytes _msgSBPPayload))) m
| _msgSBPType == msgGpsTimeDepA = SBPMsgGpsTimeDepA (decode (fromStrict (unBytes _msgSBPPayload))) m
| _msgSBPType == msgGroupDelay = SBPMsgGroupDelay (decode (fromStrict (unBytes _msgSBPPayload))) m
Expand Down Expand Up @@ -517,6 +519,7 @@ instance Binary SBPMsg where
encoder (SBPMsgFwd _ m) = put m
encoder (SBPMsgGloBiases _ m) = put m
encoder (SBPMsgGnssCapb _ m) = put m
encoder (SBPMsgGnssTimeOffset _ m) = put m
encoder (SBPMsgGpsTime _ m) = put m
encoder (SBPMsgGpsTimeDepA _ m) = put m
encoder (SBPMsgGroupDelay _ m) = put m
Expand Down Expand Up @@ -711,6 +714,7 @@ instance FromJSON SBPMsg where
| msgType == msgFwd = SBPMsgFwd <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj
| msgType == msgGloBiases = SBPMsgGloBiases <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj
| msgType == msgGnssCapb = SBPMsgGnssCapb <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj
| msgType == msgGnssTimeOffset = SBPMsgGnssTimeOffset <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj
| msgType == msgGpsTime = SBPMsgGpsTime <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj
| msgType == msgGpsTimeDepA = SBPMsgGpsTimeDepA <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj
| msgType == msgGroupDelay = SBPMsgGroupDelay <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj
Expand Down Expand Up @@ -906,6 +910,7 @@ instance ToJSON SBPMsg where
toJSON (SBPMsgFwd n m) = toJSON n <<>> toJSON m
toJSON (SBPMsgGloBiases n m) = toJSON n <<>> toJSON m
toJSON (SBPMsgGnssCapb n m) = toJSON n <<>> toJSON m
toJSON (SBPMsgGnssTimeOffset n m) = toJSON n <<>> toJSON m
toJSON (SBPMsgGpsTime n m) = toJSON n <<>> toJSON m
toJSON (SBPMsgGpsTimeDepA n m) = toJSON n <<>> toJSON m
toJSON (SBPMsgGroupDelay n m) = toJSON n <<>> toJSON m
Expand Down Expand Up @@ -1095,6 +1100,7 @@ instance HasMsg SBPMsg where
msg f (SBPMsgFwd n m) = SBPMsgFwd n <$> f m
msg f (SBPMsgGloBiases n m) = SBPMsgGloBiases n <$> f m
msg f (SBPMsgGnssCapb n m) = SBPMsgGnssCapb n <$> f m
msg f (SBPMsgGnssTimeOffset n m) = SBPMsgGnssTimeOffset n <$> f m
msg f (SBPMsgGpsTime n m) = SBPMsgGpsTime n <$> f m
msg f (SBPMsgGpsTimeDepA n m) = SBPMsgGpsTimeDepA n <$> f m
msg f (SBPMsgGroupDelay n m) = SBPMsgGroupDelay n <$> f m
Expand Down
37 changes: 37 additions & 0 deletions haskell/src/SwiftNav/SBP/System.hs
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,40 @@ instance Binary MsgInsUpdates where
$(makeSBP 'msgInsUpdates ''MsgInsUpdates)
$(makeJSON "_msgInsUpdates_" ''MsgInsUpdates)
$(makeLenses ''MsgInsUpdates)

msgGnssTimeOffset :: Word16
msgGnssTimeOffset = 0xFF07

-- | SBP class for message MSG_GNSS_TIME_OFFSET (0xFF07).
--
-- The GNSS time offset message contains the information that is needed to
-- translate messages tagged with a local timestamp (e.g. IMU or wheeltick
-- messages) to GNSS time for the sender producing this message.
data MsgGnssTimeOffset = MsgGnssTimeOffset
{ _msgGnssTimeOffset_weeks :: !Int16
-- ^ Weeks portion of the time offset
, _msgGnssTimeOffset_milliseconds :: !Int32
-- ^ Milliseconds portion of the time offset
, _msgGnssTimeOffset_microseconds :: !Int16
-- ^ Microseconds portion of the time offset
, _msgGnssTimeOffset_flags :: !Word8
-- ^ Status flags (reserved)
} deriving ( Show, Read, Eq )

instance Binary MsgGnssTimeOffset where
get = do
_msgGnssTimeOffset_weeks <- (fromIntegral <$> getWord16le)
_msgGnssTimeOffset_milliseconds <- (fromIntegral <$> getWord32le)
_msgGnssTimeOffset_microseconds <- (fromIntegral <$> getWord16le)
_msgGnssTimeOffset_flags <- getWord8
pure MsgGnssTimeOffset {..}

put MsgGnssTimeOffset {..} = do
(putWord16le . fromIntegral) _msgGnssTimeOffset_weeks
(putWord32le . fromIntegral) _msgGnssTimeOffset_milliseconds
(putWord16le . fromIntegral) _msgGnssTimeOffset_microseconds
putWord8 _msgGnssTimeOffset_flags

$(makeSBP 'msgGnssTimeOffset ''MsgGnssTimeOffset)
$(makeJSON "_msgGnssTimeOffset_" ''MsgGnssTimeOffset)
$(makeLenses ''MsgGnssTimeOffset)
8 changes: 6 additions & 2 deletions haskell/src/SwiftNav/SBP/Vehicle.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ msgOdometry = 0x0903
-- odometry reference point and the definition and origin of the user frame
-- are defined through the device settings interface. There are 4 possible
-- user-defined sources of this message which are labeled arbitrarily source
-- 0 through 3.
-- 0 through 3. If using "processor time" time tags, the receiving end will
-- expect a `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to
-- synchronise odometry measurements with GNSS.
data MsgOdometry = MsgOdometry
{ _msgOdometry_tow :: !Word32
-- ^ Time field representing either milliseconds in the GPS Week or local CPU
Expand Down Expand Up @@ -84,7 +86,9 @@ msgWheeltick = 0x0904
-- identified by the source field, which is an integer ranging from 0 to 255.
-- The timestamp associated with this message should represent the time when
-- the accumulated tick count reached the value given by the contents of this
-- message as accurately as possible.
-- message as accurately as possible. If using "local CPU time" time tags, the
-- receiving end will expect a `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes
-- available to synchronise wheeltick measurements with GNSS.
data MsgWheeltick = MsgWheeltick
{ _msgWheeltick_time :: !Word64
-- ^ Time field representing either microseconds since the last PPS,
Expand Down
3 changes: 3 additions & 0 deletions java/src/com/swiftnav/sbp/client/MessageTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
import com.swiftnav.sbp.system.MsgCsacTelemetry;
import com.swiftnav.sbp.system.MsgCsacTelemetryLabels;
import com.swiftnav.sbp.system.MsgInsUpdates;
import com.swiftnav.sbp.system.MsgGnssTimeOffset;
import com.swiftnav.sbp.tracking.MsgTrackingStateDetailedDepA;
import com.swiftnav.sbp.tracking.MsgTrackingStateDetailedDep;
import com.swiftnav.sbp.tracking.MsgTrackingState;
Expand Down Expand Up @@ -550,6 +551,8 @@ static SBPMessage dispatch(SBPMessage msg) throws SBPBinaryException {
return new MsgCsacTelemetryLabels(msg);
case MsgInsUpdates.TYPE:
return new MsgInsUpdates(msg);
case MsgGnssTimeOffset.TYPE:
return new MsgGnssTimeOffset(msg);
case MsgTrackingStateDetailedDepA.TYPE:
return new MsgTrackingStateDetailedDepA(msg);
case MsgTrackingStateDetailedDep.TYPE:
Expand Down
7 changes: 6 additions & 1 deletion java/src/com/swiftnav/sbp/imu/MsgImuRaw.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@
* Raw data from the Inertial Measurement Unit, containing accelerometer and
* gyroscope readings. The sense of the measurements are to be aligned with
* the indications on the device itself. Measurement units, which are specific to the
* device hardware and settings, are communicated via the MSG_IMU_AUX message. */
* device hardware and settings, are communicated via the MSG_IMU_AUX message.
* If using "time since startup" time tags, the receiving end will expect a
* `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise IMU measurements
* with GNSS.
*
* The time-tagging mode should not change throughout a run. */

public class MsgImuRaw extends SBPMessage {
public static final int TYPE = 0x0900;
Expand Down
85 changes: 85 additions & 0 deletions java/src/com/swiftnav/sbp/system/MsgGnssTimeOffset.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright (C) 2015-2018 Swift Navigation Inc.
* Contact: Swift Navigation <dev@swiftnav.com>
*
* This source is subject to the license found in the file 'LICENSE' which must
* be be distributed together with this source. All other rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
*/

package com.swiftnav.sbp.system;

import java.math.BigInteger;

import com.swiftnav.sbp.SBPMessage;
import com.swiftnav.sbp.SBPBinaryException;
import com.swiftnav.sbp.SBPStruct;

import org.json.JSONObject;
import org.json.JSONArray;


/** SBP class for message MSG_GNSS_TIME_OFFSET (0xFF07).
*
* You can have MSG_GNSS_TIME_OFFSET inherent its fields directly from
* an inherited SBP object, or construct it inline using a dict of its
* fields.
*
* The GNSS time offset message contains the information that is needed to translate messages
* tagged with a local timestamp (e.g. IMU or wheeltick messages) to GNSS time for the sender
* producing this message. */

public class MsgGnssTimeOffset extends SBPMessage {
public static final int TYPE = 0xFF07;


/** Weeks portion of the time offset */
public int weeks;

/** Milliseconds portion of the time offset */
public int milliseconds;

/** Microseconds portion of the time offset */
public int microseconds;

/** Status flags (reserved) */
public int flags;


public MsgGnssTimeOffset (int sender) { super(sender, TYPE); }
public MsgGnssTimeOffset () { super(TYPE); }
public MsgGnssTimeOffset (SBPMessage msg) throws SBPBinaryException {
super(msg);
assert msg.type != TYPE;
}

@Override
protected void parse(Parser parser) throws SBPBinaryException {
/* Parse fields from binary */
weeks = parser.getS16();
milliseconds = parser.getS32();
microseconds = parser.getS16();
flags = parser.getU8();
}

@Override
protected void build(Builder builder) {
builder.putS16(weeks);
builder.putS32(milliseconds);
builder.putS16(microseconds);
builder.putU8(flags);
}

@Override
public JSONObject toJSON() {
JSONObject obj = super.toJSON();
obj.put("weeks", weeks);
obj.put("milliseconds", milliseconds);
obj.put("microseconds", microseconds);
obj.put("flags", flags);
return obj;
}
}
5 changes: 4 additions & 1 deletion java/src/com/swiftnav/sbp/vehicle/MsgOdometry.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
* reference point(s) specified by the user. The offset for the odometry reference point and
* the definition and origin of the user frame are defined through the device settings interface.
* There are 4 possible user-defined sources of this message which are labeled arbitrarily
* source 0 through 3. */
* source 0 through 3.
* If using "processor time" time tags, the receiving end will expect a
* `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise odometry measurements
* with GNSS. */

public class MsgOdometry extends SBPMessage {
public static final int TYPE = 0x0903;
Expand Down
5 changes: 4 additions & 1 deletion java/src/com/swiftnav/sbp/vehicle/MsgWheeltick.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
* The source of this message is identified by the source field, which is an integer ranging
* from 0 to 255.
* The timestamp associated with this message should represent the time when the accumulated
* tick count reached the value given by the contents of this message as accurately as possible. */
* tick count reached the value given by the contents of this message as accurately as possible.
* If using "local CPU time" time tags, the receiving end will expect a
* `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise wheeltick measurements
* with GNSS. */

public class MsgWheeltick extends SBPMessage {
public static final int TYPE = 0x0904;
Expand Down
4 changes: 2 additions & 2 deletions javascript/sbp.bundle.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion javascript/sbp/imu.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ var UInt64 = require('cuint').UINT64;
* Raw data from the Inertial Measurement Unit, containing accelerometer and
* gyroscope readings. The sense of the measurements are to be aligned with the
* indications on the device itself. Measurement units, which are specific to the
* device hardware and settings, are communicated via the MSG_IMU_AUX message.
* device hardware and settings, are communicated via the MSG_IMU_AUX message. If
* using "time since startup" time tags, the receiving end will expect a
* `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise IMU
* measurements with GNSS. The time-tagging mode should not change throughout a
* run.
*
* Fields in the SBP payload (`sbp.payload`):
* @field tow number (unsigned 32-bit int, 4 bytes) Milliseconds since reference epoch and time status.
Expand Down
40 changes: 40 additions & 0 deletions javascript/sbp/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,44 @@ MsgInsUpdates.prototype.fieldSpec.push(['speed', 'writeUInt8', 1]);
MsgInsUpdates.prototype.fieldSpec.push(['nhc', 'writeUInt8', 1]);
MsgInsUpdates.prototype.fieldSpec.push(['zerovel', 'writeUInt8', 1]);

/**
* SBP class for message MSG_GNSS_TIME_OFFSET (0xFF07).
*
* The GNSS time offset message contains the information that is needed to
* translate messages tagged with a local timestamp (e.g. IMU or wheeltick
* messages) to GNSS time for the sender producing this message.
*
* Fields in the SBP payload (`sbp.payload`):
* @field weeks number (signed 16-bit int, 2 bytes) Weeks portion of the time offset
* @field milliseconds number (signed 32-bit int, 4 bytes) Milliseconds portion of the time offset
* @field microseconds number (signed 16-bit int, 2 bytes) Microseconds portion of the time offset
* @field flags number (unsigned 8-bit int, 1 byte) Status flags (reserved)
*
* @param sbp An SBP object with a payload to be decoded.
*/
var MsgGnssTimeOffset = function (sbp, fields) {
SBP.call(this, sbp);
this.messageType = "MSG_GNSS_TIME_OFFSET";
this.fields = (fields || this.parser.parse(sbp.payload));

return this;
};
MsgGnssTimeOffset.prototype = Object.create(SBP.prototype);
MsgGnssTimeOffset.prototype.messageType = "MSG_GNSS_TIME_OFFSET";
MsgGnssTimeOffset.prototype.msg_type = 0xFF07;
MsgGnssTimeOffset.prototype.constructor = MsgGnssTimeOffset;
MsgGnssTimeOffset.prototype.parser = new Parser()
.endianess('little')
.int16('weeks')
.int32('milliseconds')
.int16('microseconds')
.uint8('flags');
MsgGnssTimeOffset.prototype.fieldSpec = [];
MsgGnssTimeOffset.prototype.fieldSpec.push(['weeks', 'writeInt16LE', 2]);
MsgGnssTimeOffset.prototype.fieldSpec.push(['milliseconds', 'writeInt32LE', 4]);
MsgGnssTimeOffset.prototype.fieldSpec.push(['microseconds', 'writeInt16LE', 2]);
MsgGnssTimeOffset.prototype.fieldSpec.push(['flags', 'writeUInt8', 1]);

module.exports = {
0xFF00: MsgStartup,
MsgStartup: MsgStartup,
Expand All @@ -282,4 +320,6 @@ module.exports = {
MsgCsacTelemetryLabels: MsgCsacTelemetryLabels,
0xFF06: MsgInsUpdates,
MsgInsUpdates: MsgInsUpdates,
0xFF07: MsgGnssTimeOffset,
MsgGnssTimeOffset: MsgGnssTimeOffset,
}
Loading