mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 04:23:33 +08:00
UAVCAN: Add device tracking and information publishing (#25617)
* uavcan: collect node info and publish every second * UORB: Add DeviceInformation Message Format DeviceInformation.msg with standard comment spaces * SENS: add getter for device_id * UAVCAN: add publishing of DeviceInformation based on publised message type, and Node Information * LOG: add deviceInformation * MSG:BAT: fix comment to be inline with the max_instaces * UAVCAN: DeviceInformation, incorporated feedback * UAVCAN: DeviceInformation, incorporated feedback * UAVCAN: DeviceInformation, Fixed bug with Powermonitor --------- Co-authored-by: Beat Küng <beat-kueng@gmx.net>
This commit is contained in:
co-authored by
Beat Küng
parent
cb682006fe
commit
24d06047bd
@@ -128,6 +128,13 @@ UavcanEscController::esc_status_sub_cb(const uavcan::ReceivedDataStructure<uavca
|
||||
_esc_status.timestamp = hrt_absolute_time();
|
||||
_esc_status_pub.publish(_esc_status);
|
||||
}
|
||||
|
||||
// Register device capability for each ESC channel
|
||||
if (_node_info_publisher != nullptr) {
|
||||
uint8_t node_id = msg.getSrcNodeID().get();
|
||||
uint32_t device_id = msg.esc_index;
|
||||
_node_info_publisher->registerDeviceCapability(node_id, device_id, NodeInfoPublisher::DeviceCapability::ESC);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
#include <uORB/topics/actuator_outputs.h>
|
||||
#include <uORB/topics/esc_status.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <lib/mixer_module/mixer_module.hpp>
|
||||
#include <drivers/uavcan/node_info.hpp>
|
||||
#include <parameters/param.h>
|
||||
|
||||
class UavcanEscController
|
||||
@@ -78,6 +78,8 @@ public:
|
||||
*/
|
||||
void set_rotor_count(uint8_t count);
|
||||
|
||||
void set_node_info_publisher(NodeInfoPublisher *publisher) { _node_info_publisher = publisher; }
|
||||
|
||||
static int max_output_value() { return uavcan::equipment::esc::RawCommand::FieldTypes::cmd::RawValueType::max(); }
|
||||
|
||||
esc_status_s &esc_status() { return _esc_status; }
|
||||
@@ -114,4 +116,6 @@ private:
|
||||
uavcan::INode &_node;
|
||||
uavcan::Publisher<uavcan::equipment::esc::RawCommand> _uavcan_pub_raw_cmd;
|
||||
uavcan::Subscriber<uavcan::equipment::esc::Status, StatusCbBinder> _uavcan_sub_status;
|
||||
|
||||
NodeInfoPublisher *_node_info_publisher{nullptr};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user