Skip to content

Commit af571b4

Browse files
committed
fix(ota_plugin): forward use_sim_time to OTA-spawned processes
ProcessRunner::spawn was running the new binary with execl(path, path, nullptr) - no --ros-args, no parameters. After an OTA execute the post-update node (fixed_lidar after the update flow, obstacle_classifier_v2 after install) was therefore born with use_sim_time=false while the rest of the demo runs on /clock from gz-sim. Result: every /scan / /diagnostics message stamped by the new node landed outside the gateway's TF cache, nav2's costmaps logged "Message Filter dropping message ... earlier than all the data in the transform cache" on every tick, the obstacle layer stayed empty, and NavigateToPose came back ABORTED with no progress - "robot stops responding" from the operator's seat. Pass --ros-args -p use_sim_time:=true to execl so the spawned node joins the same clock domain as the rest of the stack. Robot resumes following goals after the OTA swap. This is the minimum viable param plumbing for the demo. A full production plugin should plumb arbitrary parameters from the catalog entry through to execve - but for now use_sim_time is the only param the OTA-managed nodes care about.
1 parent 17325d5 commit af571b4

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

demos/ota_nav2_sensor_fix/ota_update_plugin/src/process_runner.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,23 @@ tl::expected<int, std::string> ProcessRunner::spawn(const std::string & executab
138138
}
139139
if (grandchild == 0) {
140140
setsid();
141-
execl(executable_path.c_str(), executable_path.c_str(), nullptr);
141+
// Forward use_sim_time so the spawned node aligns with the
142+
// gateway's clock domain. Without this, nodes started by OTA
143+
// (post-update fixed_lidar, post-install obstacle_classifier)
144+
// run on wall time while the rest of the stack runs on
145+
// /clock from gz-sim - their /scan / /diagnostics timestamps
146+
// fall outside nav2's TF buffer and the costmap drops every
147+
// message: "the timestamp on the message is earlier than all
148+
// the data in the transform cache". Robot stops responding.
149+
//
150+
// Note: this is the minimum viable param plumbing. A full
151+
// production plugin should plumb arbitrary parameters from
152+
// the catalog entry through to execve.
153+
execl(executable_path.c_str(),
154+
executable_path.c_str(),
155+
"--ros-args",
156+
"-p", "use_sim_time:=true",
157+
static_cast<char *>(nullptr));
142158
std::fprintf(stderr, "execl %s failed: %s\n", executable_path.c_str(),
143159
std::strerror(errno));
144160
_exit(127);

0 commit comments

Comments
 (0)