diff --git a/README.md b/README.md index f74c8b4..113f26c 100644 --- a/README.md +++ b/README.md @@ -19,109 +19,12 @@ Assignments made for the first semester of ROS2 ## System Architecture -The TI Minor Grade Generator is a ROS2-based distributed system for managing student exam results and calculating final grades. The system follows a microservices architecture with clear separation of concerns. - -### Overview - -The system consists of multiple ROS2 nodes that communicate through topics and services to process exam data, calculate grades, and store the results in a database. - -### Components - -#### Core Nodes - -1. **ExamResultGenerator** (`assignments::one::exam_resutl_generator`) - - Publishes random exam results for students and courses - - Simulates exam result generation for testing and demonstration - - ([Full documentation](doc/nodes/ExamResultGenerator.md)) - -2. **FinalGradeDeterminator** (`assignments::one::final_grade_determinator`) - - Collect grades from ExamResultGenerator - - Send results to the GradeCalculator - - Put resulting grade in the Database - - ([Full documentation](doc/nodes/FinalGradeDeterminator.md)) - -3. **GradeCalculator** (`assignments::one::grade_calculator`) - - Provides ROS2 service for calculating student exam grades - - Ensures grade results are within valid bounds (10-100) - - ([Full documentation](doc/nodes/GradeCalculator.md)) - -#### Database Management - -- **DatabaseManager**: Handles all database operations including storing final course results -- ([Full documentation](doc/DatabaseManager.md)) - -#### Configuration Management - -- **ConfigManager**: Loads and validates system configuration from TOML files -- Provides runtime access to configuration parameters for all nodes -- Ensures consistent environment setup and error handling for misconfigurations -- ([Full documentation](doc/ConfigManager.md)) - -#### Message Interfaces - -- **Exam Messages** (`g2_2025_interfaces::msg::Exam`): Contains student name, course name, result, and timestamp -- **Student Messages** (`g2_2025_interfaces::msg::Student`): Contains student and course information with timestamp -- **Grade Calculation Service** (`g2_2025_interfaces::srv::Exams`): Service interface for grade calculation requests - -### Workflow - -1. **Exam Result Collection**: Exam results are published to the `exam_results` topic -2. **Result Aggregation**: FinalGradeDeterminator collects results until the configured threshold is met -3. **Grade Calculation**: When enough results are available, a service call is made to GradeCalculator -4. **Result Processing**: Calculated grades are published and stored in the database -5. **Student Management**: Final student information is published to `student_course_management` topic as this stops the random generation of grades -6. **Retake scheduler**: Schedule an exam retake for the grades below 55 by resending information to `student_course_management` as this will re-enable grade generation -7. **Retake grade determination**: repeat steps 1 through 6 using the `retake_grade_determinator` node instead of `final_grade_determinator` until every student hase a passing grade - -### Configuration - -The system uses TOML configuration files for environment-specific settings: -- Database connection parameters -- ROS2 node configurations -- Grade collection thresholds +For the complete system architecture see [architecture.md](doc/architecture/architecture.md) located in the `doc/architecture` folder ### Testing -Unit tests are implemented using Google Test framework: -- Mock services and database managers for isolated testing -- Parameterized tests for various grade calculation scenarios -- Documentation on the tests are located in the full documentation of the nodes themselves +The testing documentation can be found in the [doc/tests](doc/tests/) folder for each node ## Installation -### Prerequisites - -- ROS2 Jazzy or newer installed ([ROS2 Installation Guide](https://docs.ros.org/en/jazzy/Installation.html)) -- CMake (version 3.8+) -- Python 3.8+ -- libtomlplusplus-dev -- libpqxx-dev -- Colcon build tool -- Docker compose - -### Clone the Repository - -```bash -git clone https://git.wessel.gg/inholland/ros2-assignments.git -cd ros2-assignments -``` - -### Build the Workspace - -```bash -colcon build -``` -Any parameters can be changed before building by editing the `grade_calculator.launch.xml` in the launch folder - -### Source the Workspace - -```bash -source install/setup.bash -``` - -### Run the System - -```bash -sudo docker-compose up -ros2 launch g2_2025_grade_calculator_pkg grade_calculator.launch.xml -``` +For installation instructions see [Installation.md](doc/installation/installation.md) located in the `doc/installation` folder diff --git a/doc/architecture/architecture.md b/doc/architecture/architecture.md index 06bae16..bd59016 100644 --- a/doc/architecture/architecture.md +++ b/doc/architecture/architecture.md @@ -2,7 +2,8 @@ ## Project Overview -The TI Minor Grade Generator is a distributed ROS2-based system designed to manage student exam results and calculate final course grades. The system follows microservices architecture principles with clear separation of concerns and robust data management. +Giving marks to students cost a lot of time and pain. For this a automatic solution is needed. +Therefore the overall Software architect (Tilmann K.) has designed a solution for the ROS2 architecture. ## System Architecture @@ -14,9 +15,8 @@ The system consists of multiple ROS2 nodes that communicate through standardized - **Microservices Architecture**: Each component has a single responsibility - **Asynchronous Communication**: Uses ROS2 topics and services for loose coupling -- **Data Persistence**: Centralized database management for reliable storage -- **Configurable Parameters**: TOML-based configuration for environment flexibility -- **Comprehensive Testing**: Unit and integration tests ensure reliability +- **Data Persistence**: Centralized database management for datastorage +- **Comprehensive Testing**: Unit tests ensure code reliability ## System Components @@ -145,3 +145,7 @@ max_grade = 100 level = "INFO" output_file = "grade_system.log" ``` + +## Testing + +The testing documentation can be found in the [doc/tests](/doc/tests/) folder for each node diff --git a/doc/architecture/interfaces/interfaces.md b/doc/architecture/interfaces/interfaces.md index 72f58d8..c6192aa 100644 --- a/doc/architecture/interfaces/interfaces.md +++ b/doc/architecture/interfaces/interfaces.md @@ -88,20 +88,23 @@ string course_name #### Result ``` -# Empty result section - completion indicates success +float32 result ``` #### Feedback ``` -float32 result +string status ``` **Goal Fields**: - `student_name`: Student for which a retake is requested - `course_name`: Course for which a retake is requested -**Feedback Fields**: -- `result`: Progress indicator or intermediate result (float value) +**Result Field** +- `result`: Progress indicator or intermediate result (float value) (*Not Implemented*) + +**Feedback Field**: +- `status`: Status indicator (*Not Implemented*) **Usage**: Used by RetakeScheduler node to handle long-running retake management operations with progress feedback. @@ -135,7 +138,7 @@ float32 result **Publishers**: - **Topic**: `student_course_management` - **Message Type**: `g2_2025_interfaces::msg::Student` -- **Purpose**: Communicate end of enrollment or re-enrolment +- **Purpose**: Communicate end of enrollment when grade has been calculated ### GradeCalculator Node @@ -164,7 +167,3 @@ float32 result - **Topic**: `retake_results` - **Message Type**: `g2_2025_interfaces::msg::Exam` - **Purpose**: Processes completed retake exam results - -## Related Documentation - -- [System Architecture](../Orig.md): Overall system design and communication patterns diff --git a/doc/architecture/nodes/ExamResultGenerator.md b/doc/architecture/nodes/ExamResultGenerator.md index 2f7fadb..ff760e8 100644 --- a/doc/architecture/nodes/ExamResultGenerator.md +++ b/doc/architecture/nodes/ExamResultGenerator.md @@ -40,4 +40,3 @@ ExamResultGenerator() **`void add_student_course_combination(const StudentCourse& sc)`** - Enrolls student into course via database - Adds combination to processing queue - diff --git a/doc/architecture/nodes/FinalGradeDeterminator.md b/doc/architecture/nodes/FinalGradeDeterminator.md index 57ee589..13395a2 100644 --- a/doc/architecture/nodes/FinalGradeDeterminator.md +++ b/doc/architecture/nodes/FinalGradeDeterminator.md @@ -32,11 +32,8 @@ FinalGradeDeterminator() - Sends async request with collected exam grades for the student-course combination - Uses callback to handle service response - **`void grade_calculator_response(rclcpp::Client::SharedFuture future, StudentCourse studentCourseCombo)`** - Verifies database connection - Publishes final student message to ROS2 topic - Logs final grade information - Stores final course result in database - - diff --git a/doc/tests/DatabaseManager.md b/doc/tests/DatabaseManager.md index e09a8be..b90b1ab 100644 --- a/doc/tests/DatabaseManager.md +++ b/doc/tests/DatabaseManager.md @@ -1,5 +1,3 @@ - - ## Unit Tests Unit tests for `DatabaseManager` are implemented in `src/g2_2025_grade_calculator_pkg/test/DatabaseManager.test.cpp` using Google Test and ROS2 test utilities. The tests are designed to work reliably whether a database connection is available or not, focusing on error handling and method behavior validation. diff --git a/doc/tests/ExamResultGenerator.md b/doc/tests/ExamResultGenerator.md index b1b7882..7fbbf7f 100644 --- a/doc/tests/ExamResultGenerator.md +++ b/doc/tests/ExamResultGenerator.md @@ -1,4 +1,3 @@ - ## Unit Tests Unit tests for `ExamResultGenerator` are implemented in `src/g2_2025_grade_calculator_pkg/test/ExamResultGenerator.test.cpp` using Google Test and ROS2 test utilities. The tests use a test subscriber node to capture published messages and validate node behavior.