Skip to content
Snippets Groups Projects
README.md 3.34 KiB
Newer Older
bbartels's avatar
bbartels committed

bbartels's avatar
bbartels committed
The `quad/` directory contains all code that programs the quadcopter. This
includes any C libraries we have written, any HDL to program the Zybo on
bbartels's avatar
bbartels committed
the quad, and the XSDK main project that runs on the Zybo.

ktrost's avatar
ktrost committed
## Intro
bbartels's avatar
bbartels committed

ktrost's avatar
ktrost committed
There are three main portions to the system that runs the quad
- Quad Hardware
- Quad Software Drivers
- Control Loop

#### Quad Hardware
ktrost's avatar
ktrost committed
The quad hardware is located at `xsdk_workspace/system_hw_platform`. This
consists of the vhdl and associated wrapper code that specifies the hardware on
the FPGA.

Below is a block diagram of the hardware/software implementation:

![image](doc/images/FPGA_Diagram.png)

#### Quad Software Drivers
ktrost's avatar
ktrost committed
The quad software drivers is all of the code that interacts with the sensors of
 the quad and collects the data for the control loop to use.
For example receiving coordinates over wifi and  reading measurements from the
 accelerometer.
bbartels's avatar
bbartels committed

bbartels's avatar
bbartels committed
To run this application on the Zybo, we need to implement the hardware drivers,
ktrost's avatar
ktrost committed
and provide a `main` function.
This is done in `xsdk_workspace/real_quad/src` To build the XSDK project,
refer to the [XSDK instructions](xsdk_workspace/README.md).
bbartels's avatar
bbartels committed

ktrost's avatar
ktrost committed
We can also run this application on our own laptops for testing.
We call this implementation the "virtual quad".
This is modified in `src/virt_quad`.
bbartels's avatar
bbartels committed

#### Control Loop
ktrost's avatar
ktrost committed
The control loop is the algorithm that runs within the quad software drivers.
This code determines what the code should do to keep the quad flying and as
close to the waypoint
 as possible.

The main quad control application is located at `src/quad_app/`.
This entails a group of C and header files that work as drivers/interfaces to
the various sensors and communications that are on the quad.
bbartels's avatar
bbartels committed

bbartels's avatar
bbartels committed
#### Primarily Libraries and Executables
bbartels's avatar
bbartels committed

To build the libraries and executables:
bbartels's avatar
bbartels committed
```
make
bbartels's avatar
bbartels committed
```

You can also build each library individually inside their respective project
directories:
```
cd src/<project> && make
```

**NOTE**: All build artifacts will be placed in `lib` or `bin` (depending on
bbartels's avatar
bbartels committed
whether it is a library or executable, respectively)
bbartels's avatar
bbartels committed

To learn more about the makefiles, see [Makefiles.md](doc/Makefiles.md)

bbartels's avatar
bbartels committed
## Testing

bbartels's avatar
bbartels committed
#### Automated Tests
_Write tests! It makes automating things so much easier._
bbartels's avatar
bbartels committed

Run the unit and functional tests:
bbartels's avatar
bbartels committed
```
make test
```

bbartels's avatar
bbartels committed
And glad to hear you are interested in writing your own unit tests! Look at the
Peter Thedens's avatar
Peter Thedens committed
[README](/Unity/README.md) and examples in the Unity testing library at
Peter Thedens's avatar
Peter Thedens committed
[`Unity/`](/Unity/). A few notes about using Unity are [here](doc/Unity_notes.md).
bbartels's avatar
bbartels committed

bbartels's avatar
bbartels committed
#### Manually testing the hardware interface
bbartels's avatar
bbartels committed
Of course, we cannot run automated tests on code that needs the Zybo. But
we have manual tests that you can use to test each specific driver in the
bbartels's avatar
bbartels committed
hardware interface.
bbartels's avatar
bbartels committed

Look in `xsdk_workspace/real_quad/src/hw_impl_zybo_tests.c` for instructions.
bbartels's avatar
bbartels committed
Ideally, you would run these tests from the XSDK IDE.
dawehr's avatar
dawehr committed

bbartels's avatar
bbartels committed
## Sections
bbartels's avatar
bbartels committed
* [The Quad Application](src/quad_app/README.md)  
* [Quad App on the Zybo (Real Quad)](xsdk_workspace/real_quad/README.md)  
* [Quad App on Unix (Virtual Quad)](src/virt_quad/README.md)  
* [XSDK Instructions](xsdk_workspace/README.md)
bbartels's avatar
bbartels committed

bbartels's avatar
bbartels committed
## Other Documents
ktrost's avatar
ktrost committed
* [Hardware Block Diagram](doc/images/FPGA_Diagram.png)
* [Zybo Pinout Assignments](doc/zybo_pinout_assignments.md)
ktrost's avatar
ktrost committed
* [How to use Xilinx software tools](doc/how_to_use_XSDK.md)  
* [How to use the makefile structure](doc/Makefiles.md)
Peter Thedens's avatar
Peter Thedens committed
* [Unity notes](doc/Unity_notes.md)