nocanc option to display mapping between node and channel

Started by jimh

jimh

Hi Alain,

While nocanc can list nodes and channels there are often times where is would be useful to see the mapping between the node number / id and the channel it sources. This comes about when trying find which canzero board to reload when you have 2 or more canzero's on the bus.

You can find the information in the trace data but this is fiddly and may not be easy if used in a production environment.

Regards,

Jim

Alain

Hi Jim,
There are two things to consider I guess:
1) A mapping between nodes and the channels they have registered (publishers).
2) A mapping between nodes and the channels they have subscribed to (subscribers).
This information could be added to the existing nocanc list-channels command, perhaps as an option like nocanc list-channels --node-info or it could be added as a new command to nocanc, e.g. nocanc list-pubsub.
It will take a bit of work, perhaps for a release in couple of weeks.
Regards,
Alain – Omzlo

jimh

Hi Alain,

Before too much energy is expended I thought a better example might help your thinking. The extra mapping may not be the best approach. I will take an example from one of my areas of interest, model railway control and feedback.

In model railways and automation we need to have feedback from sensors and operate physical devices. On a large layout lets say we have 3 canzero nodes in physical location A, B and C. These can be some distance apart. Initially the canzero nodes N1, N2 and N3 map to the physical location A, B and C respectively. Each of the canzero nodes has a specific function, for example N1 at A might only read sensors for feedback, N2 at B might only operate physical items and N3 at C might be both sensors and output and also have a display.

So specific code on the each of the canzeros at specific location.

My understanding is the node number 1, 2 etc is dynamically assigned and could change if nocand is stopped and restarted.

The issue I am trying to address is to ensure that I can correctly identify the canzero node at location A so that when code is updated it is correctly delivered to the right node. I can see code being updated on the wrong canzero unintentionally.

One option might be to have a command option to blink the green led on request. e.g. blink green led on node 1. Good general purpose approach but device may not able to be observed.

Best regards,
Jim

Alain

Hi Jim,
By default, the nocand application will allocate the same node ID to the same node, even after a restart. Each node has a unique 8 byte serial number called "UDID" or "Unique Device Identifier", and nocand maintains a correspondence between the UDID and the node ID, storing the data in a JSON file (by default ~/.nocand/cache). Each time a new node is added to the network, the file is updated after a delay of 60 seconds.

You can also get the device UDID with the nocanc list-nodes command, e.g.:

1> nocanc list-nodes
2#95        07:18:06:43:4d:54:03:1f        connected
3

Here, #95 is the node ID and 07:18:06:43:4d:54:03:1f is the node UDID. To be sure you are addressing the same device you can check the UDID: it will never change for a particular CANZERO node.

Perhaps this is enough for your application?

Best regards,
Alain

jimh

Hi Alain,

Thanks for the update. Based on this information I can code or script the desired result. This will be enough for my needs.

Interestingly I could not find the ~/.nocand/cache file. On the raspberry pi hosting I have the .nocand directory but the only file is the config file.

Best regards,

Jim