-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make constants explicit in synchronization database #218
Conversation
LIDAR_FRAME_RATE_HZ = 10 | ||
|
||
# in milliseconds | ||
RING_CAMERA_SHUTTER_INTERVAL_MS = (1 / RING_CAMERA_FPS) * 1000 # evaluates to 33.3 ms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that 1000 might be more readable as 1e3
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(in terms of quickly determining the units conversion)
@@ -14,6 +14,17 @@ | |||
|
|||
logger = logging.getLogger(__name__) | |||
|
|||
RING_CAMERA_FPS = 30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add typing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typing_extensions.Final?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah
# Stereo Camera is 5 Hz (once per 200 milliseconds) | ||
# LiDAR is 10 Hz | ||
# Since Stereo is more sparse, we look for 200 millisecond on either side | ||
MAX_LIDAR_RING_CAM_TIMESTAMP_DIFF = RING_CAMERA_SHUTTER_INTERVAL_MS * (1.0 / 2) * (1.0 / 1000) * 1e9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should consider making this more readable. One idea:
MAX_LIDAR_RING_CAM_TIMESTAMP_DIFF = 0.5 * (1e9 / 1e3) * RING_CAMERA_SHUTTER_INTERVAL_MS
I think ideally we would have a function to change units:
to_metric_time(ts: int, src: TimeUnit, dst: TimeUnit)
or something similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MAX_LIDAR_RING_CAM_TIMESTAMP_DIFF = to_metric_time(RING_CAMERA_SHUTTER_INTERVAL_MS / 2), src=Millisecond, dst=Nanosecond)
@@ -14,6 +14,17 @@ | |||
|
|||
logger = logging.getLogger(__name__) | |||
|
|||
RING_CAMERA_FPS = 30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah
|
||
logger = logging.getLogger(__name__) | ||
|
||
Millisecond = TimeUnit.Millisecond |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the convention for renaming enums? Does PEP 8 say anything about this?
Make the frame rate constants more readable/ clear.