mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 00:43:34 +08:00
examples fix code style
This commit is contained in:
committed by
Lorenz Meier
parent
0eaf41a048
commit
662ec3f62f
@@ -43,7 +43,8 @@
|
||||
|
||||
using namespace px4;
|
||||
|
||||
void rc_channels_callback_function(const px4_rc_channels &msg) {
|
||||
void rc_channels_callback_function(const px4_rc_channels &msg)
|
||||
{
|
||||
PX4_INFO("I heard: [%llu]", msg.data().timestamp_last_valid);
|
||||
}
|
||||
|
||||
@@ -81,21 +82,24 @@ SubscriberExample::SubscriberExample() :
|
||||
* This tutorial demonstrates simple receipt of messages over the PX4 middleware system.
|
||||
* Also the current value of the _sub_rc_chan subscription is printed
|
||||
*/
|
||||
void SubscriberExample::rc_channels_callback(const px4_rc_channels &msg) {
|
||||
void SubscriberExample::rc_channels_callback(const px4_rc_channels &msg)
|
||||
{
|
||||
PX4_INFO("rc_channels_callback (method): [%llu]",
|
||||
msg.data().timestamp_last_valid);
|
||||
msg.data().timestamp_last_valid);
|
||||
PX4_INFO("rc_channels_callback (method): value of _sub_rc_chan: [%llu]",
|
||||
_sub_rc_chan->data().timestamp_last_valid);
|
||||
_sub_rc_chan->data().timestamp_last_valid);
|
||||
}
|
||||
|
||||
void SubscriberExample::vehicle_attitude_callback(const px4_vehicle_attitude &msg) {
|
||||
void SubscriberExample::vehicle_attitude_callback(const px4_vehicle_attitude &msg)
|
||||
{
|
||||
PX4_INFO("vehicle_attitude_callback (method): [%llu]",
|
||||
msg.data().timestamp);
|
||||
msg.data().timestamp);
|
||||
}
|
||||
|
||||
void SubscriberExample::parameter_update_callback(const px4_parameter_update &msg) {
|
||||
void SubscriberExample::parameter_update_callback(const px4_parameter_update &msg)
|
||||
{
|
||||
PX4_INFO("parameter_update_callback (method): [%llu]",
|
||||
msg.data().timestamp);
|
||||
msg.data().timestamp);
|
||||
_p_sub_interv.update();
|
||||
PX4_INFO("Param SUB_INTERV = %d", _p_sub_interv.get());
|
||||
_p_test_float.update();
|
||||
|
||||
@@ -43,7 +43,8 @@ using namespace px4;
|
||||
|
||||
void rc_channels_callback_function(const px4_rc_channels &msg);
|
||||
|
||||
class SubscriberExample {
|
||||
class SubscriberExample
|
||||
{
|
||||
public:
|
||||
SubscriberExample();
|
||||
|
||||
@@ -54,7 +55,7 @@ protected:
|
||||
px4::NodeHandle _n;
|
||||
px4::ParameterInt _p_sub_interv;
|
||||
px4::ParameterFloat _p_test_float;
|
||||
px4::Subscriber<px4_rc_channels> * _sub_rc_chan;
|
||||
px4::Subscriber<px4_rc_channels> *_sub_rc_chan;
|
||||
|
||||
|
||||
void rc_channels_callback(const px4_rc_channels &msg);
|
||||
|
||||
@@ -69,11 +69,11 @@ int subscriber_main(int argc, char *argv[])
|
||||
task_should_exit = false;
|
||||
|
||||
daemon_task = task_spawn_cmd("subscriber",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
2000,
|
||||
main,
|
||||
(argv) ? (char* const*)&argv[2] : (char* const*)NULL);
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
2000,
|
||||
main,
|
||||
(argv) ? (char * const *)&argv[2] : (char * const *)NULL);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user