diff --git a/src/components/NavigationPanel/GpsCoords.tsx b/src/components/NavigationPanel/GpsCoords.tsx index f69cd8a..d1398ad 100644 --- a/src/components/NavigationPanel/GpsCoords.tsx +++ b/src/components/NavigationPanel/GpsCoords.tsx @@ -11,7 +11,6 @@ interface GpsProps { } export const GPS = (props: GpsProps) => { - const gpsTopic = new ROSLIB.Topic({ ros: props.ROS, name: "/fix", @@ -20,8 +19,8 @@ export const GPS = (props: GpsProps) => { const baseTopic = new ROSLIB.Topic({ ros: props.ROS, - name: "/set_base", - messageType: "std_msgs/Bool", + name: "/base_fix", + messageType: "sensor_msgs/NavSatFix", }); useEffect(() => { @@ -29,31 +28,37 @@ export const GPS = (props: GpsProps) => { props.setCoord({ id: "R", lat: message.latitude, - lng: message.longitude + lng: message.longitude, }); }); baseTopic.subscribe((message: any) => { - if (message.data) { - props.setBaseCoord({ - id: "B", - lat: props.coord.lat, - lng: props.coord.lng - }); - } + props.setBaseCoord({ + id: "B", + lat: message.latitude, + lng: message.longitude, + }); }); }); return (
GPS Coordinates
{`Lat: ${props.coord.lat.toPrecision(9)}, Lng: ${props.coord.lng.toPrecision(9)}`}
-