Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
673fc4b
Init commit for flight-sim
Blobosle Sep 7, 2025
83f8112
Renamed file
Blobosle Sep 7, 2025
6b03330
Removed files
Blobosle Sep 7, 2025
1851068
added sfml graphics library
mattman2864 Sep 7, 2025
0bbe619
uploaded abstract class for physics objects
sebastianting Sep 9, 2025
18977d3
Cleanup
Blobosle Sep 14, 2025
692ece4
Recovered
Blobosle Sep 14, 2025
1065000
Cmake config
Blobosle Sep 14, 2025
6411303
Setup bash script
Blobosle Sep 14, 2025
9011b1e
Formatted file
Blobosle Sep 14, 2025
9946771
graphics library working
mattman2864 Sep 14, 2025
bcd57fb
Merge branch 'flight-sim' of https://github.com/embedded-purdue/slayt…
mattman2864 Sep 14, 2025
4cf2f19
moved graphics into correct folder
mattman2864 Sep 14, 2025
4489b4a
Basic UDP server/client loop
frankschlehofer Sep 14, 2025
ddbff44
enet setup
Blobosle Sep 14, 2025
e84f730
Basic Rigid Body, free-flight motion of a rigid UAV in 3D space, unde…
rkcetin Sep 14, 2025
8e87a84
Init commit for flight-sim
Blobosle Sep 7, 2025
47fa6b5
Renamed file
Blobosle Sep 7, 2025
45fde7a
Removed files
Blobosle Sep 7, 2025
415f971
added sfml graphics library
mattman2864 Sep 7, 2025
aa336c5
graphics library working
mattman2864 Sep 14, 2025
052287c
uploaded abstract class for physics objects
sebastianting Sep 9, 2025
9e3995a
Cleanup
Blobosle Sep 14, 2025
5ea7038
Recovered
Blobosle Sep 14, 2025
264667a
Cmake config
Blobosle Sep 14, 2025
02dbe5d
Setup bash script
Blobosle Sep 14, 2025
532d6e8
Formatted file
Blobosle Sep 14, 2025
783a58b
moved graphics into correct folder
mattman2864 Sep 14, 2025
302d063
basic 2d mesh renderer complete
mattman2864 Sep 16, 2025
5cc16c0
Merge branch 'flight-sim' into flight-sim-enetlib
Blobosle Sep 17, 2025
44edab3
Merge pull request #31 from embedded-purdue/flight-sim-enetlib
Blobosle Sep 17, 2025
1a058e8
Refactored directory structure
Blobosle Sep 17, 2025
6ba0388
add the update loop, updates every 1/60th of second
sebastianting Sep 18, 2025
4dc1321
Merged flight-sim with flight_sim/udp_setup
frankschlehofer Sep 21, 2025
6078b54
2d mesh renderer
mattman2864 Sep 21, 2025
7af9dda
flight graphics folder removed
mattman2864 Sep 21, 2025
f2c9a29
Deleted build directory
Blobosle Sep 21, 2025
df96316
Removed graphics
Blobosle Sep 21, 2025
ea0d4ec
Changes for merge
Blobosle Sep 21, 2025
bf657ef
Merge pull request #37 from embedded-purdue/flight-graphics
Blobosle Sep 21, 2025
2ceaa60
Addded graphics ignore
Blobosle Sep 21, 2025
665815c
Cleanup
Blobosle Sep 21, 2025
c93f9a6
Added shared directory
Blobosle Sep 21, 2025
af4e07a
Cmake for protobuf
Blobosle Sep 21, 2025
1b3996f
Currently can serialize protobuf headers and send them over udp conne…
frankschlehofer Sep 23, 2025
af62e4b
Removed eNet from the main.cpp
frankschlehofer Sep 23, 2025
7a7a31a
Updated timestamp type of protobuf header to just used u32 ints. Issu…
frankschlehofer Sep 25, 2025
41c5e64
Slight type change and commenting. #48
frankschlehofer Sep 25, 2025
453585d
Slight commenting change. #48
frankschlehofer Sep 25, 2025
c5eea14
Changed shared proto files for compatibility (not sure if this was a …
rkcetin Sep 28, 2025
768a3d6
fixing merge issues
mattman2864 Sep 28, 2025
2cbf61b
Update main.cpp
sebastianting Sep 28, 2025
6e7a0f4
Update main.cpp
sebastianting Sep 28, 2025
a14f007
Update rigid_body.cpp
sebastianting Sep 28, 2025
d2ed15d
Added Environment Rigid Bodies (Ground and Walls) and Implemented Col…
TheDarkLynx786 Sep 28, 2025
827cf6e
3d mesh renderer basically working now
mattman2864 Sep 30, 2025
711e272
Changed Configuration of Collision Debug Methods
TheDarkLynx786 Oct 1, 2025
4e684b7
Merged Sebastian's code and added collision checking
TheDarkLynx786 Oct 1, 2025
d13de2e
Merge pull request #54 from embedded-purdue/physics_sim_environment_s…
rkcetin Oct 2, 2025
b87ff16
Changes to cmake file
Blobosle Oct 5, 2025
856ffaa
panning fixed and dynamic window sizing
mattman2864 Oct 5, 2025
a3e87df
Added Drone Class and Operations (No Physics) + Added Get/Set for Tor…
TheDarkLynx786 Oct 13, 2025
f5ce77c
cleaned up rendering a bit
mattman2864 Oct 19, 2025
a289abc
added zoom and basic text debugging
mattman2864 Oct 19, 2025
f698986
added controls and better frame-independent movement
mattman2864 Oct 19, 2025
f7787ea
addedPIDcontrol, not finished yet
sebastianting Oct 20, 2025
8937f94
added scroll movement
mattman2864 Oct 20, 2025
d9020f5
improved readability and code style
mattman2864 Oct 26, 2025
ced0ad9
removed cmake cache from git
mattman2864 Oct 26, 2025
a01f7bd
fixed PIDcontroller now pushes drone towards target
sebastianting Oct 26, 2025
6ff4b68
Clarify build instructions in README
sebastianting Oct 26, 2025
aa059e8
Modify build instructions for clarity
sebastianting Nov 2, 2025
d865ff2
successful HELLO spi
rkcetin Nov 9, 2025
079836d
feat: spi/proto
rkcetin Nov 9, 2025
fb780b7
changed to cascading control
sebastianting Nov 9, 2025
75990e8
Merge branch 'simulator_PIDcontrol' of https://github.com/embedded-pu…
sebastianting Nov 9, 2025
0526f5f
4 decimal points guaranteed for protobuf spi communincation. Issue #59
rkcetin Nov 16, 2025
51307e0
Added contributing
Blobosle Dec 7, 2025
2565a4e
Added comments cmake
Blobosle Dec 7, 2025
205bd09
Added comments cmake
Blobosle Dec 7, 2025
2d5c72e
Updated readme
frankschlehofer Dec 7, 2025
7c92597
Merge branch 'spi-comp' of https://github.com/embedded-purdue/slayter…
frankschlehofer Dec 7, 2025
67914ee
Merge branch 'physics_sim_environment_setup' into basic_physics_body_…
TheDarkLynx786 Jan 25, 2026
46977c5
Merge branch 'spi-comp' into flight-graphics
Blobosle Jan 25, 2026
ff304d6
FlightSim/FlightSim/spi-comp
rkcetin Jan 25, 2026
de17719
Blobosle/FS/checkitforyourself merge spi-comp
Blobosle Jan 25, 2026
548a483
Merge pull request #103 from embedded-purdue/basic_physics_body_Kaan
TheDarkLynx786 Jan 25, 2026
d961d9d
Blobosle/FS/Whateber
Blobosle Jan 25, 2026
de478eb
i dont like commit formatting
Blobosle Jan 25, 2026
a745e8a
Merge pull request #105 from embedded-purdue/simulator_PIDcontrol
TheDarkLynx786 Jan 25, 2026
bccae4f
link spi_new_test.cpp with 'g++ spi_new_test.cpp ../../shared/proto/s…
rkcetin Jan 30, 2026
dafd1ca
fixed old main
sebastianting Feb 1, 2026
9bd508a
turned controller 3d x y z
sebastianting Feb 8, 2026
c241aa4
Added initial Python visualizer script
maanavjs Feb 8, 2026
b13f9b6
added waypoints and force clamping
sebastianting Feb 8, 2026
c4c30f5
added waypoints and force clamping
sebastianting Feb 8, 2026
1266c29
.
sebastianting Mar 1, 2026
f06a93b
Added New Simulation Base
TheDarkLynx786 Mar 1, 2026
3c7571c
merge
sebastianting Mar 1, 2026
52ce407
Merge branch 'Flightsim/FS/flight_sim' of https://github.com/embedded…
sebastianting Mar 1, 2026
3fdac03
graphics for physics sim
maanavjs Mar 1, 2026
4798df2
Added RC Command Parser
TheDarkLynx786 Mar 1, 2026
e113e93
merge conflict
sebastianting Mar 1, 2026
5dae600
Merge branch 'Flightsim/FS/flight_sim' of https://github.com/embedded…
sebastianting Mar 1, 2026
999c18f
merge conflicts again
sebastianting Mar 1, 2026
2210843
imu faking
sebastianting Mar 1, 2026
8362352
Main merge
Blobosle Mar 8, 2026
94b9749
Wiping
Blobosle Mar 8, 2026
ff12ced
New changes to gitignore
Blobosle Mar 8, 2026
84b7ee3
Inner gitignore
Blobosle Mar 8, 2026
fcc114f
Restructure
Blobosle Mar 8, 2026
7171492
Refactor README for clarity and remove duplicates
sebastianting Mar 8, 2026
6eef991
Reverted Cmake
Blobosle Mar 8, 2026
81a5757
Merge branch 'Flightsim/FS/flight_sim' of https://github.com/embedded…
Blobosle Mar 8, 2026
0028b22
physics to src
sebastianting Mar 8, 2026
631fe6d
fix imugeneration
sebastianting Mar 8, 2026
5457d95
Added new formatting
Blobosle Mar 8, 2026
0893d6b
Merge with unify
Blobosle Mar 8, 2026
a296a29
Reformatting changes completed
Blobosle Mar 8, 2026
5f9da67
Changes for merge
Blobosle Mar 8, 2026
9028a06
feat: graphics
Blobosle Mar 29, 2026
c870cff
todo
sebastianting Mar 29, 2026
c86ec14
Added parser
Blobosle Mar 29, 2026
38c1d16
added rc parser into main.cpp, reverted rigidbody and velocitycontrol…
sebastianting Mar 29, 2026
aeffb33
read order
sebastianting Mar 29, 2026
26fd658
reverted some changes to fix compiler error
sebastianting Apr 5, 2026
8c60bf1
Added SPI test code to 3FS branch
TheDarkLynx786 Apr 5, 2026
9119bf3
Spi Driver Class?
Apr 5, 2026
c0ef268
Added Serialization for IMU data
TheDarkLynx786 Apr 5, 2026
cc0c386
fix: changes in rc path, and cmake standard
Blobosle Apr 12, 2026
4f27ba1
feat: added temp test
Blobosle Apr 12, 2026
5a46baa
chore: cleanup of debugging statements
Blobosle Apr 12, 2026
93a96d5
Small Serialization Fixes
TheDarkLynx786 Apr 12, 2026
2c84d62
added imu generation to main
sebastianting Apr 12, 2026
ddfeccf
Why class bruh
TheDarkLynx786 Apr 12, 2026
9a835fe
feat: added migration
Blobosle Apr 26, 2026
0eb5b14
Merge branch 'main' into Flightsim/FS/flight_sim
sebastianting Apr 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@

.vscode
build

.DS_Store
62 changes: 62 additions & 0 deletions SPI_Slave_Driver/SpiTransport.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#include "SpiTransport.hpp"
#include <zephyr/logging/log.h>

LOG_MODULE_REGISTER(spi_transport, LOG_LEVEL_INF);

#define SPI_SLAVE_NODE DT_NODELABEL(spi1)

SpiTransport::SpiTransport() :
spi_dev(DEVICE_DT_GET(SPI_SLAVE_NODE)),
handshake_gpio(GPIO_DT_SPEC_GET(SPI_SLAVE_NODE, handshake_gpios)) {

// SPI Mode 0, 8-bit, Slave Mode
spi_cfg.operation = SPI_WORD_SET(8) | SPI_OP_MODE_SLAVE;
spi_cfg.frequency = 0; // External clock from Pi
spi_cfg.slave = 0;
}

int SpiTransport::init() {
if (!device_is_ready(spi_dev)) {
LOG_ERR("SPI Slave device not ready");
return -ENODEV;
}

if (!gpio_is_ready_dt(&handshake_gpio)) {
LOG_ERR("Handshake GPIO not ready");
return -ENODEV;
}

gpio_pin_configure_dt(&handshake_gpio, GPIO_OUTPUT_INACTIVE);
return 0;
}

void SpiTransport::swap_buffers() {
processed_idx = active_idx;
active_idx = (active_idx == 0) ? 1 : 0;
}

int SpiTransport::transfer_sync() {
struct spi_buf rx_buf = {
.buf = buffers[active_idx],
.len = PACKET_SIZE
};
const struct spi_buf_set rx_bufs = { .buffers = &rx_buf, .count = 1 };

// Signal Pi: "I am ready and listening"
gpio_pin_set_dt(&handshake_gpio, 1);

// This blocks until the Pi drives the clock for exactly PACKET_SIZE bytes
// and the NSS pin is toggled.
int ret = spi_read(spi_dev, &spi_cfg, &rx_bufs);

// Signal Pi: "I am busy/processing"
gpio_pin_set_dt(&handshake_gpio, 0);

if (ret == 0) {
swap_buffers();
} else {
LOG_ERR("SPI Transfer failed: %d", ret);
}

return ret;
}
38 changes: 38 additions & 0 deletions SPI_Slave_Driver/SpiTransport.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifndef SPI_TRANSPORT_HPP
#define SPI_TRANSPORT_HPP

#include <zephyr/kernel.h>
#include <zephyr/drivers/spi.h>
#include <zephyr/drivers/gpio.h>

class SpiTransport {
public:
static constexpr size_t PACKET_SIZE = 256;

SpiTransport();
int init();

/**
* @brief Pulls handshake high and waits for the Pi to send 256 bytes.
* @return 0 on success, negative error code on failure.
*/
int transfer_sync();

/**
* @brief Returns a pointer to the buffer containing the most recent data.
*/
uint8_t* get_latest_data() { return buffers[processed_idx]; }

private:
const struct device *spi_dev;
struct spi_config spi_cfg;
struct gpio_dt_spec handshake_gpio;

uint8_t buffers[2][PACKET_SIZE];
uint8_t active_idx = 0; // Buffer currently being filled by SPI
uint8_t processed_idx = 1; // Buffer available for the app to read

void swap_buffers();
};

#endif
9 changes: 9 additions & 0 deletions SPI_Slave_Driver/app.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
&spi1 {
status = "okay";
pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7 &spi1_nss_pa4>;
pinctrl-names = "default";
slave;

/* Handshake Pin: STM32 pulls this high when spi_read is called */
handshake-gpios = <&gpiog 10 GPIO_ACTIVE_HIGH>;
};
1 change: 1 addition & 0 deletions SPI_Slave_Driver/slayterHIL
Submodule slayterHIL added at 41719a
3 changes: 3 additions & 0 deletions flight_sim/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/build/

/.cache
60 changes: 27 additions & 33 deletions flight_sim/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
cmake_minimum_required(VERSION 3.22)
project(flight_sim LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")

find_package(Eigen3 3.4 REQUIRED NO_MODULE)
find_package(Eigen3 REQUIRED NO_MODULE)
find_package(Protobuf REQUIRED) # provides protobuf::libprotobuf and (often) protobuf::protoc
find_package(nlohmann_json REQUIRED) # <-- add this (apt: nlohmann-json3-dev)
# absl is a required dep of protobuf 6.x; add its include path globally
foreach(_prefix /opt/homebrew /usr/local)
if(EXISTS "${_prefix}/include/absl")
include_directories(SYSTEM "${_prefix}/include")
message(STATUS "absl headers added from ${_prefix}/include")
break()
endif()
endforeach()
# nlohmann_json vendored as include/json.hpp (single-header amalgamation)


# # DEBUG
# get_target_property(EIGEN_INC Eigen3::Eigen INTERFACE_INCLUDE_DIRECTORIES)
# message(STATUS "Eigen include path: ${EIGEN_INC}")

# ---- Proto setup -------------------------------------------------------------

Expand All @@ -24,7 +38,7 @@ protobuf_generate(
TARGET proto_lib
LANGUAGE cpp
PROTOS ${PROTO_FILES}
IMPORT_DIRS ${CMAKE_SOURCE_DIR}/../
IMPORT_DIRS ${CMAKE_SOURCE_DIR}/../ ${PROTO_DIR}
PROTOC_OUT_DIR ${GEN_PROTO_DIR}
APPEND_PATH OFF
)
Expand All @@ -41,42 +55,22 @@ target_include_directories(proto_lib PUBLIC

# ---- Executables ------------------------------------------------------------

add_executable(json_test utils/json_utils.cpp)

add_executable(${PROJECT_NAME}
src/main.cpp
src/physics/rigid_body.cpp
)

add_executable(UDPServer
src/UDPServer.cpp
)

add_executable(UDPClient
src/UDPClient.cpp
)
file(GLOB SRC_FILES "${CMAKE_SOURCE_DIR}/src/*.cpp")
# SPI files use Linux kernel headers — exclude on non-Linux platforms
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(FILTER SRC_FILES EXCLUDE REGEX ".*/spi_linux\\.cpp$")
list(FILTER SRC_FILES EXCLUDE REGEX ".*/spi_new_test\\.cpp$")
endif()

target_link_libraries(json_test
PRIVATE
nlohmann_json::nlohmann_json
)
add_executable(${PROJECT_NAME} ${SRC_FILES})

target_link_libraries(${PROJECT_NAME}
PRIVATE
proto_lib
Eigen3::Eigen
nlohmann_json::nlohmann_json
)

target_link_libraries(UDPServer
PRIVATE
proto_lib
nlohmann_json::nlohmann_json
)

target_link_libraries(UDPClient
PRIVATE
proto_lib
nlohmann_json::nlohmann_json
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/include
)

Loading
Loading