|
| 1 | +# NASA Space ROS Sim Summer Sprint Challenge |
| 2 | + Team lead freelance username: Barisyaz |
| 3 | + Submission title: Ingenuity Flight Simulator |
| 4 | + |
| 5 | +# Ingenuity Flight Simulator |
| 6 | + |
| 7 | +This project simulates the Ingenuity Mars Helicopter using Gazebo and ROS 2 in Space-ROS. |
| 8 | + |
| 9 | +Aim of this project is to develop tools to mimic the Martian environment as close as possible. This enables space robots to easily iterate over the development cycles. This is important especially for the aerial vehicles. Because the air is much thinner and the nature events are different. Having this in mind, I develop the Ingenuity Flight Simulator, calculating the lift and drag forces as close to the Martian atmosphere and gravity as possible. This could enable Nasa engineers to develop controllers that can react to the nature events or test flight controllers with sensor noise such as IMU, altimeter or Camera. |
| 10 | + |
| 11 | +## Structure |
| 12 | + |
| 13 | +Each folder is a ROS 2 package. Each package has their own README.md file explaining the APIs and usage examples. |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +- Docker |
| 18 | +- NVIDIA GPU (optional, but recommended for better performance) |
| 19 | + |
| 20 | +## Setup |
| 21 | + |
| 22 | +This project builds on `openrobotics/space_robots_demo` docker image. To build that docker image follow the instructions at this [README](https://github.com/space-ros/docker/blob/main/moveit2/README.md). To build that image, you also need to build the spaceros base image. You can access that [here](https://github.com/space-ros/space-ros). |
| 23 | + |
| 24 | +After ensuring you have the `openrobotics/space_robots_demo` docker image. Go ahead and clone this repo. |
| 25 | + |
| 26 | +1. Clone this repository: |
| 27 | + ```bash |
| 28 | + git clone [email protected]:BarisYazici/demos.git |
| 29 | + git checkout feat/ingenuity-helicopter-simulation |
| 30 | + |
| 31 | + ``` |
| 32 | + |
| 33 | +2. Build the Ingenuity Flight Simulator image: |
| 34 | + ```bash |
| 35 | + cd ingenuity_flight_simulator |
| 36 | + ./build.sh |
| 37 | + ``` |
| 38 | + |
| 39 | +## Running the Simulation |
| 40 | + |
| 41 | +First run the following to allow GUI passthrough: |
| 42 | +```bash |
| 43 | +xhost +local:docker |
| 44 | +``` |
| 45 | + |
| 46 | +To start the simulation, run: |
| 47 | +```bash |
| 48 | +./run.sh |
| 49 | +``` |
| 50 | + |
| 51 | +while the simulation is running in another terminal: |
| 52 | + |
| 53 | +```bash |
| 54 | +docker exec -it ingenuity_flight_simulator bash |
| 55 | +``` |
| 56 | + |
| 57 | +to view all the topics coming from the simulator do: |
| 58 | + |
| 59 | +```bash |
| 60 | +ign topic -l |
| 61 | +``` |
| 62 | + |
| 63 | +As an example you can subscribe to the /imu topic published from the ingenuity's body. |
| 64 | + |
| 65 | +```bash |
| 66 | +ign topic -et /imu |
| 67 | +``` |
| 68 | + |
| 69 | + |
| 70 | +This will launch the Gazebo simulation with the Ingenuity model. Gazebo simulation GUI and RViz will pop up in new windows. By default, the Ingenuity's flight controller is activated and hovers the Martian helicopter to 10 meters of altitude. |
| 71 | + |
| 72 | + |
| 73 | +## Contribution to Simulation and Control of Ingenuity |
| 74 | + |
| 75 | +To control the ingenuity helicopter we need to change the angle of attack of the blade. There are two ways to change the angle of attack of the blades. First one is collective, this changes the angle of attack of the blades uniformly over the rotation of the blade. Collective control changes the altitude of the helicopter. Second way of control is cyclic control. This way we change the angle of attack interchangeably such that it creates different lift in different parts of the rotation. Cyclic control allows us to translate in x and y directions. |
| 76 | + |
| 77 | +Ingenuity flight controller plugin implements a PID controller to change the collective to reach the desired altitude published as a gazebo ignition topic. This controller doesn't yet control the attitude of the helicopter. |
| 78 | + |
| 79 | + |
| 80 | +## Demonstration |
| 81 | + |
| 82 | +Here are some GIFs demonstrating the Ingenuity in action: |
| 83 | + |
| 84 | + |
| 85 | +*Demonstrate mars dust storm* |
| 86 | + |
| 87 | + |
| 88 | +*Take-off * |
| 89 | + |
| 90 | + |
| 91 | +*Landing* |
| 92 | + |
| 93 | + |
| 94 | +*Close up view of Ingenuity* |
| 95 | + |
| 96 | + |
| 97 | +*RViz visualization integration* |
| 98 | + |
| 99 | +## Architecture |
| 100 | + |
| 101 | + |
| 102 | +Here's a diagram illustrating the architecture: |
| 103 | + |
| 104 | +```mermaid |
| 105 | +graph TD |
| 106 | + A[User Input] -->|/alpha_c, /alpha_s| D[Flight Simulation Plugin] |
| 107 | + A -->|/desired_altitude| C[Flight Control Plugin] |
| 108 | + C -->|/angle_of_attack| D |
| 109 | + D -->|Forces & Torques| E[Gazebo Physics Engine] |
| 110 | + E -->|Physics Update| F[Ingenuity Model] |
| 111 | + F -->|State Feedback| E |
| 112 | + E -->|Model State| D |
| 113 | + D -->|Telemetry| G[Visualization] |
| 114 | + |
| 115 | + subgraph Gazebo Simulation |
| 116 | + E |
| 117 | + F |
| 118 | + end |
| 119 | + |
| 120 | + subgraph Gazebo Plugins |
| 121 | + C |
| 122 | + D |
| 123 | + end |
| 124 | + |
| 125 | + classDef userInput fill:#f9f,stroke:#333,stroke-width:2px; |
| 126 | + classDef gazebo fill:#cfc,stroke:#333,stroke-width:2px; |
| 127 | + classDef spaceROS fill:#fcf,stroke:#333,stroke-width:2px; |
| 128 | + classDef visualization fill:#ccf,stroke:#333,stroke-width:2px; |
| 129 | + |
| 130 | + class A userInput; |
| 131 | + class E,F gazebo; |
| 132 | + class C,D spaceROS; |
| 133 | + class G visualization; |
| 134 | +``` |
| 135 | + |
| 136 | + |
| 137 | +## License |
| 138 | + |
| 139 | +Apache License 2.0 |
0 commit comments