-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbeluga_benchmark.py
More file actions
60 lines (49 loc) · 1.91 KB
/
beluga_benchmark.py
File metadata and controls
60 lines (49 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""Nominal benchmark for the Beluga AMCL localization system."""
# Copyright 2026 Ekumen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import lambkin
@lambkin.benchmark(
variants=lambkin.common.named_product(
sensor_model=["beam", "likelihood_field"], num_particles=[10, 20, 100]
),
num_iterations=2,
)
@lambkin.option("--clock-rate", default=100.0)
@lambkin.option("--sensor-topic", default="/scan")
@lambkin.option("--dry-run", default=True)
def nominal(ctx):
"""Run a nominal Beluga AMCL benchmark across sensor models and particle counts.
Launches the Beluga localization stack, plays back a ROS 2 bag,
and evaluates trajectory accuracy with evo_ape.
Args:
ctx: Lambkin context with variant, options, source, and shell access.
"""
print(ctx)
ctx.shell.ros2.launch(
ctx.source.path.parent / "beluga.launch.xml",
f"sensor_model:={ctx.variant.sensor_model}",
f"num_particles:={ctx.variant.num_particles}",
)
ctx.shell.ros2.bag.play("--clock", "-r", ctx.options.clock_rate)
ctx.shell.evo_ape.bag2("output.mcap", save_results="out.zip")
@nominal.input
def dataset(ctx):
"""Return the path to the MCAP dataset used as input for the benchmark."""
return "/mydataset/dataset.mcap"
@nominal.input
def map(ctx):
"""Return the path to the map file used for localization."""
return "my_map.yaml"
if __name__ == "__main__":
nominal()