Skip to content

Commit

Permalink
merging from master
Browse files Browse the repository at this point in the history
  • Loading branch information
friend0 committed Nov 11, 2024
1 parent 017adc1 commit e8b4761
Show file tree
Hide file tree
Showing 9 changed files with 375 additions and 253 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Cargo.lock
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# Rerun
*.rrd

# Added by cargo

Expand Down
66 changes: 42 additions & 24 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,59 @@
# Contributing to Peng Project
# 🤝 Contributing

Thank you for your interest in contributing! Please follow these guidelines.
We welcome contributions of all kinds! Here's how you can help:

## Ways to Contribute

- 🐛 Bug Reports: Open detailed issues on GitHub
- 💡 Feature Requests: Share ideas for improvements
- 🛠️ Code Contributions: Submit pull requests
- 📚 Documentation: Improve docs and examples
- 🧪 Testing: Add test cases and improve coverage

## Getting Started

1. **Fork the repository**: Click the "Fork" button at the top right of the repository page.
2. **Clone your fork**:
```sh
git clone https://github.com/makeecat/Peng.git
```
2. **Clone your fork**:
```sh
git clone https://github.com/makeecat/Peng.git
```
3. **Navigate to the project directory**:
```sh
cd Peng
```
4. **Build and run the project**:
```sh
cargo run
```
```sh
cd Peng
```
4. **Build and run the project**:
```sh
cargo run
```

## How to Contribute

1. **Create a new branch**:
```sh
git checkout -b feature/your-feature-name
```
2. **Make your changes**.
```sh
git checkout -b feature/your-feature-name
```
2. **Make your changes**. Add tests for your changes in the inline documentation. Document public APIs
3. **Test your changes**.
```sh
cargo test
cargo fmt
cargo clippy -- -D warnings
```
4. **Commit your changes**:
```sh
git commit -m "Brief description of your changes"
```
```sh
git commit -m "Brief description of your changes"
```
5. **Push to your fork**:
```sh
git push origin feature/your-feature-name
```
```sh
git push origin feature/your-feature-name
```
6. **Create a pull request**: Go to the repository on GitHub and click "New Pull Request".

## License

By contributing, you agree that your contributions will be licensed under the [GPL-3.0 License](LICENSE).
By contributing, you agree that your contributions will be licensed under:

- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project shall be dual licensed as above, without any additional terms or conditions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
exclude = ["assets/", "CONTRIBUTING.md", "CODE_OF_CONDUCT.md", "SECURITY.md"]
name = "peng_quad"
version = "0.5.2"
version = "0.5.3"
edition = "2021"
rust-version = "1.76"
rust-version = "1.79"
authors = ["Yang Zhou <[email protected]>"]
description = "Peng is a minimal quadrotor pipeline including quadrotor dynamics, IMU simulation, various trajectory planners, PID controller and depth map rendering."
license = "MIT OR Apache-2.0"
Expand All @@ -27,12 +27,12 @@ opt-level = 3 # Enable a large amount of optimization in the dev profile for dep
codegen-units = 1 # Compile the entire crate as one unit.
lto = "thin" # Do a second optimization pass over the entire program, including dependencies.
[dependencies]
nalgebra = "0.33.0"
nalgebra = "0.33.2"
rand = { version = "0.8.5", features = ["rand_chacha"] }
rand_distr = "0.4.3"
rerun = "0.19.0"
thiserror = "1.0.63"
serde = { version = "1.0.209", features = ["derive"] }
rerun = "0.19.1"
thiserror = "2.0.1"
serde = { version = "1.0.214", features = ["derive"] }
serde_yaml = "0.9.34"
env_logger = "0.11.5"
log = "0.4.22"
Expand Down
127 changes: 69 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,81 +8,96 @@
[![dependency status](https://deps.rs/repo/github/makeecat/peng/status.svg)](https://deps.rs/repo/github/makeecat/peng)
[![Gitter](https://img.shields.io/gitter/room/peng/peng)](https://app.gitter.im/#/room/#peng:gitter.im)

## What is Peng

Peng is a minimal quadrotor autonomy framework in Rust. It includes a simulator, controller, and planner, providing a basic framework for simulating quadrotor dynamics and control.
![demo](https://raw.githubusercontent.com/makeecat/Peng/main/assets/Peng_demo.gif)

## Getting Started
## 🔍 Overview

Peng is a minimal quadrotor autonomy framework written in Rust that provides real-time dynamics simulation, trajectory planning, and control with modern visualization capabilities.

[![rerun demo](https://raw.githubusercontent.com/makeecat/Peng/main/assets/Peng_demo.gif)](https://rerun.io/viewer?url=https%3A%2F%2Fyangrobotics.com%2Ffiles%2Fpeng_v0.5.3_demo.rrd)

## 🎯 Key Features

- 🚁 **Real-time Simulation**
- High-fidelity quadrotor dynamics with configurable parameters
- IMU and depth sensor simulation
- Optional RK4 integration for accurate dynamics
- 🎮 **Advanced Control**
- PID control for position and attitude with tunable gains
- Integral windup prevention
- Support for different control frequencies
- 📍 **Rich Trajectory Planning**
- Minimum jerk line trajectory planner
- Lissajous curve planner
- Circular trajectory planner
- Obstacle avoidance planner
- Waypoint navigation planner
- Landing planner
- 📊 **Visualization & Debug**
- Real-time 3D visualization via rerun.io
- Depth map rendering
- State telemetry logging
- Configurable logging frequencies
-**Performance**
- Memory-safe and Efficient Rust implementation
- Multi-threaded depth rendering

## 🚀 Getting Started

### Prerequisites

- [Rust](https://www.rust-lang.org/tools/install)
- [rerun-cli](https://rerun.io/docs/getting-started/installing-viewer)

### Installation from Crates.io

```bash
cargo install rerun-cli # ensure you installed rerun-cli>=0.19.0 by checking rerun --version
# Install rerun-cli (ensure version >= 0.19.0)
cargo install rerun-cli
cargo install peng_quad
peng_quad config/quad.yaml
```

### Installation from Source

```bash
# Install rerun-cli (ensure version >= 0.19.0)
cargo install rerun-cli
git clone https://github.com/makeecat/Peng.git && cd Peng
git clone https://github.com/makeecat/Peng.git
cd Peng
cargo run --release config/quad.yaml
```

You can configure the simulation through config file, see [quad.yaml](config/quad.yaml) for example.

Please follow [rerun troubleshooting](https://rerun.io/docs/getting-started/troubleshooting) if you are using Linux or WSL2.

## Overview

### Quadrotor Simulator

Simulates realistic quadrotor dynamics with properties like position, velocity, orientation, angular velocity, mass, and inertia. Includes methods for updating dynamics with control inputs and simulating IMU readings and Depth map rendering.

### PID Controller
## ⚙️ Configuration

Controls position and attitude with configurable gains for proportional, integral, and derivative terms. Handles both position and attitude control.
- You can configure the simulation through config file, see [quad.yaml](config/quad.yaml) for example.
- Configure simulation parameters such as mass, inertia, and control gains.
- Configure control parameters such as PID gains.
- Configure trajectory planner parameters such as waypoints, obstacles, and trajectory type.
- Configure visualization parameters such as camera intrinsics and depth rendering.

### Trajectory Planners
## 🔧 Troubleshooting

Includes multiple planners:
If you encountered any issue with the rerun:

- Hover Planner
- Minimum Jerk Line Planner
- Lissajous Curve Planner
- Circular Trajectory Planner
- Landing Planner
- Obstacle Avoidance Planner
- Waypoint Planner
1. Verify rerun-cli version matches rerun version in [Cargo.toml](https://github.com/makeecat/Peng/blob/main/Cargo.toml):

### Obstacle Simulation

Simulates moving obstacles in the environment, with collision detection and avoidance capabilities based on potential field.

### Data Logging and Visualization
```bash
rerun --version
```

Logs comprehensive simulation data including quadrotor state, desired positions, IMU readings, and depth map rendering. Visualizes the simulation using the rerun library.
2. For Linux/WSL2 users, consult the [rerun troubleshooting](https://rerun.io/docs/getting-started/troubleshooting).

## Features
## 🗺️ Roadmap

- Realistic quadrotor dynamics simulation
- IMU sensor simulation with configurable noise parameters
- Multiple trajectory planners for diverse flight patterns
- PID controller for position and attitude control
- Obstacle generation and avoidance
- Depth map rendering based on primitives
- Integration with rerun for real-time visualization
- [ ] Wind field and environmental effects
- [ ] Motor dynamics simulation
- [ ] Multi-quadrotor simulation
- [ ] Model Predictive Control (MPC)

## TODO
## 🤝 Contributing

- [ ] Environment Effect simulation such as wind field
- [ ] Add motor speed simulation
- [ ] Multi-quadrotor simulation
- [ ] MPC controller
We welcome contributions of all kinds! Please check out the [Contributing Guidelines](CONTRIBUTING.md) for more details.

## License
## 📄 License

Peng is free, open source and permissively licensed!
Except where noted (below and/or in individual files), all code in this repository is dual-licensed under either:
Expand All @@ -93,21 +108,17 @@ Except where noted (below and/or in individual files), all code in this reposito

This means you can select the license you prefer!

## Why call it Peng?

Peng (traditional Chinese: 鵬; simplified Chinese: 鹏; pinyin: péng; Wade–Giles: p'eng) or Dapeng (大鵬) is a giant bird that transforms from a Kun (鯤; 鲲; kūn; k'un) giant fish in Chinese mythology.

The pipeline is designed to be minimal and for educational purpose.
We chose the name Peng because our pipeline is flexible and can transform to suit different needs, just like the mythical bird.
## 🐦 Why call it Peng?

Reference: https://en.wikipedia.org/wiki/Peng_(mythology)
Peng (鵬/鹏, péng), or Dapeng (大鵬), represents a mythical Chinese bird that transforms from a giant Kun (鯤/鲲) fish. This name reflects our framework's adaptability and transformative capabilities.

## Blog posts
## 📝 Blog Posts

- [Peng #1: Minimal quadrotor pipeline in Rust](https://yangrobotics.com/peng-1-minimal-quadrotor-pipeline-in-rust)
- [Peng #2: Error Handling, Configuration System and Obstacle Avoidance Planner](https://yangrobotics.com/peng-2-error-handling-configuration-system-and-obstacle-avoidance-planner)
- [Peng #3: Optimization of Depth Rendering and RK4-based Dynamics Update](https://yangrobotics.com/peng-3-optimization-of-depth-rendering-and-rk4-based-dynamics-update)

## Citation
## 📚 Citation

If you use this project in your research or work, please cite it as follows:

Expand Down
Binary file added config/peng_default_blueprint.rbl
Binary file not shown.
2 changes: 2 additions & 0 deletions config/quad.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use_rk4_for_dynamics_update: false # Enable Runge-Kutta 4th order integration fo
use_rk4_for_dynamics_control: false # Enable Runge-Kutta 4th order integration for dynamics, otherwise Euler integration is used
real_time: true # Enable real time mode. If not enabled, sim will run in fast time.

rerun_blueprint: "config/peng_default_blueprint.rbl"

simulation:
control_frequency: 200 # Frequency of control loop execution (Hz)
simulation_frequency: 1000 # Frequency of physics simulation updates (Hz)
Expand Down
2 changes: 2 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ pub struct Config {
pub mesh: MeshConfig,
/// Planner schedule configuration
pub planner_schedule: Vec<PlannerStep>,
/// Rerun blueprint path
pub rerun_blueprint: String,
/// Use rerun.io for recording
pub use_rerun: bool,
/// Render depth
Expand Down
Loading

0 comments on commit e8b4761

Please sign in to comment.