Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PROJECT_DIR=RaspberryPi
PI_USERNAME=team02
PI_IP_ADDRESS=100.68.239.7
PI_PATH_BIN=/opt/vehicle/bin
PI_PATH_ETC=/opt/vehicle/etc/zenoh
PI_PATH_FONTS=/opt/vehicle/etc/fonts
PI_PASSWORD=seameteam2
98 changes: 98 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build and Deploy for Raspberry Pi

on:
push:
branches:
- main
tags:
- 'v*'

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: false

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image for ARM64
run: |
docker buildx build \
-f ./RaspberryPi/deploy/dockerfiles/DockerfileDeployRasp \
--platform linux/arm64 --load \
--build-arg projectDir=$PWD/$PROJECT_DIR \
-t final-app .

- name: Extract built binaries
run: |
mkdir -p artifacts/bin
mkdir -p artifacts/config
mkdir -p artifacts/fonts

docker create --name tmpapp final-app

docker cp tmpapp:/home/$PROJECT_DIR/InstrumentClusterApp ./artifacts/bin/
docker cp tmpapp:/home/$PROJECT_DIR/MiddleWareApp ./artifacts/bin/

cp ./$PROJECT_DIR/ZenohConfig/InstrumentClusterConfig.json ./artifacts/config/
cp ./$PROJECT_DIR/ZenohConfig/MiddleWareConfig.json ./artifacts/config/

cp -r ./RaspberryPi/deploy/fonts/* ./artifacts/fonts/

git archive --format=zip HEAD -o ./artifacts/source-code.zip

cd artifacts
zip -r ../release-package.zip *
cd ..

docker rm tmpapp

- name: Get latest tag and increment
id: tag
run: |
git fetch --tags --force
git fetch origin
latest_tag=$(git tag --sort=-v:refname | head -n 1)
if [ -z "$latest_tag" ]; then
latest_tag="v1.0.0"
fi
major=$(echo $latest_tag | cut -d. -f1 | tr -d 'v')
minor=$(echo $latest_tag | cut -d. -f2)
patch=$(echo $latest_tag | cut -d. -f3)
new_tag="v$major.$minor.$((patch + 1))"
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.tag.outputs.new_tag }}
name: Release ${{ steps.tag.outputs.new_tag }}
body: |
## Raspberry Pi Release

**Includes:**
- Compiled apps (`InstrumentClusterApp`, `MiddleWareApp`)
- Zenoh config files
- Fonts
- Full source code zip

**Instructions:**
- Copy `InstrumentClusterApp` and `MiddleWareApp` to `$PI_PATH_BIN`
- Copy configs to `$PI_PATH_ETC`
- Copy fonts to `$PI_PATH_FONTS`
files: |
release-package.zip
artifacts/source-code.zip
artifacts/bin/*
env:
GITHUB_TOKEN: ${{ secrets.PAT_LUIS }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,10 @@ CMakeLists.txt.user*
*.dll
*.exe

# Build folders
tests/build/
deploy/build/
deploy/.qt/
deploy/deployLocal/build/


25 changes: 5 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,24 @@ find_package(Qt6 COMPONENTS Core Quick DBus REQUIRED)
find_package(zenohc REQUIRED)
find_package(zenohcxx REQUIRED)

# Enable Qt's Automatic MOC, UIC, and RCC
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

include_directories(Clusters/include)

# Add Resource File (QML and Other Resources)
qt_add_resources(QT_RESOURCES_ICA ./Clusters/InstrumentCluster/ui/resources.qrc)
include_directories(Clusters/HandCluster/include)
qt_add_resources(QT_RESOURCES_HCA ./Clusters/HandCluster/ui/resources.qrc)

# Define Executable Target
add_executable(InstrumentClusterApp
${QT_RESOURCES_ICA}
./Clusters/InstrumentCluster/src/main.cpp
./Clusters/src/InstrumentCluster.cpp
./Clusters/include/InstrumentCluster.hpp

)

add_executable(HandClusterApp
add_executable(InstrumentClusterApp
${QT_RESOURCES_HCA}
./Clusters/HandCluster/src/main.cpp
./Clusters/src/InstrumentCluster.cpp
./Clusters/include/InstrumentCluster.hpp
./Clusters/HandCluster/src/InstrumentCluster.cpp
./Clusters/HandCluster/include/InstrumentCluster.hpp
)

add_executable(MiddleWareApp
./MiddleWare/src/main.cpp
)

target_link_libraries(InstrumentClusterApp zenohcxx::zenohc -lm -ldl Qt6::Core Qt6::DBus Qt6::Quick)

target_link_libraries(HandClusterApp zenohcxx::zenohc -lm -ldl Qt6::Core Qt6::DBus Qt6::Quick)

target_link_libraries(MiddleWareApp PRIVATE zenohcxx::zenohc)
target_link_libraries(MiddleWareApp PRIVATE zenohcxx::zenohc)
Binary file added Clusters/HandCluster/assets/fonts/electrolize.ttf
Binary file not shown.
Binary file added Clusters/HandCluster/assets/fonts/orbitron.ttf
Binary file not shown.
Binary file added Clusters/HandCluster/assets/fonts/tektur.ttf
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Clusters/HandCluster/assets/icons/raio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Clusters/HandCluster/assets/icons/warning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Clusters/HandCluster/assets/images/car.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
#include <iostream>
#include <memory>
#include "zenoh.hxx"
#include <QVariant>
#include <QPoint>
#include <QVariantList>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QDebug>
#include <QJsonArray>
#include <QJsonObject>

using namespace zenoh;

Expand Down Expand Up @@ -33,6 +41,12 @@ class InstrumentCluster : public QObject
Q_PROPERTY(
int autonomy READ getAutonomy WRITE setAutonomy NOTIFY autonomyChanged)
Q_PROPERTY(int gear READ getGear WRITE setGear NOTIFY gearChanged)
Q_PROPERTY(QVariantMap leftLaneCoefs READ getLeftLaneCoefs WRITE setLeftLaneCoefs NOTIFY leftLaneChanged)
Q_PROPERTY(QVariantMap rightLaneCoefs READ getRightLaneCoefs WRITE setRightLaneCoefs NOTIFY rightLaneChanged)
Q_PROPERTY(QVariantList detectedObjects READ getDetectedObjects NOTIFY detectedObjectsUpdated)
Q_PROPERTY(int warningCode READ getWarningCode WRITE setWarningCode NOTIFY warningCodeChanged)
Q_PROPERTY(bool laneDeparture READ getLaneDeparture WRITE setLaneDeparture NOTIFY laneDepartureChanged)
Q_PROPERTY(int autonomyLevel READ getAutonomyLevel WRITE setAutonomyLevel NOTIFY autonomyLevelChanged)

private:
int m_speed;
Expand All @@ -44,11 +58,20 @@ class InstrumentCluster : public QObject
bool rearFogLight{false};
bool hazardLight{false};
bool parkingLight{false};
bool laneDeparture{false};
int percentage;
int autonomy;
int gear;
int gear;
int warningCode;
int autonomyLevel;

std::unique_ptr<zenoh::Session> session;
QVariantMap m_leftLaneCoefs;
QVariantMap m_rightLaneCoefs;
QVariantList m_detectedObjects;

// std::shared_ptr<zenoh::Session> sharedsession;

std::shared_ptr<zenoh::Session> session;
std::optional<zenoh::Subscriber<void>> speed_subscriber;
std::optional<zenoh::Subscriber<void>> beamLow_subscriber;
std::optional<zenoh::Subscriber<void>> beamHigh_subscriber;
Expand All @@ -66,13 +89,26 @@ class InstrumentCluster : public QObject
std::optional<zenoh::Subscriber<void>> currentCurrent_subscriber;
std::optional<zenoh::Subscriber<void>> currentPower_subscriber;
std::optional<zenoh::Subscriber<void>> currentGear_subscriber;

std::optional<zenoh::Subscriber<void>> leftLane_subscriber;
std::optional<zenoh::Subscriber<void>> rightLane_subscriber;
std::optional<zenoh::Subscriber<void>> object_subscriber;
std::optional<zenoh::Subscriber<void>> laneDeparture_subscriber;
std::optional<zenoh::Subscriber<void>> obstacleWarning_subscriber;
std::optional<zenoh::Subscriber<void>> sae0_subscriber;
std::optional<zenoh::Subscriber<void>> sae1_subscriber;
std::optional<zenoh::Subscriber<void>> sae5_subscriber;

public:
explicit InstrumentCluster(QObject* parent = nullptr);
explicit InstrumentCluster(const std::string& configFile,
QObject* parent = nullptr);
public:
explicit InstrumentCluster(std::shared_ptr<zenoh::Session> session, QObject* parent = nullptr);
~InstrumentCluster();

QVariantList getDetectedObjects() const;
void setDetectedObjects(const QVariantList& detectedObjectsList);

int getSpeed() const;
void setSpeed(int speed);

Expand Down Expand Up @@ -109,9 +145,26 @@ class InstrumentCluster : public QObject
int getGear() const;
void setGear(int value);

private:
int getWarningCode() const;
void setWarningCode(int value);

QVariantMap getLeftLaneCoefs() const;
void setLeftLaneCoefs(const QVariantMap& coefs);

QVariantMap getRightLaneCoefs() const;
void setRightLaneCoefs(const QVariantMap& coefs);

void setLaneDeparture(bool state);
bool getLaneDeparture() const;

void parseLaneData(const std::string& laneData, const std::string& laneType);
void parseObjectData(const std::string& objectData);
// std::function<void(const zenoh::Sample&)> getSpeedCallback();
void setupSubscriptions();

int getAutonomyLevel() const;
void setAutonomyLevel(int level);

signals:
void speedChanged(int speed);
void rightBlinkerChanged(bool state);
Expand All @@ -125,6 +178,16 @@ class InstrumentCluster : public QObject
void percentageChanged(int value);
void autonomyChanged(int value);
void gearChanged(int gear);
void leftLaneChanged(const QVariantMap& leftLaneCoefs);
void rightLaneChanged(const QVariantMap& rightLaneCoefs);
void detectedObjectsUpdated(const QVariantList& objects);
void warningCodeChanged(int code);
void onSpeedSample(const zenoh::Sample& sample);
void laneDepartureChanged(bool state);
void autonomyLevelChanged(int level);
#ifdef UNIT_TEST
std::function<void(const zenoh::Sample&)> getSpeedCallback();
#endif
};

#endif // INSTRUMENTCLUSTER_HPP
Loading
Loading