Skip to content
Snippets Groups Projects
Commit b2330b76 authored by burneykb's avatar burneykb
Browse files
parents 54d5f57b c0df044e
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,11 @@ bins:
zybo:
bash scripts/build_zybo.sh
# For creating an image of the control network.
gen_diagram:
$(MAKE) -C src/gen_diagram
bash src/gen_diagram/create_png.sh
boot: $(BOOT)
test:
......
TOP=../..
QUAD_BLOCKS = ../src/graph_blocks
NAME = gen_diagram
REQLIBS = -lquad_app, -lgraph_blocks, -lcomputation_graph
gen_diagram: generate.c ../src/control_algorithm.c ../src/computation_graph.c
gcc -o gen_diagram -I. -I../src/ generate.c ../src/computation_graph.c ../src/control_algorithm.c ../src/graph_blocks/*.c -Dread_flap=freadflap -Dget_last_loop_time=fgettime
.PHONY: clean
clean:
rm gen_diagram
include $(TOP)/library.mk
\ No newline at end of file
The gen_diagram project can create an image of the controller network. Below outlines the process of how to use it.
The gen_diagram project can create an image of the controller network.
Within the `quad/sw/modular_quad_pid` directory:
1. Within the `gen_diagram` folder, run `make` to build the new code.
2. Now execute the program with `./gen_diagram`
3. If you have graphviz installed, you can run `dot -Tpng network.dot -o network.png` to generate a PNG file of the graph.
Enjoy your new diagram!
To make a new diagram, from the top-level quad directory, run "make gen_diagram".
The new network.png file show up in this folder.
\ No newline at end of file
#/bin/bash
make
./gen_diagram
dot -Tpng network.dot -o network.png
dot -Tpng "$(dirname $0)/network.dot" -o "$(dirname $0)/network.png"
File deleted
#include <stdio.h>
#include "computation_graph.h"
#include "node_pid.h"
#include "node_bounds.h"
#include "node_constant.h"
#include "node_mixer.h"
#include "PID.h"
#include "control_algorithm.h"
#define ROLL_PITCH_MAX_ANGLE 0.3490 // 20 degrees
parameter_t ps;
//int control_algorithm_init(parameter_t * ps);
int freadflap(int i) {return i;}
float fgettime() {return 0.0;}
int main() {
parameter_t ps;
control_algorithm_init(&ps);
FILE* dot_fp;
dot_fp = fopen("network.dot", "w");
......
digraph G {
rankdir="LR"
"Roll PID"[shape=record
label="<f0>Roll PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=15.000] |<f5> [Ki=0.000] |<f6> [Kd=0.200]"]
"VRPN Roll" -> "Roll PID":f1 [label="Constant"]
"Y pos PID" -> "Roll PID":f2 [label="Correction"]
"Ts_VRPN" -> "Roll PID":f3 [label="Constant"]
label="<f0>Roll PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=15.000] |<f5> [Ki=0.000] |<f6> [Kd=0.200] |<f7> [alpha=0.000]"]
"Roll" -> "Roll PID":f1 [label="Constant"]
"RC Roll" -> "Roll PID":f2 [label="Constant"]
"Ts_IMU" -> "Roll PID":f3 [label="Constant"]
"Pitch PID"[shape=record
label="<f0>Pitch PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=15.000] |<f5> [Ki=0.000] |<f6> [Kd=0.200]"]
"VRPN Pitch" -> "Pitch PID":f1 [label="Constant"]
"X pos PID" -> "Pitch PID":f2 [label="Correction"]
"Ts_VRPN" -> "Pitch PID":f3 [label="Constant"]
label="<f0>Pitch PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=15.000] |<f5> [Ki=0.000] |<f6> [Kd=0.200] |<f7> [alpha=0.000]"]
"Pitch" -> "Pitch PID":f1 [label="Constant"]
"RC Pitch" -> "Pitch PID":f2 [label="Constant"]
"Ts_IMU" -> "Pitch PID":f3 [label="Constant"]
"Yaw PID"[shape=record
label="<f0>Yaw PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=2.600] |<f5> [Ki=0.000] |<f6> [Kd=0.000]"]
label="<f0>Yaw PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=2.600] |<f5> [Ki=0.000] |<f6> [Kd=0.000] |<f7> [alpha=0.000]"]
"Yaw" -> "Yaw PID":f1 [label="Constant"]
"Yaw Setpoint" -> "Yaw PID":f2 [label="Constant"]
"Ts_VRPN" -> "Yaw PID":f3 [label="Constant"]
"Roll Rate PID"[shape=record
label="<f0>Roll Rate PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=4600.000] |<f5> [Ki=0.000] |<f6> [Kd=550.000]"]
label="<f0>Roll Rate PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=4600.000] |<f5> [Ki=0.000] |<f6> [Kd=550.000] |<f7> [alpha=0.000]"]
"dPhi" -> "Roll Rate PID":f1 [label="Constant"]
"Roll PID" -> "Roll Rate PID":f2 [label="Correction"]
"Ts_IMU" -> "Roll Rate PID":f3 [label="Constant"]
"Pitch Rate PID"[shape=record
label="<f0>Pitch Rate PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=4600.000] |<f5> [Ki=0.000] |<f6> [Kd=550.000]"]
label="<f0>Pitch Rate PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=4600.000] |<f5> [Ki=0.000] |<f6> [Kd=550.000] |<f7> [alpha=0.000]"]
"dTheta" -> "Pitch Rate PID":f1 [label="Constant"]
"Pitch PID" -> "Pitch Rate PID":f2 [label="Correction"]
"Ts_IMU" -> "Pitch Rate PID":f3 [label="Constant"]
"Yaw Rate PID"[shape=record
label="<f0>Yaw Rate PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=435480.000] |<f5> [Ki=0.000] |<f6> [Kd=0.000]"]
label="<f0>Yaw Rate PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=435480.000] |<f5> [Ki=0.000] |<f6> [Kd=0.000] |<f7> [alpha=0.000]"]
"dPsi" -> "Yaw Rate PID":f1 [label="Constant"]
"Yaw PID" -> "Yaw Rate PID":f2 [label="Correction"]
"RC Yaw" -> "Yaw Rate PID":f2 [label="Constant"]
"Ts_IMU" -> "Yaw Rate PID":f3 [label="Constant"]
"X pos PID"[shape=record
label="<f0>X pos PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=-0.015] |<f5> [Ki=-0.005] |<f6> [Kd=-0.030]"]
label="<f0>X pos PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=-0.015] |<f5> [Ki=-0.005] |<f6> [Kd=-0.030] |<f7> [alpha=0.000]"]
"VRPN X" -> "X pos PID":f1 [label="Constant"]
"X Setpoint" -> "X pos PID":f2 [label="Constant"]
"Ts_VRPN" -> "X pos PID":f3 [label="Constant"]
"Y pos PID"[shape=record
label="<f0>Y pos PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=0.015] |<f5> [Ki=0.005] |<f6> [Kd=0.030]"]
label="<f0>Y pos PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=0.015] |<f5> [Ki=0.005] |<f6> [Kd=0.030] |<f7> [alpha=0.000]"]
"VRPN Y" -> "Y pos PID":f1 [label="Constant"]
"Y Setpoint" -> "Y pos PID":f2 [label="Constant"]
"Ts_VRPN" -> "Y pos PID":f3 [label="Constant"]
"Altitude PID"[shape=record
label="<f0>Altitude PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=9804.000] |<f5> [Ki=817.000] |<f6> [Kd=7353.000]"]
label="<f0>Altitude PID |<f1> --\>Cur point |<f2> --\>Setpoint |<f3> --\>dt |<f4> [Kp=9804.000] |<f5> [Ki=817.000] |<f6> [Kd=7353.000] |<f7> [alpha=0.000]"]
"VRPN Alt" -> "Altitude PID":f1 [label="Constant"]
"Alt Setpoint" -> "Altitude PID":f2 [label="Constant"]
"Ts_VRPN" -> "Altitude PID":f3 [label="Constant"]
......@@ -100,11 +100,12 @@ label="<f0>RC Yaw |<f1> [Constant=0.000]"]
label="<f0>RC Throttle |<f1> [Constant=0.000]"]
"Signal Mixer"[shape=record
label="<f0>Signal Mixer |<f1> --\>Throttle |<f2> --\>Pitch |<f3> --\>Roll |<f4> --\>Yaw"]
"RC Throttle" -> "Signal Mixer":f1 [label="Constant"]
"P PWM Clamp" -> "Signal Mixer":f2 [label="Bounded"]
"R PWM Clamp" -> "Signal Mixer":f3 [label="Bounded"]
"Y PWM Clamp" -> "Signal Mixer":f4 [label="Bounded"]
"Ts_IMU"[shape=record
label="<f0>Ts_IMU |<f1> [Constant=0.000]"]
label="<f0>Ts_IMU |<f1> [Constant=0.005]"]
"Ts_VRPN"[shape=record
label="<f0>Ts_VRPN |<f1> [Constant=0.000]"]
label="<f0>Ts_VRPN |<f1> [Constant=0.040]"]
}
\ No newline at end of file
quad/src/gen_diagram/network.png

301 KiB | W: | H:

quad/src/gen_diagram/network.png

303 KiB | W: | H:

quad/src/gen_diagram/network.png
quad/src/gen_diagram/network.png
quad/src/gen_diagram/network.png
quad/src/gen_diagram/network.png
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment