- Debugging/Logging - 飞行日志分析
- Debugging/Logging - ULog文件格式
- 教程
- 教程 - 地面站
- 教程 - 编写应用程序
- 教程 - QGC的视频流
- 教程 - 远距离视频流
- 教程 - u-blox M8P RTK
- 新手上路
- 新手上路 - 初始设置
- 新手上路 - 安装工具链
- 安装工具链 - Mac OS
- 安装工具链 - Linux
- Linux - Advanced Linux
- 安装工具链 - Windows
- 新手上路 - Fast RTPS installation
- 新手上路 - 代码编译
- 新手上路 - 高级配置
- 新手上路 - 贡献& 开发者电话会议
- 贡献& 开发者电话会议 - GIT例程
- 贡献& 开发者电话会议 - Documentation
- 新手上路 - Licenses
- 概念解读
- 概念解读 - 飞行模式
- 概念解读 - 结构概述
- 概念解读 - 飞行控制栈
- 概念解读 - 中间件
- 概念解读 - 混控和执行器
- 概念解读 - PWM限制状态机
- Hardware
- Hardware - 自驾仪硬件
- 机型 - 统一的基础代码
- 机型 - 参考机型
- 机型 - 添加一个新的机型
- Data Links - SiK Radio
- Data Links - Wifi数传
- Data Links - 数传
- I2C总线 - SF1XX lidar
- 传感器和执行机构总线 - UAVCAN总线
- UAVCAN总线 - UAVCAN Bootloader
- UAVCAN总线 - UAVCAN固件升级
- UAVCAN总线 - UAVCAN配置
- UAVCAN总线 - UAVCAN 的各种笔记
- 传感器和执行机构总线 - UART
- UART - uLanding Radar
- 传感器和执行机构总线 - 设置云台控制
- 传感器和执行机构总线 - 相机触发器
- Hardware - 协同电脑
- 仿真
- 仿真 - 基本仿真
- 仿真 - Gazebo仿真
- 仿真 - HITL仿真
- 仿真 - 连接到ROS
- 仿真 - AirSim仿真
- 仿真 - 多机仿真
- 中间件及架构
- 中间件及架构 - uORB消息机制
- 中间件及架构 - MAVLink消息机制
- 中间件及架构 - 守护程序
- 中间件及架构 - 驱动框架
- 模块 & 命令
- 模块 & 命令 - 命令
- 模块 & 命令 - 通信
- 模块 & 命令 - 驱动
- 模块 & 命令 - 系统
- Robotics
- Robotics - 用Linux进行外部控制
- Robotics - ROS
- ROS - 在RPi上安装ROS
- ROS - MAVROS (ROS上的MAVLink)
- ROS - MAVROS外部控制例程
- ROS - 外部位置估计
- ROS - Gazebo Octomap
- Robotics - DroneKit
- Debugging/Logging
- Debugging/Logging - FAQ
- Debugging/Logging - 系统控制台
- Debugging/Logging - 自驾仪调试
- Debugging/Logging - Sensor/Topic Debugging
- Debugging/Logging - 仿真调试
- Debugging/Logging - System-wide Replay
- Debugging/Logging - 发送调试的值
- Debugging/Logging - Profiling
- Debugging/Logging - 日志记录
- 教程 - 光流
- 教程 - ecl EKF
- 教程 - 飞行前检查
- 教程 - 着陆检测
- 教程 - Linux系统下使用S.Bus驱动
- Advanced Topics
- Advanced Topics - 系统启动
- Advanced Topics - 参数&配置
- Advanced Topics - 参考参数
- Advanced Topics - 安装Intel RealSense R200的驱动
- Advanced Topics - 切换状态估计器
- Advanced Topics - 外部模块
- Advanced Topics - STM32 Bootloader
- 测试和持续集成
- 测试和持续集成 - 持续集成
- 测试和持续集成 - Jenkins持续集成环境
- 测试和持续集成 - 综合测试
- 测试和持续集成 - Docker容器
- 测试和持续集成 - 维护
贡献& 开发者电话会议 - GIT例程
Contributing code to PX4
Adding a feature to PX4 follows a defined workflow. In order to share your contributions on PX4, you can follow this example.
- Sign up for github if you haven’t already
- Fork the Firmware (see here)
- Clone your forked repository to your local computer
cd ~/wherever/
git clone https://github.com/<your git name>/Firmware.git
- Go into the new directory, initialize and update the submodules, and add the original upstream Firmware
cd Firmware
git submodule update --init --recursive
git remote add upstream https://github.com/PX4/Firmware.git
- You should have now two remote repositories: One repository is called upstream that points to the PX4 Firmware,
and one repository that points to your forked repository of the PX4 repository. - This can be checked with the following command:
git remote -v
- Make the changes that you want to add to the current master.
- Create a new branch with a meaningful name that represents your feature
you can use the commandgit checkout -b <your feature branch name>
git branch
to make sure you’re on the right branch. - Add your changes that you want to be part of the commit by adding the respective files
If you prefer having a GUI to add your files see Gitk orgit add <file name>
git add -p
. - Commit the added files with a meaningful message explaining your changes
For a good commit message, please refer to Contributing section.git commit -m "<your commit message>"
- Some time might have passed and the upstream master has changed. PX4 prefers a linear commit history and uses git rebase. To include the newest changes from upstream in your local branch, switch to your master branch
Then pull the newest commits from upstream mastergit checkout master
Now your local master is up to date. Switch back to your feature branchgit pull upstream master
and rebase on your updated mastergit checkout <your feature branch name>
git rebase master
- Now you can push your local commits to your forked repository
git push origin <your feature branch name>
- You can verify that the push was successful by going to your forked repository in your browser:
https://github.com/<your git name>/Firmware.git
There you should see the message that a new branch has been pushed to your forked repository. - Now it’s time to create a pull request (PR). On the right hand side of the “new branch message” (see one step before), you should see a green button saying “Compare & Create Pull Request”. Then it should list your changes and you can (must) add a meaningful title (in case of a one commit PR, it’s usually the commit message) and message (explain what you did for what reason. Check other pull requests for comparison)
- You’re done! Responsible members of PX4 will now have a look at your contribution and decide if they want to integrate it. Check if they have questions on your changes every once in a while.
Update Submodule
There are several ways to update a submodule. Either you clone the repository or you go in the submodule directory and follow the same procedure as in Contributing code to PX4.
Do a PR for a submodule update
This is required after you have done a PR for a submodule X repository and the bug-fix / feature-add is in the current master of submodule X. Since the Firmware still points to a commit before your update, a submodule pull request is required such that the submodule used by the Firmware points to the newest commit.
cd Firmware
- Make a new branch that describes the fix / feature for the submodule update:
git checkout -b pr-some-fix
- Go to submodule subdirectory
cd <path to submodule>
- PX4 submodule might not necessarily point to the newest commit. Therefore, first checkout master and pull the newest upstream code.
git checkout master
git pull origin master
- Go back to Firmware directory, and as usual add, commit and push the changes.
cd -
git add <path to submodule>
git commit -m "Update submodule to include ..."
git push upstream pr-some-fix
Checkout pull requests
You can test someone’s pull request (changes are not yet merged) even if the branch to merge only exists on the fork from that person. Do the following
git fetch upstream pull/<PR ID>/head:<branch name>
PR ID
is the number right next to the PR’s title (without the #) and the <branch name>
can also be found right below the PR ID
, e.g. <the other persons git name>:<branch name>
. After that you can see the newly created branch locally with
git branch
Then switch to that branch
git checkout <branch name>
Common pitfalls
Force push to forked repository
After having done the first PR, people from the PX4 community will review your changes. In most cases this means that you have to fix your local branch according to the review. After changing the files locally, the feature branch needs to be rebased again with the most recent upstream/master. However, after the rebase, it is no longer possible to push the feature branch to your forked repository directly, but instead you need to use a force push:
git push --force-with-lease origin <your feature branch name>
Rebase merge conflicts
If a conflict occurs during a git rebase
, please refer to this guide.
Pull merge conflicts
If a conflict occurs during a git pull
, please refer to this guide.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论