-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase_cost.py
42 lines (33 loc) · 1.32 KB
/
base_cost.py
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
#!/usr/bin/env python
"""
Base cost class (with documentation)
Authors: Olivier Lamarre
Affl.: STARS Laboratory, University of Toronto
"""
from gplanetary_nav.planning.types import Node
from gplanetary_nav.site.loader import SiteLoader
class BaseCost(object):
"""Base class for edge cost calculation"""
def __init__(self, site: SiteLoader, rover_cfg: dict, **params) -> None:
"""Initialize a BaseCost instance
Args:
site: the site instance
rover_cfg: the rover configuration dictionary
params: additional parameters to save as class attributes
"""
self.site = site
self.rover_cfg = rover_cfg
for k, v in params.items():
setattr(self, k, v)
def eval(
self, node: Node, pitch: float,
roll: float, length: float, duration: float=None) -> float:
"""Cost of a drive in the given rover & site config
Args:
node: pixel grid coordinates where drive occurs in site
pitch: rover pitch in radians (see docs for sign convention)
roll: rover roll in radians (see docs for sign convention)
length: length of the edge segment in meters
duration: traverse time of the edge segment, in seconds (optional)
"""
pass