Skip to content

Commit

Permalink
update cabot_navigation2/test/README.md and run_test.py to add descri…
Browse files Browse the repository at this point in the history
…ption of metric evaluation

Signed-off-by: Masayuki Murata <[email protected]>
  • Loading branch information
muratams committed Feb 22, 2024
1 parent 99fda33 commit e7bc047
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cabot_navigation2/test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@ func test_name(tester: Tester)
- `condition` : pyton snipet to check if the `msg` matches the condition
- `wait` : wait for seconds
- `seconds` : wait time in seconds
- `set_evaluation_parameters(metrics=[], robot_radius=None)` : set parameters used for computing metrics
- `metrics : Optional[list], default=[]` : list of metric functions to be computed. The callable functions are defined in [evaluation_metrics.py](evaluation_metrics.py).
- Example
```
metrics=[
"total_time",
"robot_path_length",
"time_not_moving",
"avg_robot_linear_speed",
"cumulative_heading_changes"
]
```
- Note: The implementation of the metric functions is not stable as it is under development.
- `robot_radius : Optional[float], default=None` : robot radius used to detect collisions in metric computation. If not defined, the default value (0.45) defined in the pedestrian plugin will be used.
- `start_evaluation` : start computing the metrics. This method should be called when ready to start the navigation.
- `stop_evaluation` : stop computing the metrics. It is usually not necessary to call this method because it is automatically called when the test ends.

---
**old one with run_test_yaml.py**
Expand Down
25 changes: 25 additions & 0 deletions cabot_navigation2/test/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,37 @@ def info(self, text):

# evaluation
def set_evaluation_parameters(self, **kwargs):
"""
Set parameters used for computing metrics
Parameters are defined as EvaluationParameter dataclass in evaluator module
Parameters
----------
metrics: Optional[list] = []
List of metric functions to be computed. The callable functions are defined in evaluation_metrics.py
robot_radius: Optional[float] = None
The robot radius used to detect collisions in the metric computation.
If not defined, the default value (0.45) defined in the pedestrian plugin is used.
"""
self.evaluator.set_evaluation_parameters(**kwargs)

def start_evaluation(self):
"""
Start computing the metrics
This method should be called when ready to start the navigation
"""
self.evaluator.start()

def stop_evaluation(self):
"""
Stop comuting the metrics
It is usually not necessary to call this method because it is automatically called when the test ends.
This method can be used when the user intentionally stops the metric computation
"""
self.evaluator.stop()

# shorthand functions
Expand Down

0 comments on commit e7bc047

Please sign in to comment.