Major feat(Documentation): Complete documentation rework

Split documentation into three folders: Architecture, Testing and
Installation.

Rework and expand architecture.md alongside interfaces.md

Split all parts to do with testing from Architecture md's into Test md's

Add parameter to ExamResultGenerator node documentation
This commit is contained in:
2025-10-08 16:30:05 +02:00
parent 130b495030
commit 5e1df5367c
15 changed files with 609 additions and 131 deletions

View File

@@ -0,0 +1,43 @@
# ExamResultGenerator (`assignments::one::exam_result_generator`)
## Overview
The `ExamResultGenerator` is the core node responsible for simulating exam result generation.
It maintains a queue of student-course combinations that need exam results, generates random
grades, and publishes them to the system.
#### Implementation Details
**Parameters**
- **`delay_between_grades_ms`** (int, default: 2000): Delay (in milliseconds) between generated grades.
**Constructor**
```cpp
ExamResultGenerator()
```
- Initializes ROS2 node with name `exam_result_generator`
- Sets up random number generation infrastructure
- Creates DatabaseManager instance with node logger
- Establishes ROS2 publishers, subscribers, and timers
- Loads initial pending combinations from database
**Core Functions**
**`void queue_pending_combinations()`**
- Gets all student-course combinations needing exam results
- Populates operations queue from database
- Called at initialization and when database state changes
**`void generate_random_result()`**
- Main exam result generation executed by timer
- Selects random student-course combination from queue
- Stores result in database and publishes to ROS2 topic
**`void student_management_callback(const g2_2025_interfaces::msg::Student::SharedPtr msg)`**
- Toggles combinations in/out of processing queue
- Updates database with new enrollments
**`void add_student_course_combination(const StudentCourse& sc)`**
- Enrolls student into course via database
- Adds combination to processing queue

View File

@@ -0,0 +1,42 @@
# FinalGradeDeterminator (`assignments::one::final_grade_determinator`)
## Overview
The `FinalGradeDeterminator` node collects exam results for student-course combinations, triggers grade calculation when enough results are gathered, and stores final grades in the database. It interacts with ROS2 publishers, subscribers, and service clients to manage the grading workflow.
#### Implementation Details
**Parameters**
- **`grade_collection_amount`** (int, default: 5): Number of exam results required before triggering grade calculation for a student-course combination.
**Constructor**
```cpp
FinalGradeDeterminator()
```
- Initializes ROS2 node with name `final_grade_determinator`
- Declares and retrieves `grade_collection_amount` parameter
- Sets up `DatabaseManager`
- Creates publisher for student course management
- Subscribes to exam results topic
- Initializes service client for grade calculation
**Core Functions**
**`void exam_results_callback(const g2_2025_interfaces::msg::Exam::SharedPtr msg)`**
- Updates internal map with received exam result for student-course combo
- Checks if enough results have been collected
- Triggers grade calculation request when threshold is met
**`void grade_calculator_request(StudentCourse combo)`**
- Waits for grade calculator service to be available
- Sends async request with collected exam grades for the student-course combination
- Uses callback to handle service response
**`void grade_calculator_response(rclcpp::Client<g2_2025_interfaces::srv::Exams>::SharedFuture future, StudentCourse studentCourseCombo)`**
- Verifies database connection
- Publishes final student message to ROS2 topic
- Logs final grade information
- Stores final course result in database

View File

@@ -0,0 +1,25 @@
# GradeCalculator (`assignments::one::grade_calculator::GradeCalculator`)
## Overview
The `GradeCalculator` node provides a ROS2 service for calculating student exam grades. It processes exam scores, applies custom logic for specific student names, and ensures grade results are within valid bounds.
#### Implementation Details
**Constructor**
```cpp
GradeCalculator()
```
- Initializes ROS2 node with name `grade_calculator`
- Creates a ROS2 service server for `grade_calculator_service`
- Binds the service callback to handle grade calculation requests
- Logs service startup
**Core Functions**
**`void grade_calculator_callback(const Exams::Request::SharedPtr request, const Exams::Response::SharedPtr response)`**
- Checks if exam grades are provided
- Calculates the total and average of exam grades
- Converts student name to lowercase for comparison
- Adds a bonus of 10 points if the student name is "wessel"
- Ensures the final grade is clamped between 10 and 100
- Sends the calculated grade back through the service response