I am building a Node and SubNode application, similar to example in repo.
Does it matter in what thread the configureCanAcceptanceFilters() is called, assuming all subscribers etc. has been setup in each thread at the point of function call?
You have an interesting edge case. You will need to configure your acceptance filters manually.
Invoking configureCanAcceptanceFilters() in the sub-node will have no effect and result in ErrDriver. This is because the required CAN acceptance filter configuration functionality is not implemented in the virtual driver (the following code is taken from the Multithreading tutorial):
/**
* Stubs for uavcan::ICanDriver. Will be invoked by the sub-node.
* These methods are meaningless for a virtual interface.
*/
std::int16_t configureFilters(const uavcan::CanFilterConfig*, std::uint16_t) override { return -uavcan::ErrDriver; }
std::uint16_t getNumFilters() const override { return 0; }
Invocation of configureCanAcceptanceFilters() on the physical node will succeed, but the method will not be aware about the subscriptions implemented in the virtual node because it is separated at a very low level of abstraction and the subscription information is not shared between the physical node and the virtual node. As a result, the applied acceptance filter configuration may reject CAN frames that are needed for the virtual node.
What you need is to take the subscription list from both nodes (physical and virtual) and compute the acceptance filter configuration from that yourself. Basically you need to repeat this loop once per node: