Odometry Calibration Types
Enums and constants for the calibration tool.
Bases: IntEnum
Calibration phase types.
Source code in cogip/tools/firmware_odometry_calibration/types.py
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74 | class CalibrationPhaseType(IntEnum):
"""Calibration phase types."""
WHEEL_DISTANCE = auto()
RIGHT_WHEEL_RADIUS = auto()
LEFT_WHEEL_RADIUS = auto()
@property
def title(self) -> str:
"""Phase title for display."""
titles = {
CalibrationPhaseType.WHEEL_DISTANCE: "WHEEL DISTANCE CALIBRATION",
CalibrationPhaseType.RIGHT_WHEEL_RADIUS: "RIGHT WHEEL RADIUS CALIBRATION",
CalibrationPhaseType.LEFT_WHEEL_RADIUS: "LEFT WHEEL RADIUS CALIBRATION",
}
return titles[self]
@property
def description(self) -> str:
"""Phase description for display."""
descriptions = {
CalibrationPhaseType.WHEEL_DISTANCE: "The robot will rotate in place to calibrate the wheel distance",
CalibrationPhaseType.RIGHT_WHEEL_RADIUS: (
"The robot will perform square trajectories to calibrate the right wheel radius"
),
CalibrationPhaseType.LEFT_WHEEL_RADIUS: (
"The robot will travel a straight line to calibrate the left wheel radius"
),
}
return descriptions[self]
@property
def input_prompt(self) -> str:
"""Input prompt for this phase."""
prompts = {
CalibrationPhaseType.WHEEL_DISTANCE: "How many full rotations?",
CalibrationPhaseType.RIGHT_WHEEL_RADIUS: "How many squares?",
CalibrationPhaseType.LEFT_WHEEL_RADIUS: "What distance in mm?",
}
return prompts[self]
@property
def default_value(self) -> int:
"""Default value for this phase input."""
defaults = {
CalibrationPhaseType.WHEEL_DISTANCE: 10,
CalibrationPhaseType.RIGHT_WHEEL_RADIUS: 5,
CalibrationPhaseType.LEFT_WHEEL_RADIUS: 2000,
}
return defaults[self]
@property
def error_message(self) -> str | None:
"""Error message specific to this phase computation."""
errors = {
CalibrationPhaseType.WHEEL_DISTANCE: None,
CalibrationPhaseType.RIGHT_WHEEL_RADIUS: (
"Right encoder linear component too small. Check encoder connection."
),
CalibrationPhaseType.LEFT_WHEEL_RADIUS: "Denominator too small. Check encoder counts.",
}
return errors[self]
|
Default value for this phase input.
Phase description for display.
Error message specific to this phase computation.
Input prompt for this phase.