Skip to content

Commit

Permalink
Imported upstream version '2.5.0' of 'upstream'
Browse files Browse the repository at this point in the history
  • Loading branch information
vooon committed May 5, 2023
1 parent c17dd13 commit f6633ea
Show file tree
Hide file tree
Showing 265 changed files with 36,688 additions and 26,195 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.{cpp,hpp}]
indent_style = space
indent_size = 4
10 changes: 7 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ on: [push, pull_request]
jobs:
industrial_ci:
strategy:
fail-fast: false
matrix:
env:
# - {ROS_DISTRO: melodic, ROS_REPO: testing}
- {ROS_DISTRO: melodic, ROS_REPO: main}
- {ROS_DISTRO: noetic, ROS_REPO: main}
# - {ROS_DISTRO: foxy, ROS_REPO: testing}
- {ROS_DISTRO: foxy, ROS_REPO: main}
# - {ROS_DISTRO: galactic, ROS_REPO: testing}
- {ROS_DISTRO: galactic, ROS_REPO: main}
- {ROS_DISTRO: humble, ROS_REPO: main}
- {ROS_DISTRO: rolling, ROS_REPO: testing}
env:
CCACHE_DIR: /github/home/.ccache
AFTER_INSTALL_TARGET_DEPENDENCIES: ./mavros/scripts/install_geographiclib_datasets.sh
Expand Down
263 changes: 0 additions & 263 deletions .ycm_extra_conf.py

This file was deleted.

92 changes: 61 additions & 31 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,76 @@
Contributing
============


1. Fork the repo:
![fork](http://s24.postimg.org/pfvt9sdv9/Fork_mavros.png)
2. Clone the repo (`git clone https://github.com/mavlink/mavros.git`);
3. Create a remote connection to your repo (`git remote add <remote_repo> [email protected]:<YourGitUser>/mavros.git`);
4. Create a feature/dev branch (`git checkout -b <feature_branch>`);
5. Add the changes;
6. Apply the changes by committing (`git commit -m "<message>"` or `git commit -a` and then write message; if adding new files: `git add <path/to/file.ext>`);
7. Check code style `uncrustify -c ${ROS_WORKSPACE}/src/mavros/mavros/tools/uncrustify-cpp.cfg --replace --no-backup <path/to/file.ext>`;
8. Fix small code style errors and typos;
9. Commit with description like "uncrustify" or "code style fix". Please avoid changes in program logic (separate commit are better than mix of style and bug fix);
# Contributing

1. Fork the repo. [<img src="https://upload.wikimedia.org/wikipedia/commons/3/38/GitHub_Fork_Button.png" height="30"/>](https://github.com/mavlink/mavros/fork)
2. Clone the repo into your workspace:

```bash
git clone https://github.com/mavlink/mavros.git
```

3. Create a remote connection to your repo:

```bash
git remote add origin [email protected]:<YourGitUser>/mavros.git
```

4. Create a feature/dev branch:

```bash
git checkout -b <feature_branch>
```

5. Make your changes.
6. Commit the changes. The `-a` option automatically adds and removes files for you.

```bash
git commit -a -m "<message>"
```

7. Check your code style:

```bash
uncrustify -c ${ROS_WORKSPACE}/src/mavros/mavros/tools/uncrustify-cpp.cfg --replace --no-backup <path/to/file.ext>
```

8. Fix small code style errors and typos.
9. Commit with a description like "uncrustify" or "code style fix". Please avoid changes in program logic (separate commits are better than a mix of style and bug fixes).
10. Run tests:
- with `catkin_make`, issue `catkin_make tests` and then `catkin_make run_tests`;
- with `catkin tools`, issue `catkin run_tests`;
11. If everything goes as planned, push the changes (`git push -u <remote_repo> <feature_branch>`) and issue a pull request.

- with `catkin_make`, issue `catkin_make tests` and then `catkin_make run_tests`;
- with `catkin tools`, issue `catkin run_tests`;

11. If everything goes as planned, push the changes and issue a pull request.

cog.py generators
-----------------
```bash
git push -u origin <feature_branch>
```

In many places we need to copy some data from MAVLink, and in many places we have regular patterns of code (e.g. copy message fields).
To avoid manual copy-paste work (and errors!) we use [cog.py][cog] generator/preprocessor.
Generator program written in comment blocks on Python (that allow import pymavlink), output will be inserted between markers.
As an example you may look at `utils::to_string()` implementation for some enums: [lib/enum_to_string.cpp][ets].
## cog.py generators

To install it :
In many places we need to copy some data from MAVLink, and in many places we have regular patterns of code (e.g. copied message fields).
To avoid manual copy-paste work (and errors!) we use the the [cog.py][cog] code generator/preprocessor.

pip install --user cogapp pymavlink
Cog generates C++ code from code blocks written in Python that you add into your C++ code file as specially formatted comments. Since you are now using Python, you can import and make use of the [pymavlink][pml] module, which already comes with MAVlink message definitions that you can reuse.
An example you may look at is the `utils::to_string()` implementation for some enums in [lib/enum_to_string.cpp][ets].
Then fill the behaviour you when between the `[[[cog:]]]` `[[[end]]]` balise
and invoke cog like this:
Install cog and pymavlink:
cog.py -cr your_file.h/cpp
```bash
pip install --user cogapp pymavlink
```
Your file will be updated by cog.
Add your generator code to your file as comments enclosed in the `[[[cog:]]]` and `[[[end]]]` tags. Then invoke cog so that it updates your file:
./mavros/tools/cogall.sh
```bash
cog.py -cr your_file.h/cpp
```
This script will regenerate all files with generators.
In addition, this script will re-generate all files with cog code:
```bash
./mavros/tools/cogall.sh
```
[cog]: https://nedbatchelder.com/code/cog/
[ets]: https://github.com/mavlink/mavros/blob/master/mavros/src/lib/enum_to_string.cpp
[pml]: https://mavlink.io/en/mavgen_python/
Loading

0 comments on commit f6633ea

Please sign in to comment.