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.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/examples/publisher/publisher_example.cpp b/src/examples/publisher/publisher_example.cpp
index 9952a16e4..e7ab9eb5a 100644
--- a/src/examples/publisher/publisher_example.cpp
+++ b/src/examples/publisher/publisher_example.cpp
@@ -45,7 +45,9 @@ using namespace px4;
PublisherExample::PublisherExample() :
_n(),
- _rc_channels_pub(_n.advertise<px4_rc_channels>())
+ _rc_channels_pub(_n.advertise<px4_rc_channels>()),
+ _v_att_pub(_n.advertise<px4_vehicle_attitude>()),
+ _parameter_update_pub(_n.advertise<px4_parameter_update>())
{
}
@@ -57,10 +59,23 @@ int PublisherExample::main()
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);
+ /* Publish example message */
+ px4_rc_channels rc_channels_msg;
+ rc_channels_msg.data().timestamp_last_valid = px4::get_time_micros();
+ PX4_INFO("rc: %llu", rc_channels_msg.data().timestamp_last_valid);
+ _rc_channels_pub->publish(rc_channels_msg);
+
+ /* Publish example message */
+ px4_vehicle_attitude v_att_msg;
+ v_att_msg.data().timestamp = px4::get_time_micros();
+ PX4_INFO("att: %llu", v_att_msg.data().timestamp);
+ _v_att_pub->publish(v_att_msg);
+
+ /* Publish example message */
+ px4_parameter_update parameter_update_msg;
+ parameter_update_msg.data().timestamp = px4::get_time_micros();
+ PX4_INFO("param update: %llu", parameter_update_msg.data().timestamp);
+ _parameter_update_pub->publish(parameter_update_msg);
}