Skip to content
Snippets Groups Projects
Commit bc47cb93 authored by Paul Beuchat's avatar Paul Beuchat
Browse files

Fixed error in template_gpio launch file so that the line numbers parameter...

Fixed error in template_gpio launch file so that the line numbers parameter are now correctly added to the namespace of the resepctive nodes. Also some small corrections to the wiki docs.
parent 2b4581d8
Branches
No related tags found
No related merge requests found
<launch>
<!-- NOTE -->
<!-- Two nodes canNOT access the same GPIO line -->
<!-- The first node to open a line blocks other processes from accessing it -->
<!-- NOTE -->
<!-- This file launches both event triggered and polling nodes as an example -->
<!-- Decide which one to use, and remove the other one -->
<!-- START A GROUP WITH NAMESPACE "template" -->
<group ns="template_namespace_for_launch_group">
<!-- LAUNCH A "Template GPIO Event Triggered" NODE -->
......@@ -8,11 +17,12 @@
name = "template_gpio_event_triggered"
output = "screen"
type = "template_gpio_event_triggered"
/>
<param
name = "line_number"
value = "148"
/>
>
<param
name = "line_number"
value = "148"
/>
</node>
<!-- LAUNCH A "Template GPIO Polling" NODE -->
<node
......@@ -20,11 +30,12 @@
name = "template_gpio_polling"
output = "screen"
type = "template_gpio_polling"
/>
<param
name = "line_number"
value = "157"
/>
>
<param
name = "line_number"
value = "157"
/>
</node>
</group>
......
......@@ -60,8 +60,10 @@ List the current configuration using:
.. warning:: Do **NOT** choose a :code:`tegra-gpio` line at random for your GPIO use case, even if it is listed as :code:`unused`. Only use lines that are documented as mapping to a specific pin on the J12 40-pin expansion header.
.. _sbc-jetson-xavier-nx-pin-mapping:
Mapping pin number to line number
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A mapping from pin-number on the J12 40-pin expansion header to the line-number is also given on `this page on the Jetson hacks website <https://www.jetsonhacks.com/nvidia-jetson-xavier-nx-gpio-header-pinout/>`_.
......
......@@ -5,12 +5,12 @@ Git Merge from Upstream Fork
If you created your :code:`asclinic-system` repository as a fork of:
https://gitlab.eng.unimelb.edu.au/asclinic/asclinic-system
https://gitlab.unimelb.edu.au/asclinic/asclinic-system.git
then it will be beneficial to occasionally synchronise, i.e., merge, changes from that "original" repository into your fork.
To understand the descriptions below, the key terminology is that the "original" :code:`asclinic-system` repository that you forked is referred to as the "upstream" repository.
This `repository mirroring entry <https://docs.gitlab.com/ee/user/project/repository/forking_workflow.html#repository-mirroring>`_ in the GitLab documentation, the the links therein, provide a description for how to synchronise changes via the website.
This `repository mirroring entry <https://docs.gitlab.com/ee/user/project/repository/forking_workflow.html#repository-mirroring>`_ in the GitLab documentation, and the links therein, provide a description for how to synchronise changes via the website.
Alternatively, you can synchronise changes by the following command line commands.
......@@ -22,7 +22,13 @@ Add the upstream remote
.. code-block:: bash
git remote add upstream https://gitlab.eng.unimelb.edu.au/asclinic/asclinic-system.github
git remote add upstream <url-to-upstream-remote>
If you forked from the repository linked at the top of this page, then the full command is:
.. code-block:: bash
git remote add upstream https://gitlab.unimelb.edu.au/asclinic/asclinic-system.git
2. Verify that step 1 worked by observing the output displayed by the command:
......@@ -30,9 +36,20 @@ Add the upstream remote
git remote -v
The output displayed should be something like:
.. code-block:: bash
origin https://gitlab.unimelb.edu.au/pbeuchat/asclinic-system.git (fetch)
origin https://gitlab.unimelb.edu.au/pbeuchat/asclinic-system.git (push)
upstream https://gitlab.unimelb.edu.au/asclinic/asclinic-system.git (fetch)
upstream https://gitlab.unimelb.edu.au/asclinic/asclinic-system.git (push)
**Note** that these two steps above only need to be performed once for the repository.
Merge in changes from the upstream remote
*****************************************
......@@ -42,7 +59,7 @@ Merge in changes from the upstream remote
git fetch upstream
2. Checkout the, i.e., change to, the master branch of your local repository:
2. Checkout the :code:`master`, i.e., switch to the master branch of your local repository:
.. code-block:: bash
......
......@@ -7,17 +7,18 @@ Once the device is physically connected to a GPIO, and before attempting to inte
See the :ref:`GPIO page <comm-protocol-GPIO>` for details of the command line tools, and see the :ref:`SBC page <single-board-computers>` for details of the GPIO pins for the relevant SBC.
For example, if the input is connected to pin 7 of the J21 expansion header of the Jetson Xavier NX, then this corresponds to line 148 of the :code:`gpiochip0` chip. Hence you can read the value of pin 7 with the command:
For example, if the input is connected to pin 7 of the J21 expansion header of the Jetson Xavier NX, then this corresponds to line 148 of the :code:`gpiochip0` chip (:ref:`see the table here for this pin-to-line-number mapping <sbc-jetson-xavier-nx-pin-mapping>`).
Hence you can read the value of pin 7 with the command:
.. code-block:: bash
sudo gpioget gpiochip0 148
sudo gpioget gpiochip0 148
To monitor a line for multiple of a particular event, use the command:
.. code-block:: bash
sudo gpiomon --num-events=3 --rising-edge gpiochip0 148
sudo gpiomon --num-events=3 --rising-edge gpiochip0 148
To interface with a single GPIO pin via a ROS node, there are two templates provided:
......@@ -45,20 +46,25 @@ Then you can launch the template GPIO nodes with:
.. note::
**GPIOD Library:**
`This website <https://libgpiod-dlang.dpldocs.info/gpiod.html>`_ provides a comprehensive list of all the function offered by the :code:`gpiod` library for monitoring a GPIO pin.
.. note::
The line number to monitor is specified as a parameter in the launch file.
**Adding parameters to nodes in the launch file:**
The line number to monitor is specified using a :code:`<param/>` parameter tag in the launch file.
Hence, to change the line number being monitored, you simply need to change the line number parameter in the launch file and re-launch the node.
* This has the benefit that you can change the line number without needing to recompile the code.
* This has the disadvantage that you cannot specify the line number parameter when using :code:`rosrun`.
* This has the disadvantage that you cannot specify the line number parameter when using the :code:`rosrun` command to start the node.
* Be careful that two separate nodes cannot access the same GPIO line because the first nodes that runs and open are particular line blocks all other process from accessing that line.
.. note::
**Compilation flag for nodes using GPIOD:**
When you copy either template C++ file, you will need to add it to the :code:`CMakeLists.txt` file in the repository at the relative file path:
.. code-block:: bash
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment