Skip to content

Instantly share code, notes, and snippets.

@munzz11
Last active September 20, 2022 21:03
Show Gist options
  • Select an option

  • Save munzz11/792ff2fe8551800e2efe89bdd34ee1ce to your computer and use it in GitHub Desktop.

Select an option

Save munzz11/792ff2fe8551800e2efe89bdd34ee1ce to your computer and use it in GitHub Desktop.
Convert mdt_msgs/Gps to sensor_msgs/NavSatFix inside the node playground, now called User Scripts in Foxglove studio
import { Input, Message } from "./types";
type Output = Message<"sensor_msgs/NavSatFix">;
export const inputs = ["/mothership_gps"];
export const output = "/test_output";
export default function script(event: Input<"/mothership_gps">): Output {
return {header:{
seq: event.message.header.seq,
stamp: event.message.header.stamp,
frame_id: event.message.header.frame_id
},
status: {
status: 2,
service: 1
},
latitude: event.message.latitude,
longitude: event.message.longitude,
altitude: event.message.altitude,
position_covariance: event.message.position_covariance,
position_covariance_type: event.message.position_covariance_type
}};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment