generated from wessel/boilerplate
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:
43
doc/architecture/nodes/ExamResultGenerator.md
Normal file
43
doc/architecture/nodes/ExamResultGenerator.md
Normal 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
|
||||
|
||||
Reference in New Issue
Block a user