Skip to content

Commit

Permalink
clarification
Browse files Browse the repository at this point in the history
  • Loading branch information
maksimdrachov committed Jan 3, 2024
1 parent 4e1445e commit dacaa21
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions docs/pages/demo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The document is arranged as follows:
You are expected to be familiar with terms like *Cyphal node*, *DSDL*, *subject-ID*, *RPC-service*.
If not, skim through the `Cyphal Guide <https://opencyphal.org/guide>`_ first.

If you want to follow along, :ref:`install PyCyphal <installation>` and switch to a new directory before continuing.
If you want to follow along, :ref:`install PyCyphal <installation>` and switch to a new directory (``~/pycyphal-demo``) before continuing.


DSDL definitions
Expand Down Expand Up @@ -62,15 +62,16 @@ For the sake of clarity, move the custom DSDL root namespace directory ``sirius_
that we created above into ``custom_data_types/``.
You should end up with the following directory structure::

custom_data_types/
sirius_cyber_corp/ # Created in the previous section
PerformLinearLeastSquaresFit.1.0.dsdl
PointXY.1.0.dsdl
public_regulated_data_types/ # Clone from git
uavcan/ # The standard DSDL namespace
pycyphal-demo/
custom_data_types/
sirius_cyber_corp/ # Created in the previous section
PerformLinearLeastSquaresFit.1.0.dsdl
PointXY.1.0.dsdl
public_regulated_data_types/ # Clone from git
uavcan/ # The standard DSDL namespace
...
...
...
demo_app.py # The thermostat node script
demo_app.py # The thermostat node script

``CYPHAL_PATH`` should contain a list to all the paths where the DSDL root namespace directories are to be found
(be sure to modify the values to match your environment):
Expand Down Expand Up @@ -229,11 +230,16 @@ Yakut requires us to compile our DSDL namespaces beforehand using ``yakut compil

.. code-block:: sh
yakut compile custom_data_types/sirius_cyber_corp public_regulated_data_types/uavcan
cd ~/pycyphal-demo
yakut compile custom_data_types/sirius_cyber_corp public_regulated_data_types/uavcan -O .cyphal
The outputs will be stored in the current working directory.
The outputs will be stored in ``.cyphal``.
If you decided to change the working directory or move the compilation outputs,
make sure to export the ``YAKUT_PATH`` environment variable pointing to the correct location.
make sure to export the ``YAKUT_PATH`` environment variable pointing to the correct location:

.. code-block:: sh
export YAKUT_PATH="$HOME/pycyphal-demo/.cyphal"
The commands shown later need to operate on the same network as the demo.
Earlier we configured the demo to use Cyphal/UDP via the localhost interface.
Expand All @@ -248,6 +254,7 @@ launch the following in a new terminal and leave it running (``y`` is a convenie

.. code-block:: sh
export YAKUT_PATH="$HOME/pycyphal-demo/.cyphal"
export UAVCAN__UDP__IFACE=127.0.0.1
y sub --with-metadata uavcan.node.heartbeat uavcan.diagnostic.record # You should see heartbeats
Expand All @@ -256,13 +263,15 @@ Launch another subscriber to see the published voltage command (it is not going

.. code-block:: sh
export YAKUT_PATH="$HOME/pycyphal-demo/.cyphal"
export UAVCAN__UDP__IFACE=127.0.0.1
y sub 2347:uavcan.si.unit.voltage.scalar --redraw # Prints nothing.
And publish the setpoint along with the measurement (process variable):

.. code-block:: sh
export YAKUT_PATH="$HOME/pycyphal-demo/.cyphal"
export UAVCAN__UDP__IFACE=127.0.0.1
export UAVCAN__NODE__ID=111 # We need a node-ID to publish messages properly
y pub --count=10 2345:uavcan.si.unit.temperature.scalar 250 \
Expand Down

0 comments on commit dacaa21

Please sign in to comment.