We named this GUI as: cfmarslab.
This repository is a GUI-based control interface for the NCKU-Quadrotor-Navigation project.
This is project is also suit to anyone who is bridging MATLAB and Crazyflie 2.1/Bolt in UAV control, and of course, using Vicon as the 6DOF source.
-
Connection & Telemetry
- Connect, Disconnect, and Scan buttons with channel, bitrate, and address selectors plus MRU URI history
- Top-right readouts show latency, RSSI, and VBAT, while a second row reports P95/P99 jitter and deadline miss percentage from the active control loop
-
XYZ → MATLAB (UDP 51002)
- Enter X, Y, Z targets, choose a Rate (Hz), and Start or Stop streaming coordinates via UDP 51002; values transmit as little‑endian floats at the selected rate
-
2‑PID Controls
- Start/Stop the RPYT setpoint loop, set Rate (Hz), and monitor the loop’s Actual frequency in real time
-
4‑PID Controls (PWM)
- Switch between Manual entry and UDP 8888, manage Start/Stop and Rate (Hz), and view the loop’s Actual rate for feedback
-
Safety actions
- Emergency stop instantly zeros RPYT or motor outputs; Land (ramp down) gradually reduces thrust for a controlled descent
-
Vicon (UDP 51001)
- Start/stop the receiver, monitor live X/Y/Z values, set target Rate (Hz), define X/Y/Z bounds with Apply, and use Show trail (s) plus Decimate to manage plotting load
- The 3D plot marks the current point and draws a time-limited trail in real time
-
3D View & Controls
- A Matplotlib 3D scene with tight margins occupies the right pane; vertical Elevation and horizontal Azimuth sliders rotate the view interactively
The GUI's PWM receiver listens on 127.0.0.1:8888 and updates only when a frame of eight bytes is received. Each frame must encode four unsigned 16-bit motor values in little-endian order (<4H>).
MATLAB helper
bytes = pack_pwm_u16_bytes(m1, m2, m3, m4);
u = udpport("byte", "OutputDatagramSize", 8);
write(u, bytes, "uint8", "127.0.0.1", 8888);Simulink blocks
- Cast each motor signal to
uint16. - Use a Byte Pack block configured for four
uint16elements with little-endian output (uint8[8]). - Connect to a UDP Send block set for packet size
8, remote address127.0.0.1, and port8888.
The GUI ignores frames that are not exactly eight bytes—for example, sending four single values (16 bytes) will be discarded. If the port becomes busy, use Clear UDP 8888 in the GUI to free it before retrying.
- Launch the GUI, set radio channel/bitrate/address, and click Connect.
- (Optional) Start Vicon or begin XYZ → MATLAB streaming at the desired rate.
- Arm and start either 2‑PID Controls or 4‑PID Controls (PWM), tuning rates as needed.
- Observe telemetry, timing metrics, and the 3D view; adjust bounds, trails, or camera angles.
- Use Land or Emergency stop, clear the console if needed, then Disconnect.
-
src/cfmarslab-
ui.pyTk GUI, top telemetry, 3D plot, tabs
-
control.pySetpointLoop (RPYT), PWMSetpointLoop, UDPInput, PWMUDPReceiver
-
models.pyshared state/model
-
link.pyCrazyflie link/commander wrapper
-
vicon.pyUDP 51001 receiver (x,y,z,rot) for 3D/trail
-
config.pyapp config: rates, safety, persistence
-
- Began development of the GUI project
- Completed integration between Python control code, MATLAB, and Crazyflie
- Designed first GUI version for operator-friendly control

- Refactored original single
.pyinto multiple modular files for easier upgrades and maintenance - Improved GUI layout for better usability

With the control frequency demands increased, it is better for us to use C as the control loop, in order to ensre the stability in flight control.