本文整理汇总了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());
}