aboutsummaryrefslogtreecommitdiff
path: root/src/examples/publisher/publisher_example.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/publisher/publisher_example.cpp')
-rw-r--r--src/examples/publisher/publisher_example.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/examples/publisher/publisher_example.cpp b/src/examples/publisher/publisher_example.cpp
index 2e5779ebe..e85e42b38 100644
--- a/src/examples/publisher/publisher_example.cpp
+++ b/src/examples/publisher/publisher_example.cpp
@@ -45,7 +45,8 @@ using namespace px4;
PublisherExample::PublisherExample() :
_n(),
- _rc_channels_pub(PX4_ADVERTISE(_n, rc_channels))
+ _rc_channels_pub(_n.advertise<px4_rc_channels>())
+ // _rc_channels_pub(PX4_ADVERTISE(_n, rc_channels))
{
}
@@ -55,11 +56,19 @@ int PublisherExample::main()
px4::Rate loop_rate(10);
while (px4::ok()) {
- PX4_TOPIC_T(rc_channels) msg;
- msg.timestamp_last_valid = px4::get_time_micros();
- PX4_INFO("%llu", msg.timestamp_last_valid);
+ // PX4_TOPIC_T(rc_channels) msg;
+ // msg.timestamp_last_valid = px4::get_time_micros();
+ // PX4_INFO("%llu", msg.timestamp_last_valid);
+
+ // _rc_channels_pub->publish(msg);
+
+ //XXX
+ px4_rc_channels msg2;
+ msg2.data().timestamp_last_valid = px4::get_time_micros();
+ PX4_INFO("%llu", msg2.data().timestamp_last_valid);
+ // msg2.pub->publish2();
+ _rc_channels_pub->publish(msg2);
- _rc_channels_pub->publish(msg);
_n.spinOnce();
loop_rate.sleep();