aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/examples/publisher/publisher_example.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/examples/publisher/publisher_example.cpp b/src/examples/publisher/publisher_example.cpp
index 6b30c2fe3..9952a16e4 100644
--- a/src/examples/publisher/publisher_example.cpp
+++ b/src/examples/publisher/publisher_example.cpp
@@ -54,13 +54,14 @@ int PublisherExample::main()
px4::Rate loop_rate(10);
while (px4::ok()) {
+ loop_rate.sleep();
+ _n.spinOnce();
+
px4_rc_channels msg;
msg.data().timestamp_last_valid = px4::get_time_micros();
PX4_INFO("%llu", msg.data().timestamp_last_valid);
_rc_channels_pub->publish(msg);
- _n.spinOnce();
- loop_rate.sleep();
}
return 0;