[![](https://badge.fury.io/py/raccoonlab-tools.svg)](https://pypi.org/project/raccoonlab-tools/) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=PonomarevDA_tools&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=PonomarevDA_tools) [![cyphal_init.sh](https://github.com/PonomarevDA/tools/actions/workflows/cyphal_init.yml/badge.svg)](https://github.com/PonomarevDA/tools/actions/workflows/cyphal_init.yml) [![specification_checker.py](https://github.com/PonomarevDA/tools/actions/workflows/specification_checker.yml/badge.svg)](https://github.com/PonomarevDA/tools/actions/workflows/specification_checker.yml)
# Cyphal/DroneCAN nodes tools
`tools` is a collection of scripts for testing and configuration of Cyphal/CAN and DroneCAN nodes.
> This package is under development.
## 1. INSTALLATION
**1. Install the package from pypi, test.pypi or from sources**
```bash
pip install raccoonlab-tools
```
```bash
pip install -i https://test.pypi.org/simple/ raccoonlab-tools
```
```bash
git clone https://github.com/PonomarevDA/tools.git
cd tools
pip install .
```
**2. Install dependencies**
If you already have a Cyphal in your system, you probably don't need to install anything additional and have your own way of handling the environment variables and DSDL. Just check [scripts/ubuntu.sh](scripts/ubuntu.sh) script in case if you miss something.
But if you use Cyphal for the first time or deploy a project in a new system, consider to run [scripts/ubuntu.sh](scripts/ubuntu.sh) script. This script:
1. Install all recommended dependencies,
2. Clone recommended DSDL to `~/.cyphal` directory,
3. Create in `~/.cyphal` directory a `setup.sh` script that configure cyphal related environment variables and append `source $HOME/cyphal/setup.sh` to the end of your `.bashrc` file, so your shell will automatically setup the environment variables.
```bash
# By default, it installs both Cyphal and DroneCAN dependencies:
./scripts/ubuntu.sh
# Try --help option to get usage details. It allows to perform more precise installation:
./scripts/ubuntu.sh --help
```
<details><summary>Click here for details about which environment variables are required for a Cyphal application</summary>
To start with Cyphal/CAN (pycyphal, yakut, yukon) the following environment variables should be configured:
| Environment variable | Meaning |
| -------------------- | - |
| CYPHAL_PATH | Path to DSDL. Let's use the default:`$HOME/.cyphal` |
| UAVCAN__NODE__ID | The application node identifier |
| UAVCAN__CAN__IFACE | CAN iface name |
| UAVCAN__CAN__BITRATE | Arbitration/data segment bits per second |
| UAVCAN__CAN__MTU | Maximum transmission unit: 8 for classic CAN |
> Check pycyphal/yakut/yukon docs for additional details
</details>
## 2. LINUX (SOCKETCAN)
By default, DroneCAN and Cyphal/CAN uses cross-platform transport interface [Python-CAN](https://python-can.readthedocs.io/en/stable/) [CAN over Serial / SLCAN](https://python-can.readthedocs.io/en/stable/interfaces/slcan.html).
On Linux, [the socketcan interface](https://python-can.readthedocs.io/en/stable/interfaces/socketcan.html) is recommended. Unlike SLCAN, socketcan interface allows to share the same CAN interface with multiple processes, so you can run a few pycyphal scripts, yukon, yakut simultaniously.
You can run the following script:
```bash
./scripts/socketcan.sh
```
If you don't have a real CAN device, you can create a virtual CAN interface:
```bash
./scripts/socketcan.sh --virtual-can
```
Try `--help` option for more details.
For a Cyphal application after creating socketcan interface, you need to update `UAVCAN__CAN__IFACE` environment variable. Just call `source ~/.bashrc`.
## 3. USAGE
### 1. Test cyphal specification
```bash
rl-test-cyphal-specification
```
<img src="https://github.com/PonomarevDA/tools/wiki/assets/cyphal/specification_checker.gif" alt="drawing"/>
### 2. Test dronecan specification
```bash
rl-test-dronecan-specification
```
```bash
rl-test-dronecan-gps-mag-baro
```
<img src="https://github.com/PonomarevDA/tools/wiki/assets/rl-test-dronecan-specification.gif" alt="drawing"/>
### 3. Get Node Info (Cyphal / DroneCAN)
```bash
rl-get-info
```
Return:
- Online CAN-sniffers
- Detect protocol if any CAN-node is avaliable: cyphal | dronecan | none
- Show node info of Cyphal/CAN or DroneCAN node if it is avaliable
### 4. Upload firmware with st-link linux / STM32CubeProgrammer Windows
```bash
rl-upload-firmware --config PATH_TO_YAML_CONFIG
```
```bash
rl-upload-firmware --binary PATH_TO_BIN_FILE
```
There are a few ways how you can specify the path to the binary:
1. (recommended) Using a GitHub Repository. It will always download the latest released firmware.
```yaml
# config.yaml
metadata:
link: RaccoonlabDev/mini_v2_node
```
2. Direct Link to the Firmware File
```yaml
# config.yaml
metadata:
link: https://github.com/RaccoonlabDev/docs/releases/download/v1.6.5/gnss_v2_cyphal_v1.6.5_c78d47c3.bin
```
3. Using a Local Path
```yaml
# config.yaml
metadata:
link: /user/home/firmwares/node.bin
```
4. Direct .bin path with `--binary` option
### 5. Upload config
```bash
rl-config --config PATH
```
Example of yaml config file:
```yaml
# config.yaml
params:
uavcan.node_id: 31
uavcan.node.name: co.rl.mini
```
<img src="https://github.com/PonomarevDA/tools/wiki/assets/rl-dronecan-config.gif" alt="drawing"/>
### 6. Monitor
```bash
rl-monitor
```
This script is used for automated node analysis. Within a single command:
- detect the protocol (Cyphal or DroneCAN),
- detect the node type,
- check the software version and highlight if it is not the latest,
- configure it if it has not been configured yet,
- subscribes on all possible topics,
- provide basic tests and diagnostics, highlight issues,
- publish some test commands if possible,
- print all data in real time.
An example of `rl-monitor` with gnss node:
![](https://github.com/PonomarevDA/tools/wiki/assets/monitor_gnss.gif)
### 7. U-center with Cyphal GNSS
```bash
rl-ublox-center
```
For RL GNSS it is possible to run u-center over Cyphal via `gps.ubx_tx` and `gps.ubx_rx` topics.
1. Download [u-center](https://www.u-blox.com/en/product/u-center) (tested with u-center 23.08)
2. Run the u-center. On ubuntu you can use wine (`wine64 u-centersetup_v23.08/u-center_v23.08.exe`)
3. Configure the Cyphal environment
4. Run the script `rl-ublox-center`
5. Press Receiver - > Connection -> Network connection
6. Add new connection `tcp://127.0.0.1:2001`
An illustration:
<img src="https://github.com/PonomarevDA/tools/wiki/assets/gnss/ucenter/network_connection.png" alt="drawing"/>
<img src="https://github.com/PonomarevDA/tools/wiki/assets/gnss/ucenter/address.png" alt="drawing"/>
<!--
### 6. Upload cyphal parameters
### UC7-8. Check cyphal/dronecan node type by name
rl-give-node-type
### UC9. Check RL firmware version
rl-check-updates
### UC10. Check other (custom) vendors firmware version
...
### UC11-12. Create socketcan linux (real/virtual)
rl-socketcan
### UC13-14. Create slcan linux/windows -->
## 4. DEVELOPER NOTES
Deploy to [TestPyPI](https://test.pypi.org/project/raccoonlab-tools/):
```bash
./scripts/deploy.sh
```
Deploy to [PyPI](https://pypi.org/project/raccoonlab-tools/):
```bash
./scripts/deploy.sh --pypi
```
## 5. USAGE TERMS
The scripts are distributed under MIT license. In general, you can do with them whatever you want. If you find a bug, please suggest a PR or an issue.
Raw data
{
"_id": null,
"home_page": null,
"name": "raccoonlab-tools",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "cyphal, dronecan, can",
"author": null,
"author_email": "Dmitry Ponomarev <PonomarevDA96@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/0b/3b/d4874702f62738a14e04abec4795ab2da3dcf0d2dc8ad21e74bbeb0ef66f/raccoonlab_tools-0.2.0.tar.gz",
"platform": null,
"description": "[![](https://badge.fury.io/py/raccoonlab-tools.svg)](https://pypi.org/project/raccoonlab-tools/) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=PonomarevDA_tools&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=PonomarevDA_tools) [![cyphal_init.sh](https://github.com/PonomarevDA/tools/actions/workflows/cyphal_init.yml/badge.svg)](https://github.com/PonomarevDA/tools/actions/workflows/cyphal_init.yml) [![specification_checker.py](https://github.com/PonomarevDA/tools/actions/workflows/specification_checker.yml/badge.svg)](https://github.com/PonomarevDA/tools/actions/workflows/specification_checker.yml)\n\n# Cyphal/DroneCAN nodes tools \n\n`tools` is a collection of scripts for testing and configuration of Cyphal/CAN and DroneCAN nodes.\n\n> This package is under development.\n\n## 1. INSTALLATION\n\n**1. Install the package from pypi, test.pypi or from sources**\n\n```bash\npip install raccoonlab-tools\n```\n```bash\npip install -i https://test.pypi.org/simple/ raccoonlab-tools\n```\n```bash\ngit clone https://github.com/PonomarevDA/tools.git\ncd tools\npip install .\n```\n\n**2. Install dependencies**\n\nIf you already have a Cyphal in your system, you probably don't need to install anything additional and have your own way of handling the environment variables and DSDL. Just check [scripts/ubuntu.sh](scripts/ubuntu.sh) script in case if you miss something.\n\nBut if you use Cyphal for the first time or deploy a project in a new system, consider to run [scripts/ubuntu.sh](scripts/ubuntu.sh) script. This script:\n1. Install all recommended dependencies,\n2. Clone recommended DSDL to `~/.cyphal` directory,\n3. Create in `~/.cyphal` directory a `setup.sh` script that configure cyphal related environment variables and append `source $HOME/cyphal/setup.sh` to the end of your `.bashrc` file, so your shell will automatically setup the environment variables.\n\n```bash\n# By default, it installs both Cyphal and DroneCAN dependencies:\n./scripts/ubuntu.sh\n\n# Try --help option to get usage details. It allows to perform more precise installation:\n./scripts/ubuntu.sh --help\n```\n\n<details><summary>Click here for details about which environment variables are required for a Cyphal application</summary>\n\nTo start with Cyphal/CAN (pycyphal, yakut, yukon) the following environment variables should be configured:\n\n| Environment variable | Meaning |\n| -------------------- | - |\n| CYPHAL_PATH | Path to DSDL. Let's use the default:`$HOME/.cyphal` |\n| UAVCAN__NODE__ID | The application node identifier |\n| UAVCAN__CAN__IFACE | CAN iface name |\n| UAVCAN__CAN__BITRATE | Arbitration/data segment bits per second |\n| UAVCAN__CAN__MTU | Maximum transmission unit: 8 for classic CAN |\n\n> Check pycyphal/yakut/yukon docs for additional details\n\n</details>\n\n## 2. LINUX (SOCKETCAN)\n\nBy default, DroneCAN and Cyphal/CAN uses cross-platform transport interface [Python-CAN](https://python-can.readthedocs.io/en/stable/) [CAN over Serial / SLCAN](https://python-can.readthedocs.io/en/stable/interfaces/slcan.html).\n\nOn Linux, [the socketcan interface](https://python-can.readthedocs.io/en/stable/interfaces/socketcan.html) is recommended. Unlike SLCAN, socketcan interface allows to share the same CAN interface with multiple processes, so you can run a few pycyphal scripts, yukon, yakut simultaniously.\n\nYou can run the following script:\n\n```bash\n./scripts/socketcan.sh\n```\n\nIf you don't have a real CAN device, you can create a virtual CAN interface:\n\n```bash\n./scripts/socketcan.sh --virtual-can\n```\n\nTry `--help` option for more details.\n\nFor a Cyphal application after creating socketcan interface, you need to update `UAVCAN__CAN__IFACE` environment variable. Just call `source ~/.bashrc`.\n\n## 3. USAGE\n\n### 1. Test cyphal specification\n\n```bash\nrl-test-cyphal-specification\n```\n\n<img src=\"https://github.com/PonomarevDA/tools/wiki/assets/cyphal/specification_checker.gif\" alt=\"drawing\"/>\n\n### 2. Test dronecan specification\n\n```bash\nrl-test-dronecan-specification\n```\n\n```bash\nrl-test-dronecan-gps-mag-baro\n```\n\n<img src=\"https://github.com/PonomarevDA/tools/wiki/assets/rl-test-dronecan-specification.gif\" alt=\"drawing\"/>\n\n### 3. Get Node Info (Cyphal / DroneCAN)\n\n```bash\nrl-get-info\n```\n\nReturn:\n- Online CAN-sniffers\n- Detect protocol if any CAN-node is avaliable: cyphal | dronecan | none\n- Show node info of Cyphal/CAN or DroneCAN node if it is avaliable\n\n### 4. Upload firmware with st-link linux / STM32CubeProgrammer Windows\n\n```bash\nrl-upload-firmware --config PATH_TO_YAML_CONFIG\n```\n\n```bash\nrl-upload-firmware --binary PATH_TO_BIN_FILE\n```\n\nThere are a few ways how you can specify the path to the binary:\n\n1. (recommended) Using a GitHub Repository. It will always download the latest released firmware.\n\n```yaml\n# config.yaml\nmetadata:\n link: RaccoonlabDev/mini_v2_node\n```\n\n2. Direct Link to the Firmware File\n\n```yaml\n# config.yaml\nmetadata:\n link: https://github.com/RaccoonlabDev/docs/releases/download/v1.6.5/gnss_v2_cyphal_v1.6.5_c78d47c3.bin\n```\n\n3. Using a Local Path\n\n```yaml\n# config.yaml\nmetadata:\n link: /user/home/firmwares/node.bin\n```\n\n4. Direct .bin path with `--binary` option\n\n### 5. Upload config\n\n```bash\nrl-config --config PATH\n```\n\nExample of yaml config file:\n\n```yaml\n# config.yaml\nparams:\n uavcan.node_id: 31\n uavcan.node.name: co.rl.mini\n```\n\n<img src=\"https://github.com/PonomarevDA/tools/wiki/assets/rl-dronecan-config.gif\" alt=\"drawing\"/>\n\n### 6. Monitor\n\n```bash\nrl-monitor\n```\n\nThis script is used for automated node analysis. Within a single command:\n- detect the protocol (Cyphal or DroneCAN),\n- detect the node type,\n- check the software version and highlight if it is not the latest,\n- configure it if it has not been configured yet,\n- subscribes on all possible topics,\n- provide basic tests and diagnostics, highlight issues,\n- publish some test commands if possible,\n- print all data in real time.\n\nAn example of `rl-monitor` with gnss node:\n\n![](https://github.com/PonomarevDA/tools/wiki/assets/monitor_gnss.gif)\n\n### 7. U-center with Cyphal GNSS\n\n```bash\nrl-ublox-center\n```\n\nFor RL GNSS it is possible to run u-center over Cyphal via `gps.ubx_tx` and `gps.ubx_rx` topics.\n\n1. Download [u-center](https://www.u-blox.com/en/product/u-center) (tested with u-center 23.08)\n2. Run the u-center. On ubuntu you can use wine (`wine64 u-centersetup_v23.08/u-center_v23.08.exe`)\n3. Configure the Cyphal environment\n4. Run the script `rl-ublox-center`\n5. Press Receiver - > Connection -> Network connection\n6. Add new connection `tcp://127.0.0.1:2001`\n\nAn illustration:\n\n<img src=\"https://github.com/PonomarevDA/tools/wiki/assets/gnss/ucenter/network_connection.png\" alt=\"drawing\"/>\n\n<img src=\"https://github.com/PonomarevDA/tools/wiki/assets/gnss/ucenter/address.png\" alt=\"drawing\"/>\n\n<!--\n\n### 6. Upload cyphal parameters\n\n### UC7-8. Check cyphal/dronecan node type by name\n\nrl-give-node-type\n\n### UC9. Check RL firmware version\n\nrl-check-updates\n\n### UC10. Check other (custom) vendors firmware version\n\n...\n\n### UC11-12. Create socketcan linux (real/virtual)\n\nrl-socketcan\n\n### UC13-14. Create slcan linux/windows -->\n\n## 4. DEVELOPER NOTES\n\nDeploy to [TestPyPI](https://test.pypi.org/project/raccoonlab-tools/):\n\n```bash\n./scripts/deploy.sh\n```\n\nDeploy to [PyPI](https://pypi.org/project/raccoonlab-tools/):\n\n```bash\n./scripts/deploy.sh --pypi\n```\n\n## 5. USAGE TERMS\n\nThe scripts are distributed under MIT license. In general, you can do with them whatever you want. If you find a bug, please suggest a PR or an issue.\n",
"bugtrack_url": null,
"license": null,
"summary": "RaccoonLab tools",
"version": "0.2.0",
"project_urls": {
"Bug Tracker": "https://github.com/PonomarevDA/tools/issues",
"Homepage": "https://github.com/PonomarevDA/tools"
},
"split_keywords": [
"cyphal",
" dronecan",
" can"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e09608cf3d84095c2d137e274ed09bf5586d8194c8233daf294d7f1405b338e6",
"md5": "c4acc724e9ec1194ec90f1d0a58b4a46",
"sha256": "116eef80c81116cfeeaf3fd9dc9ec3cdcdf4271d16864bc68de6c489aac23433"
},
"downloads": -1,
"filename": "raccoonlab_tools-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c4acc724e9ec1194ec90f1d0a58b4a46",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 69117,
"upload_time": "2024-12-07T04:58:36",
"upload_time_iso_8601": "2024-12-07T04:58:36.398884Z",
"url": "https://files.pythonhosted.org/packages/e0/96/08cf3d84095c2d137e274ed09bf5586d8194c8233daf294d7f1405b338e6/raccoonlab_tools-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0b3bd4874702f62738a14e04abec4795ab2da3dcf0d2dc8ad21e74bbeb0ef66f",
"md5": "20d76a61c927bc72b666c189c692ab9b",
"sha256": "d1c6a5641ba117ee35fc6af4326580b0dac4ffa8571ca27d02783c576963e41a"
},
"downloads": -1,
"filename": "raccoonlab_tools-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "20d76a61c927bc72b666c189c692ab9b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 47377,
"upload_time": "2024-12-07T04:58:38",
"upload_time_iso_8601": "2024-12-07T04:58:38.748976Z",
"url": "https://files.pythonhosted.org/packages/0b/3b/d4874702f62738a14e04abec4795ab2da3dcf0d2dc8ad21e74bbeb0ef66f/raccoonlab_tools-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-07 04:58:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PonomarevDA",
"github_project": "tools",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "pyserial",
"specs": []
},
{
"name": "python-can",
"specs": [
[
"==",
"4.3"
]
]
},
{
"name": "pytest",
"specs": []
}
],
"lcname": "raccoonlab-tools"
}