Compare commits

..

No commits in common. "b1cd15327f8b5e4e3838acc8c24f66352c291c2e" and "9cf98830c6520564eefa9757b6b0048d7a219fb1" have entirely different histories.

View File

@ -723,10 +723,9 @@ function connectRos(url) {
} }
function setupRobotTopics() { function setupRobotTopics() {
// /saltybot/phone/gps — sensor_msgs/NavSatFix published by the Pixel 5 // /gps/fix — sensor_msgs/NavSatFix (SIM7600X / Pixel 5 GPS)
// MQTT-to-ROS2 bridge (saltybot_phone package). No velocity topic.
new ROSLIB.Topic({ new ROSLIB.Topic({
ros, name: '/saltybot/phone/gps', ros, name: '/gps/fix',
messageType: 'sensor_msgs/NavSatFix', throttle_rate: 500, messageType: 'sensor_msgs/NavSatFix', throttle_rate: 500,
}).subscribe(msg => { }).subscribe(msg => {
robot.lat = msg.latitude ?? robot.lat; robot.lat = msg.latitude ?? robot.lat;
@ -742,6 +741,24 @@ function setupRobotTopics() {
$('last-msg').textContent = 'Robot: ' + new Date().toLocaleTimeString('en-US', { hour12: false }); $('last-msg').textContent = 'Robot: ' + new Date().toLocaleTimeString('en-US', { hour12: false });
render(); 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 ───────────────────────────────────────────────────────────── // ── Stale refresh ─────────────────────────────────────────────────────────────