- Fork the repo:
- Clone the repo (
git clone https://github.com/mavlink/mavros.git
); - Create a remote connection to your repo (
git remote add <remote_repo> git@github.com:<YourGitUser>/mavros.git
); - Create a feature/dev branch (
git checkout -b <feature_branch>
); - Add the changes;
- Apply the changes by committing (
git commit -m "<message>"
orgit commit -a
and then write message; if adding new files:git add <path/to/file.ext>
); - Check code style
uncrustify -c ${ROS_WORKSPACE}/src/mavros/mavros/tools/uncrustify-cpp.cfg --replace --no-backup <path/to/file.ext>
; - Fix small code style errors and typos;
- 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);
- Run tests:
- with
catkin_make
, issuecatkin_make tests
and thencatkin_make run_tests
; - with
catkin tools
, issuecatkin run_tests
;
- If everything goes as planned, push the changes (
git push -u <remote_repo> <feature_branch>
) and issue a pull request.
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 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.
To install it :
pip install --user cogapp pymavlink
Then fill the behaviour you when between the [[[cog:]]]
[[[end]]]
balise
and invoke cog like this:
cog.py -cr your_file.h/cpp
Your file will be updated by cog.
./mavros/tools/cogall.sh
This script will regenerate all files with generators.