Homepage GitHub

Active monitor implementation on STM32

(pletnev16rus) #1

I want to use example “Active monitor” from chapter “Node discovery” of libuavcan tutorial (https://uavcan.org/Implementations/Libuavcan/Tutorials/9._Node_discovery/) on my MCU STM32F103.

I add code from example and my project was builded successful. In debugging mode I check starting of retriever and adding listener and has no errors.

But monitoring is not work - collector.getNodeInfo(i) return nullptr for correct node id.
My mcu connected to pixhawk and i see can bus traffic by means of usb oscilloscope and I not see GetNodeInfo request.

May be someone know what is it?

(Pavel Kirienko) #2

Let’s have a look at your code.

(pletnev16rus) #3

I create uavcan_node.cpp (is attached) for working with uavcan in my project. In this file I use class NodeMonitor from example. In main function I call


and in while infinite loop I call


uavcan_node.cpp (13.9 KB)

(Pavel Kirienko) #4

The instance of NodeInfoRetriever is destroyed when the initialization function exits. You have to ensure proper object lifetimes: https://en.cppreference.com/w/cpp/language/lifetime

(pletnev16rus) #5

Thank You, Pavel! You absolutely right!