fix: GPS tracker subscribes to correct phone bridge topic (Issue #681) #720
@ -723,9 +723,10 @@ function connectRos(url) {
|
||||
}
|
||||
|
||||
function setupRobotTopics() {
|
||||
// /gps/fix — sensor_msgs/NavSatFix (SIM7600X / Pixel 5 GPS)
|
||||
// /saltybot/phone/gps — sensor_msgs/NavSatFix published by the Pixel 5
|
||||
// MQTT-to-ROS2 bridge (saltybot_phone package). No velocity topic.
|
||||
new ROSLIB.Topic({
|
||||
ros, name: '/gps/fix',
|
||||
ros, name: '/saltybot/phone/gps',
|
||||
messageType: 'sensor_msgs/NavSatFix', throttle_rate: 500,
|
||||
}).subscribe(msg => {
|
||||
robot.lat = msg.latitude ?? robot.lat;
|
||||
@ -741,24 +742,6 @@ function setupRobotTopics() {
|
||||
$('last-msg').textContent = 'Robot: ' + new Date().toLocaleTimeString('en-US', { hour12: false });
|
||||
render();
|
||||
});
|
||||
|
||||
// /gps/vel — geometry_msgs/TwistStamped (east/north m/s + heading in radians)
|
||||
new ROSLIB.Topic({
|
||||
ros, name: '/gps/vel',
|
||||
messageType: 'geometry_msgs/TwistStamped', throttle_rate: 500,
|
||||
}).subscribe(msg => {
|
||||
const vx = msg.twist.linear.x; // east m/s
|
||||
const vy = msg.twist.linear.y; // north m/s
|
||||
const spd = Math.sqrt(vx * vx + vy * vy) * 3.6; // → km/h
|
||||
const hdg = (msg.twist.angular.z * 180 / Math.PI + 360) % 360; // radians → degrees
|
||||
robot.spd = spd;
|
||||
robot.hdg = hdg;
|
||||
robot.tsvel = Date.now();
|
||||
if (robotMarker && robot.lat != null) {
|
||||
robotMarker.setIcon(makeRobotIcon(robot.hdg));
|
||||
}
|
||||
render();
|
||||
});
|
||||
}
|
||||
|
||||
// ── Stale refresh ─────────────────────────────────────────────────────────────
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user