Skip to content

Latest commit

 

History

History
104 lines (71 loc) · 2.87 KB

File metadata and controls

104 lines (71 loc) · 2.87 KB

Contributing

  1. Fork the repo.
  2. Clone the repo into your workspace:
git clone https://github.com/mavlink/mavros.git
  1. Configure remotes for upstream + your fork:
git remote rename origin upstream
git remote add origin git@github.com:<YourGitUser>/mavros.git
  1. Create a feature/dev branch:
git checkout -b <feature_branch>
  1. Make your changes.
  2. Commit the changes using the commit subject format <component>: ....
git add -A
git commit -m "plugin: <short description>"
  1. Check your code style:
ament_uncrustify --reformat
  1. Fix small code style errors and typos.
  2. Keep style-only commits separate from logic changes and use the same subject format <component>: ..., for example: mavros: uncrustify, docs: typo fixes.
  3. Source ROS and workspace environments before build/test commands:
source /opt/ros/<distro>/setup.bash
source install/setup.bash  # if workspace is already built
  1. Run tests:
colcon test --packages-select mavros mavros_extras mavros_msgs
colcon test-result --verbose
  1. If everything goes as planned, push the changes and issue a pull request.
git push -u origin <feature_branch>

Devcontainer (optional)

For a reproducible development environment, see .devcontainer/README.md.

Security reporting

For security issue reporting policy, see SECURITY.md.

cog.py generators

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 code generator/preprocessor.

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 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.

Install cog and pymavlink you need uv:

uv tool install ./tools

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:

mr-cog -cr your_file.h/cpp

In addition, this script will re-generate all files with cog code:

./tools/cogall.sh