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:
25
doc/architecture/nodes/GradeCalculator.md
Normal file
25
doc/architecture/nodes/GradeCalculator.md
Normal 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
|
||||
Reference in New Issue
Block a user