OpenCyphal-Garage / demos

Demo applications and reference implementations
https://opencyphal.org
MIT License
14 stars 8 forks source link

Registers do not work when running the Differential_pressure_sensor demo #9

Closed pepeRossRobotics closed 2 years ago

pepeRossRobotics commented 2 years ago

Hello,

I am running the Differential Pressure Demo on a Raspberry Pi, and I am having trouble getting the values of the registers. In fact I cannot see any registers files created when running the demo. This makes the demo unable to publish any pressure or temperature value, I can only see heartbeat and node information.

I run the commands to configure the Node and the port identifiers with success, but the value of the registers is not kept (or even written as far as I can tell.

Is there anything that I might be missing?

pavel-kirienko commented 2 years ago

This demo takes some gross shortcuts with error handling, as is usually the case with demos. Please single step the application around this place to see what's happening:

https://github.com/UAVCAN/demos/blob/c4e5868d5f84c9badd27a775b332105c08aaadab/differential_pressure_sensor/src/register.c#L62-L67

pepeRossRobotics commented 2 years ago

I added some print statement to see what is happening, and this is the output arond those lines:


Init register: /home/pi/temp/registry/uavcan.node.id
Making new register /home/pi/temp/registry/uavcan.node.id
  -> Result of the operation: -1
Node ID in the register: 65535
Init register: /home/pi/temp/registry/uavcan.node.description
Making new register /home/pi/temp/registry/uavcan.node.description
  -> Result of the operation: -1
Init register: /home/pi/temp/registry/udral.pnp.cookie
Making new register /home/pi/temp/registry/udral.pnp.cookie
  -> Result of the operation: -1
Making new register /home/pi/temp/registry/reg.udral.service.pitot
  -> Result of the operation: -1
Init register: /home/pi/temp/registry/uavcan.can.mtu
Making new register /home/pi/temp/registry/uavcan.can.mtu
  -> Result of the operation: -1

Te Result of the operation comes from mkdir(RegistryDirName, S_IRWXU | S_IRWXG | S_IRWXO); SO I assume that the code is failing to create the file.

Do you have any suggestions on how to address this?

pavel-kirienko commented 2 years ago

Check the errno

pepeRossRobotics commented 2 years ago

It is working now, or it seems to, I will ontinue checkign tomorrow. The change that I made was to modify the mkdir command from:

mkdir(RegistryDirName, S_IRWXU | S_IRWXG | S_IRWXO);

mkdir(RegistryDirName,S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)

pavel-kirienko commented 2 years ago

Ah, that makes sense. Can you please submit a pull request?

pepeRossRobotics commented 2 years ago

will do