mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-11 14:11:38 +08:00
uavcan_v1: Add Publisher base; Gnss Publisher
This commit is contained in:
committed by
Lorenz Meier
parent
216a66b535
commit
4b73566b76
@@ -83,6 +83,10 @@ UavcanNode::UavcanNode(CanardInterface *interface, uint32_t node_id) :
|
||||
|
||||
PX4_INFO("main _canard_instance = %p", &_canard_instance);
|
||||
|
||||
for (auto &publisher : _publishers) {
|
||||
publisher->updateParam();
|
||||
}
|
||||
|
||||
for (auto &subscriber : _subscribers) {
|
||||
subscriber->updateParam();
|
||||
}
|
||||
@@ -229,6 +233,12 @@ void UavcanNode::Run()
|
||||
// update parameters from storage
|
||||
updateParams();
|
||||
|
||||
for (auto &publisher : _publishers) {
|
||||
// Have the publisher update its associated port-id parameter
|
||||
// Setting to 0 disable publication
|
||||
publisher->updateParam();
|
||||
}
|
||||
|
||||
for (auto &subscriber : _subscribers) {
|
||||
// Have the subscriber update its associated port-id parameter
|
||||
// If the port-id changes, (re)start the subscription
|
||||
@@ -240,8 +250,6 @@ void UavcanNode::Run()
|
||||
perf_begin(_cycle_perf);
|
||||
perf_count(_interval_perf);
|
||||
|
||||
|
||||
|
||||
if (hrt_elapsed_time(&_uavcan_pnp_nodeidallocation_last) >= 1_s &&
|
||||
_node_register_setup != CANARD_NODE_ID_UNSET &&
|
||||
_node_register_request_index == _node_register_last_received_index + 1) {
|
||||
@@ -278,6 +286,11 @@ void UavcanNode::Run()
|
||||
// send uavcan::node::Heartbeat_1_0 @ 1 Hz
|
||||
sendHeartbeat();
|
||||
|
||||
// Check all publishers
|
||||
for (auto &publisher : _publishers) {
|
||||
publisher->update();
|
||||
}
|
||||
|
||||
// Transmitting
|
||||
// Look at the top of the TX queue.
|
||||
for (const CanardFrame *txf = nullptr; (txf = canardTxPeek(&_canard_instance)) != nullptr;) {
|
||||
@@ -381,6 +394,10 @@ void UavcanNode::print_info()
|
||||
perf_print_counter(_cycle_perf);
|
||||
perf_print_counter(_interval_perf);
|
||||
|
||||
for (auto &publisher : _publishers) {
|
||||
publisher->printInfo();
|
||||
}
|
||||
|
||||
for (auto &subscriber : _subscribers) {
|
||||
subscriber->printInfo();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user