diff --git a/Cluster/ui/Main.qml b/Cluster/ui/Main.qml index 8204aa5..17965f0 100644 --- a/Cluster/ui/Main.qml +++ b/Cluster/ui/Main.qml @@ -11,8 +11,8 @@ ApplicationWindow { flags: Qt.Window | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint // flags: Qt.Window | Qt.WindowStaysOnTopHint - // visibility: Window.FullScreen - visibility: Window.Windowed + visibility: Window.FullScreen + // visibility: Window.Windowed property int iconWidth: 65 property int iconHeight: 65 diff --git a/Cluster/ui/SignDetector.qml b/Cluster/ui/SignDetector.qml index 301d67d..911378d 100644 --- a/Cluster/ui/SignDetector.qml +++ b/Cluster/ui/SignDetector.qml @@ -73,7 +73,7 @@ Item { } if (value === 0 || path === "") { - speedSigns.clear() + // speedSigns.clear() trafficLights.clear() stopSignSource = "" yieldSignSource = "" diff --git a/Cluster/ui/SpeedDisplay.qml b/Cluster/ui/SpeedDisplay.qml index 0c2e325..0245c2b 100644 --- a/Cluster/ui/SpeedDisplay.qml +++ b/Cluster/ui/SpeedDisplay.qml @@ -75,7 +75,7 @@ Rectangle { Text { font.family: fontFamily - text: "KM/H" + text: "M/MIN" font.pixelSize: app.letterSize color: "gray" anchors.horizontalCenter: parent.horizontalCenter diff --git a/MiddleWare/src/main.cpp b/MiddleWare/src/main.cpp index b8fe608..f52d208 100644 --- a/MiddleWare/src/main.cpp +++ b/MiddleWare/src/main.cpp @@ -162,10 +162,10 @@ int main(int argc, char** argv) if (rpm >= -1000 && rpm <= 1000) { double wheel_circumference = wheelDiameter * M_PI; - double speed_kmh = rpm * wheel_circumference * 60.0 / 1000.0; + double speed_m_per_min = rpm * wheel_circumference; - std::string speed_str = std::to_string(speed_kmh); - std::cout << "Publishing speed: " << speed_str << " km/h" << std::endl; + std::string speed_str = std::to_string(speed_m_per_min); + std::cout << "Publishing speed: " << speed_str << " m/min" << std::endl; speed_pub.put(speed_str.c_str()); } } diff --git a/README.md b/README.md index 8f85af7..d007874 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,13 @@ -# Team02 RaspberryPi - Car Dashboard System +
A real-time vehicle speed and data display.
+ +## Demo + + + + +## Table of Contents + + +The **Instrument Cluster** is designed to provide real-time speed data from a PiRacer car on a graphical interface (GUI). The application is split across two devices: the **Jetson Nano** handles all the processing tasks, while the **Raspberry Pi** is used solely for rendering the Qt-based display. Both devices receive speed data simultaneously from the sensor via the Controller Area Network (CAN) protocol. The Jetson Nano processes the data for any necessary computations (such as filtering, calculations, etc.), and the Raspberry Pi renders the GUI with the processed speed data. + + + +This architecture allows for improved performance by offloading processing to the Jetson Nano while simplifying the display connection on the Raspberry Pi. Check it out the pheripherals Readme to better understand about the project architecture. + + + + + +This project offers hands-on experience with software engineering, embedded systems, and automotive communication protocols, with a focus on performance optimization through a modular system design. + + + + +### Project Goals: + + +- **Design and implement** a Qt-based graphical user interface (GUI) for displaying speed data on the Raspberry Pi. + + +- **Use the Jetson Nano** for handling all processing tasks related to speed data and mathematical calculations. + + +- **Integrate** a Raspberry Pi with an Arduino-based speed sensor using the CAN protocol. + + +- **Display real-time speed** data on the instrument cluster. + + +- **Test the application** in realistic driving scenarios. + + +- **Document** the entire project, including system architecture, software design, and implementation details. + + + + +**BONUS:** Display battery level on the instrument cluster. + + + + + + + + +### Architecture Overview + + + + + + + + +- **Jetson Nano:** Handles all the computational tasks and mathematical processing for the instrument cluster. It processes speed sensor data and other inputs before sending them to the Raspberry Pi. + + +- **Raspberry Pi:** Dedicated to rendering the GUI with Qt, displaying the processed data received from the Jetson Nano over CAN bus. + + + + +--- + + + + + + + + + + +### Built With + + + + +This section lists the major frameworks, libraries, and tools used in this project. + + + + + +#### Technologies and Frameworks + + + + + +- [](https://www.qt.io/) + + +- [](https://www.python.org/) + + +- [](https://isocpp.org/) + + + + + +#### Communication Protocols + + + + + +- [](https://en.wikipedia.org/wiki/Serial_Peripheral_Interface) + + +- [](https://en.wikipedia.org/wiki/I%2F2C) + + +- [](https://www.kvaser.com/can/) + + + + + +๐๏ธ [Check here](https://github.com/SEAME-pt/Team02-RaspberryPi/blob/80-task-object-detection-in-cluster/MiddleWare/src/can-id-reference-table.md) the CAN ID Reference Table + + + + + +#### Hardware + + + + + +- [](https://developer.nvidia.com/embedded/jetson-nano) + + +- [](https://www.raspberrypi.org/) + + +- [](https://www.arduino.cc/) + + + + + +--- + + + + + +### Usage + + +Once the application is up and running, the instrument cluster will display `real-time speed data` and the `vehicle's battery status` on an LCD screen. The data is continuously updated as it is received **via the CAN bus**. + + + + + +This project can be deployed and tested in two main environments: + + + + + +### โ Option 1: Deploy on Raspberry Pi LCD + + + + + +To deploy the interface on a Raspberry Pi with an attached LCD display: + + + + + +1. Make sure you're in the **root directory** of the repository. + + +2. Update the `.env` file located in the root directory: + + + - Change the `PI_IP_ADDRESS` to the IP address of your Raspberry Pi. + + + - Update the `CREDENTIALS` with the username (`PI_USERNAME`) and password (`PI_PASSWORD`) for your Raspberry Pi. + + + + + +2. Run the deployment script from the root repository: + + + + + + ```bash + + + ./RaspberryPi/deploy/scripts/deployToRasp.sh + + + ``` + + + + + +4. Restart the application to apply the changes. The executables will be placed in `PI_PATH_BIN` in your Raspberry Pi, make sure to change that if necessary. + + + + + +### โ Option 2: Simulate on a Local Machine + + + + + +For testing purposes, you can simulate the application on your local machine: + + + + + +1. Install the required dependencies as listed in the `requirements.txt` file. + + +2. Run the application locally using: + + + + + + ```bash + + + ./RaspberryPi/deploy/deployLocal/deployLocal.sh + + + ``` + + + + + +3. Ensure the CAN bus data is being simulated or fed into the application for testing. + + + + + +--- + + + + + +## Testing + + + + + +We use **LCOV** for test coverage analysis to ensure the reliability and quality of the codebase. Follow the steps below to run the tests: + + + + + +1. Navigate to the `RaspberryPi/tests` directory: + + + ```bash + + + cd RaspberryPi/tests + + + ``` + + + + + +2. After the tests are executed, a coverage report will be generated. Run the test script: + + + ```bash + + + ./test.sh + + + ``` + + + + + +Make sure all tests pass and the coverage meets the project's standards before submitting any changes. + + + + + +## The Team ๐ค + + +> Together, we've collaborated to bring this project to life, combining our knowledge, skills, and experience every step of the way. It has been a great journey of learning and growing as a team. + + + + + + - Rui Pires + + + - Luiza Zilio + + + - Luis Filipe Carvalho + + + - Jorge Cruz + + + + + +## Contributing + + + + + +Contributions are what make the open source community such an amazing place to learn, inspire, and create. **Any contributions you make are greatly appreciated.** + + + + + +If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again! + + + + + +1. Fork the repository + + +2. Create a new branch for your feature (`git checkout -b feature-name`) + + +3. Commit your changes (`git commit -am 'Add feature'`) + + +4. Push to the branch (`git push origin feature-name`) + + +5. Open a pull request + + + + + +--- + + + + + +## License + + + + + +Distributed under the MIT License. See `LICENSE` for more information. + + + + + +--- + + + + + +## Acknowledgments + +- **Qt Framework:** [Qt](https://www.qt.io/) โ A cross-platform framework for GUI applications. + + +- **Raspberry Pi Foundation:** [Raspberry Pi](https://www.raspberrypi.org/) โ The small, powerful computer that powers the display side of the project. + + +- **Arduino:** [Arduino](https://www.arduino.cc/) โ A versatile open-source electronics platform used for sensor data collection. + + +- **CAN Bus Protocol:** [CAN Protocol](https://www.kvaser.com/can/) โ The communication protocol used to connect different ECUs in the vehicle. \ No newline at end of file diff --git a/assets/instrumentCluster.gif b/assets/instrumentCluster.gif new file mode 100644 index 0000000..8517a52 Binary files /dev/null and b/assets/instrumentCluster.gif differ diff --git a/deploy/README.md b/deploy/README.md new file mode 100644 index 0000000..a78532d --- /dev/null +++ b/deploy/README.md @@ -0,0 +1,86 @@ + +### โ Option 1: Deploy on Raspberry Pi LCD + + + + + +To deploy the interface on a Raspberry Pi with an attached LCD display: + + + + + +1. Make sure you're in the **root directory** of the repository. + + +2. Update the `.env` file located in the root directory: + + + - Change the `PI_IP_ADDRESS` to the IP address of your Raspberry Pi. + + + - Update the `CREDENTIALS` with the username (`PI_USERNAME`) and password (`PI_PASSWORD`) for your Raspberry Pi. + + + + + +2. Run the deployment script from the root repository: + + + + + + ```bash + + + ./RaspberryPi/deploy/scripts/deployToRasp.sh + + + ``` + + + + + +4. Restart the application to apply the changes. The executables will be placed in `PI_PATH_BIN` in your Raspberry Pi, make sure to change that if necessary. + + + + + +### โ Option 2: Simulate on a Local Machine + + + + + +For testing purposes, you can simulate the application on your local machine: + + + + + +1. Install the required dependencies as listed in the `requirements.txt` file. + + +2. Run the application locally using: + + + + + + ```bash + + + ./RaspberryPi/deploy/deployLocal/deployLocal.sh + + + ``` + + + + + +3. Ensure the CAN bus data is being simulated or fed into the application for testing. diff --git a/deploy/deployLocal/CMakeLists.txt b/deploy/deployLocal/CMakeLists.txt index 1bfa5a2..26df5c7 100644 --- a/deploy/deployLocal/CMakeLists.txt +++ b/deploy/deployLocal/CMakeLists.txt @@ -27,14 +27,14 @@ include_directories(/usr/local/include) link_directories(/usr/local/lib) # Recursos Qt -qt_add_resources(QT_RESOURCES_HCA ../../Clusters/HandCluster/ui/resources.qrc) +qt_add_resources(QT_RESOURCES_HCA ../../Cluster/ui/resources.qrc) # Executรกvel principal add_executable(InstrumentClusterLocalInstance ${QT_RESOURCES_HCA} - ../../Clusters/HandCluster/src/main.cpp - ../../Clusters/HandCluster/src/InstrumentCluster.cpp - ../../Clusters/HandCluster/include/InstrumentCluster.hpp + ../../Cluster/src/main.cpp + ../../Cluster/src/InstrumentCluster.cpp + ../../Cluster/include/InstrumentCluster.hpp ) # Linka bibliotecas