本文整理匯總了TypeScript中@lakemaps/schemas.TypedMessage類的典型用法代碼示例。如果您正苦於以下問題:TypeScript TypedMessage類的具體用法?TypeScript TypedMessage怎麽用?TypeScript TypedMessage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了TypedMessage類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: decode
static decode(buf: Buffer): BoatConfig {
const bytes = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
const obj = TypedMessage.deserializeBinary(bytes).getBoatConfig();
if (obj === null) {
throw new Error(`Missing BoatConfig field`);
}
const surgeControllerGains = obj.getSurgeControllerGains();
const surgeTimeStep = obj.getSurgeControllerDt();
const yawControllerGains = obj.getYawControllerGains();
const yawTimeStep = obj.getYawControllerDt();
return new BoatConfig(
new PidControllerGains(
surgeControllerGains.getKp(),
surgeControllerGains.getKi(),
surgeControllerGains.getKd(),
),
surgeTimeStep,
new PidControllerGains(
yawControllerGains.getKp(),
yawControllerGains.getKi(),
yawControllerGains.getKd(),
),
yawTimeStep,
);
}
示例2: decode
static decode(buf: Buffer): MissionInformation {
const bytes = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
const obj = TypedMessage.deserializeBinary(bytes).getMissionInformation();
if (obj === null) {
throw new Error(`Missing MissionInformation field`);
}
return new MissionInformation(obj.getDistanceToWaypoint());
}
示例3: decode
static decode(buf: Buffer): Motion {
const bytes = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
const obj = TypedMessage.deserializeBinary(bytes).getMotion();
return Motion.fromMessage(obj);
}
示例4: decode
static decode(buf: Buffer): TypedMessage {
const bytes = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
const obj = TypedMessageProtobuf.deserializeBinary(bytes);
return new TypedMessage(obj.getType());
}
示例5: decode
static decode(buf: Buffer): Waypoint {
const bytes = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
return Waypoint.fromMessage(TypedMessage.deserializeBinary(bytes).getWaypoint());
}