Skip to content

Commit 57b6fdc

Browse files
Rename RGB vision streams to match YUV streams (commaai#23961)
* Renaming VISION_STREAM_RGB_.. to match yuv names like VISION_STREAM_ROAD VISION_STREAM_RGB_BACK -> VISION_STREAM_RGB_ROAD VISION_STREAM_RGB_FRONT -> VISION_STREAM_RGB_DRIVER * little more Co-authored-by: Adeeb Shihadeh <[email protected]>
1 parent 08c2d06 commit 57b6fdc

File tree

14 files changed

+30
-30
lines changed

14 files changed

+30
-30
lines changed

cereal

selfdrive/camerad/cameras/camera_qcom.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,12 @@ void cameras_init(VisionIpcServer *v, MultiCameraState *s, cl_device_id device_i
211211
/*fps*/ 20,
212212
#endif
213213
device_id, ctx,
214-
VISION_STREAM_RGB_BACK, VISION_STREAM_ROAD);
214+
VISION_STREAM_RGB_ROAD, VISION_STREAM_ROAD);
215215

216216
camera_init(v, &s->driver_cam, CAMERA_ID_OV8865, 1,
217217
/*pixel_clock=*/72000000, /*line_length_pclk=*/1602,
218218
/*max_gain=*/510, 10, device_id, ctx,
219-
VISION_STREAM_RGB_FRONT, VISION_STREAM_DRIVER);
219+
VISION_STREAM_RGB_DRIVER, VISION_STREAM_DRIVER);
220220

221221
s->sm = new SubMaster({"driverState"});
222222
s->pm = new PubMaster({"roadCameraState", "driverCameraState", "thumbnail"});

selfdrive/camerad/cameras/camera_qcom2.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -743,12 +743,12 @@ void CameraState::camera_open() {
743743
}
744744

745745
void cameras_init(VisionIpcServer *v, MultiCameraState *s, cl_device_id device_id, cl_context ctx) {
746-
s->driver_cam.camera_init(s, v, CAMERA_ID_AR0231, 2, 20, device_id, ctx, VISION_STREAM_RGB_FRONT, VISION_STREAM_DRIVER);
746+
s->driver_cam.camera_init(s, v, CAMERA_ID_AR0231, 2, 20, device_id, ctx, VISION_STREAM_RGB_DRIVER, VISION_STREAM_DRIVER);
747747
printf("driver camera initted \n");
748748
if (!env_only_driver) {
749-
s->road_cam.camera_init(s, v, CAMERA_ID_AR0231, 1, 20, device_id, ctx, VISION_STREAM_RGB_BACK, VISION_STREAM_ROAD); // swap left/right
749+
s->road_cam.camera_init(s, v, CAMERA_ID_AR0231, 1, 20, device_id, ctx, VISION_STREAM_RGB_ROAD, VISION_STREAM_ROAD); // swap left/right
750750
printf("road camera initted \n");
751-
s->wide_road_cam.camera_init(s, v, CAMERA_ID_AR0231, 0, 20, device_id, ctx, VISION_STREAM_RGB_WIDE, VISION_STREAM_WIDE_ROAD);
751+
s->wide_road_cam.camera_init(s, v, CAMERA_ID_AR0231, 0, 20, device_id, ctx, VISION_STREAM_RGB_WIDE_ROAD, VISION_STREAM_WIDE_ROAD);
752752
printf("wide road camera initted \n");
753753
}
754754

selfdrive/camerad/cameras/camera_replay.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ void process_road_camera(MultiCameraState *s, CameraState *c, int cnt) {
9898

9999
void cameras_init(VisionIpcServer *v, MultiCameraState *s, cl_device_id device_id, cl_context ctx) {
100100
camera_init(v, &s->road_cam, CAMERA_ID_LGC920, 20, device_id, ctx,
101-
VISION_STREAM_RGB_BACK, VISION_STREAM_ROAD, get_url(road_camera_route, "fcamera", 0));
101+
VISION_STREAM_RGB_ROAD, VISION_STREAM_ROAD, get_url(road_camera_route, "fcamera", 0));
102102
// camera_init(v, &s->driver_cam, CAMERA_ID_LGC615, 10, device_id, ctx,
103-
// VISION_STREAM_RGB_FRONT, VISION_STREAM_DRIVER, get_url(driver_camera_route, "dcamera", 0));
103+
// VISION_STREAM_RGB_DRIVER, VISION_STREAM_DRIVER, get_url(driver_camera_route, "dcamera", 0));
104104
s->pm = new PubMaster({"roadCameraState", "driverCameraState", "thumbnail"});
105105
}
106106

selfdrive/camerad/cameras/camera_webcam.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ void driver_camera_thread(CameraState *s) {
141141

142142
void cameras_init(VisionIpcServer *v, MultiCameraState *s, cl_device_id device_id, cl_context ctx) {
143143
camera_init(v, &s->road_cam, CAMERA_ID_LGC920, 20, device_id, ctx,
144-
VISION_STREAM_RGB_BACK, VISION_STREAM_ROAD);
144+
VISION_STREAM_RGB_ROAD, VISION_STREAM_ROAD);
145145
camera_init(v, &s->driver_cam, CAMERA_ID_LGC615, 10, device_id, ctx,
146-
VISION_STREAM_RGB_FRONT, VISION_STREAM_DRIVER);
146+
VISION_STREAM_RGB_DRIVER, VISION_STREAM_DRIVER);
147147
s->pm = new PubMaster({"roadCameraState", "driverCameraState", "thumbnail"});
148148
}
149149

selfdrive/camerad/snapshot/snapshot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
LM_THRESH = 120 # defined in selfdrive/camerad/imgproc/utils.h
1818

1919
VISION_STREAMS = {
20-
"roadCameraState": VisionStreamType.VISION_STREAM_RGB_BACK,
21-
"driverCameraState": VisionStreamType.VISION_STREAM_RGB_FRONT,
22-
"wideRoadCameraState": VisionStreamType.VISION_STREAM_RGB_WIDE,
20+
"roadCameraState": VisionStreamType.VISION_STREAM_RGB_ROAD,
21+
"driverCameraState": VisionStreamType.VISION_STREAM_RGB_DRIVER,
22+
"wideRoadCameraState": VisionStreamType.VISION_STREAM_RGB_WIDE_ROAD,
2323
}
2424

2525

selfdrive/test/process_replay/regen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def replay_camera(s, stream, dt, vipc_server, frames, size):
159159
args=(s, stream, dt, vs, frames, size)))
160160

161161
# hack to make UI work
162-
vs.create_buffers(VisionStreamType.VISION_STREAM_RGB_BACK, 4, True, eon_f_frame_size[0], eon_f_frame_size[1])
162+
vs.create_buffers(VisionStreamType.VISION_STREAM_RGB_ROAD, 4, True, eon_f_frame_size[0], eon_f_frame_size[1])
163163
vs.start_listener()
164164
return vs, p
165165

selfdrive/ui/qt/offroad/driverview.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ DriverViewWindow::DriverViewWindow(QWidget* parent) : QWidget(parent) {
1212
layout = new QStackedLayout(this);
1313
layout->setStackingMode(QStackedLayout::StackAll);
1414

15-
cameraView = new CameraViewWidget("camerad", VISION_STREAM_RGB_FRONT, true, this);
15+
cameraView = new CameraViewWidget("camerad", VISION_STREAM_RGB_DRIVER, true, this);
1616
layout->addWidget(cameraView);
1717

1818
scene = new DriverViewScene(this);

selfdrive/ui/qt/onroad.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ OnroadWindow::OnroadWindow(QWidget *parent) : QWidget(parent) {
2020

2121
QStackedLayout *road_view_layout = new QStackedLayout;
2222
road_view_layout->setStackingMode(QStackedLayout::StackAll);
23-
nvg = new NvgWindow(VISION_STREAM_RGB_BACK, this);
23+
nvg = new NvgWindow(VISION_STREAM_RGB_ROAD, this);
2424
road_view_layout->addWidget(nvg);
2525
hud = new OnroadHud(this);
2626
road_view_layout->addWidget(hud);
@@ -97,7 +97,7 @@ void OnroadWindow::offroadTransition(bool offroad) {
9797

9898
// update stream type
9999
bool wide_cam = Hardware::TICI() && Params().getBool("EnableWideCamera");
100-
nvg->setStreamType(wide_cam ? VISION_STREAM_RGB_WIDE : VISION_STREAM_RGB_BACK);
100+
nvg->setStreamType(wide_cam ? VISION_STREAM_RGB_WIDE_ROAD : VISION_STREAM_RGB_ROAD);
101101
}
102102

103103
void OnroadWindow::paintEvent(QPaintEvent *event) {

selfdrive/ui/qt/widgets/cameraview.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void CameraViewWidget::initializeGL() {
123123
GLint frame_pos_loc = program->attributeLocation("aPosition");
124124
GLint frame_texcoord_loc = program->attributeLocation("aTexCoord");
125125

126-
auto [x1, x2, y1, y2] = stream_type == VISION_STREAM_RGB_FRONT ? std::tuple(0.f, 1.f, 1.f, 0.f) : std::tuple(1.f, 0.f, 1.f, 0.f);
126+
auto [x1, x2, y1, y2] = stream_type == VISION_STREAM_RGB_DRIVER ? std::tuple(0.f, 1.f, 1.f, 0.f) : std::tuple(1.f, 0.f, 1.f, 0.f);
127127
const uint8_t frame_indicies[] = {0, 1, 2, 0, 2, 3};
128128
const float frame_coords[4][4] = {
129129
{-1.0, -1.0, x2, y1}, // bl
@@ -171,12 +171,12 @@ void CameraViewWidget::hideEvent(QHideEvent *event) {
171171

172172
void CameraViewWidget::updateFrameMat(int w, int h) {
173173
if (zoomed_view) {
174-
if (stream_type == VISION_STREAM_RGB_FRONT) {
174+
if (stream_type == VISION_STREAM_RGB_DRIVER) {
175175
frame_mat = matmul(device_transform, get_driver_view_transform(w, h, stream_width, stream_height));
176176
} else {
177-
auto intrinsic_matrix = stream_type == VISION_STREAM_RGB_WIDE ? ecam_intrinsic_matrix : fcam_intrinsic_matrix;
177+
auto intrinsic_matrix = stream_type == VISION_STREAM_RGB_WIDE_ROAD ? ecam_intrinsic_matrix : fcam_intrinsic_matrix;
178178
float zoom = ZOOM / intrinsic_matrix.v[0];
179-
if (stream_type == VISION_STREAM_RGB_WIDE) {
179+
if (stream_type == VISION_STREAM_RGB_WIDE_ROAD) {
180180
zoom *= 0.5;
181181
}
182182
float zx = zoom * 2 * intrinsic_matrix.v[2] / width();

selfdrive/ui/replay/camera.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ class CameraServer {
3232
void cameraThread(Camera &cam);
3333

3434
Camera cameras_[MAX_CAMERAS] = {
35-
{.type = RoadCam, .rgb_type = VISION_STREAM_RGB_BACK, .yuv_type = VISION_STREAM_ROAD},
36-
{.type = DriverCam, .rgb_type = VISION_STREAM_RGB_FRONT, .yuv_type = VISION_STREAM_DRIVER},
37-
{.type = WideRoadCam, .rgb_type = VISION_STREAM_RGB_WIDE, .yuv_type = VISION_STREAM_WIDE_ROAD},
35+
{.type = RoadCam, .rgb_type = VISION_STREAM_RGB_ROAD, .yuv_type = VISION_STREAM_ROAD},
36+
{.type = DriverCam, .rgb_type = VISION_STREAM_RGB_DRIVER, .yuv_type = VISION_STREAM_DRIVER},
37+
{.type = WideRoadCam, .rgb_type = VISION_STREAM_RGB_WIDE_ROAD, .yuv_type = VISION_STREAM_WIDE_ROAD},
3838
};
3939
std::atomic<int> publishing_ = 0;
4040
std::unique_ptr<VisionIpcServer> vipc_server_;

selfdrive/ui/watch3.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ int main(int argc, char *argv[]) {
2020
QHBoxLayout *hlayout = new QHBoxLayout();
2121
layout->addLayout(hlayout);
2222
hlayout->addWidget(new CameraViewWidget("navd", VISION_STREAM_RGB_MAP, false));
23-
hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_RGB_BACK, false));
23+
hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_RGB_ROAD, false));
2424
}
2525

2626
{
2727
QHBoxLayout *hlayout = new QHBoxLayout();
2828
layout->addLayout(hlayout);
29-
hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_RGB_FRONT, false));
30-
hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_RGB_WIDE, false));
29+
hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_RGB_DRIVER, false));
30+
hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_RGB_WIDE_ROAD, false));
3131
}
3232

3333
return a.exec();

tools/replay/ui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def ui_thread(addr):
9999

100100
draw_plots = init_plots(plot_arr, name_to_arr_idx, plot_xlims, plot_ylims, plot_names, plot_colors, plot_styles)
101101

102-
vipc_client = VisionIpcClient("camerad", VisionStreamType.VISION_STREAM_RGB_BACK, True)
102+
vipc_client = VisionIpcClient("camerad", VisionStreamType.VISION_STREAM_RGB_ROAD, True)
103103
while 1:
104104
list(pygame.event.get())
105105

tools/sim/bridge.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __init__(self):
6767
self.vipc_server = VisionIpcServer("camerad")
6868

6969
# TODO: remove RGB buffers once the last RGB vipc subscriber is removed
70-
self.vipc_server.create_buffers(VisionStreamType.VISION_STREAM_RGB_BACK, 4, True, W, H)
70+
self.vipc_server.create_buffers(VisionStreamType.VISION_STREAM_RGB_ROAD, 4, True, W, H)
7171
self.vipc_server.create_buffers(VisionStreamType.VISION_STREAM_ROAD, 40, False, W, H)
7272
self.vipc_server.start_listener()
7373

@@ -97,7 +97,7 @@ def cam_callback(self, image):
9797
eof = self.frame_id * 0.05
9898

9999
# TODO: remove RGB send once the last RGB vipc subscriber is removed
100-
self.vipc_server.send(VisionStreamType.VISION_STREAM_RGB_BACK, img.tobytes(), self.frame_id, eof, eof)
100+
self.vipc_server.send(VisionStreamType.VISION_STREAM_RGB_ROAD, img.tobytes(), self.frame_id, eof, eof)
101101
self.vipc_server.send(VisionStreamType.VISION_STREAM_ROAD, yuv.data.tobytes(), self.frame_id, eof, eof)
102102

103103
dat = messaging.new_message('roadCameraState')

0 commit comments

Comments
 (0)