mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 08:14:00 +08:00
Rename RGB vision streams to match YUV streams (#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 <adeebshihadeh@gmail.com> old-commit-hash: 57b6fdc17a1f84ec922647c044da5df3cafc0ddc
This commit is contained in:
@@ -12,7 +12,7 @@ DriverViewWindow::DriverViewWindow(QWidget* parent) : QWidget(parent) {
|
||||
layout = new QStackedLayout(this);
|
||||
layout->setStackingMode(QStackedLayout::StackAll);
|
||||
|
||||
cameraView = new CameraViewWidget("camerad", VISION_STREAM_RGB_FRONT, true, this);
|
||||
cameraView = new CameraViewWidget("camerad", VISION_STREAM_RGB_DRIVER, true, this);
|
||||
layout->addWidget(cameraView);
|
||||
|
||||
scene = new DriverViewScene(this);
|
||||
|
||||
@@ -20,7 +20,7 @@ OnroadWindow::OnroadWindow(QWidget *parent) : QWidget(parent) {
|
||||
|
||||
QStackedLayout *road_view_layout = new QStackedLayout;
|
||||
road_view_layout->setStackingMode(QStackedLayout::StackAll);
|
||||
nvg = new NvgWindow(VISION_STREAM_RGB_BACK, this);
|
||||
nvg = new NvgWindow(VISION_STREAM_RGB_ROAD, this);
|
||||
road_view_layout->addWidget(nvg);
|
||||
hud = new OnroadHud(this);
|
||||
road_view_layout->addWidget(hud);
|
||||
@@ -97,7 +97,7 @@ void OnroadWindow::offroadTransition(bool offroad) {
|
||||
|
||||
// update stream type
|
||||
bool wide_cam = Hardware::TICI() && Params().getBool("EnableWideCamera");
|
||||
nvg->setStreamType(wide_cam ? VISION_STREAM_RGB_WIDE : VISION_STREAM_RGB_BACK);
|
||||
nvg->setStreamType(wide_cam ? VISION_STREAM_RGB_WIDE_ROAD : VISION_STREAM_RGB_ROAD);
|
||||
}
|
||||
|
||||
void OnroadWindow::paintEvent(QPaintEvent *event) {
|
||||
|
||||
@@ -123,7 +123,7 @@ void CameraViewWidget::initializeGL() {
|
||||
GLint frame_pos_loc = program->attributeLocation("aPosition");
|
||||
GLint frame_texcoord_loc = program->attributeLocation("aTexCoord");
|
||||
|
||||
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);
|
||||
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);
|
||||
const uint8_t frame_indicies[] = {0, 1, 2, 0, 2, 3};
|
||||
const float frame_coords[4][4] = {
|
||||
{-1.0, -1.0, x2, y1}, // bl
|
||||
@@ -171,12 +171,12 @@ void CameraViewWidget::hideEvent(QHideEvent *event) {
|
||||
|
||||
void CameraViewWidget::updateFrameMat(int w, int h) {
|
||||
if (zoomed_view) {
|
||||
if (stream_type == VISION_STREAM_RGB_FRONT) {
|
||||
if (stream_type == VISION_STREAM_RGB_DRIVER) {
|
||||
frame_mat = matmul(device_transform, get_driver_view_transform(w, h, stream_width, stream_height));
|
||||
} else {
|
||||
auto intrinsic_matrix = stream_type == VISION_STREAM_RGB_WIDE ? ecam_intrinsic_matrix : fcam_intrinsic_matrix;
|
||||
auto intrinsic_matrix = stream_type == VISION_STREAM_RGB_WIDE_ROAD ? ecam_intrinsic_matrix : fcam_intrinsic_matrix;
|
||||
float zoom = ZOOM / intrinsic_matrix.v[0];
|
||||
if (stream_type == VISION_STREAM_RGB_WIDE) {
|
||||
if (stream_type == VISION_STREAM_RGB_WIDE_ROAD) {
|
||||
zoom *= 0.5;
|
||||
}
|
||||
float zx = zoom * 2 * intrinsic_matrix.v[2] / width();
|
||||
|
||||
@@ -32,9 +32,9 @@ protected:
|
||||
void cameraThread(Camera &cam);
|
||||
|
||||
Camera cameras_[MAX_CAMERAS] = {
|
||||
{.type = RoadCam, .rgb_type = VISION_STREAM_RGB_BACK, .yuv_type = VISION_STREAM_ROAD},
|
||||
{.type = DriverCam, .rgb_type = VISION_STREAM_RGB_FRONT, .yuv_type = VISION_STREAM_DRIVER},
|
||||
{.type = WideRoadCam, .rgb_type = VISION_STREAM_RGB_WIDE, .yuv_type = VISION_STREAM_WIDE_ROAD},
|
||||
{.type = RoadCam, .rgb_type = VISION_STREAM_RGB_ROAD, .yuv_type = VISION_STREAM_ROAD},
|
||||
{.type = DriverCam, .rgb_type = VISION_STREAM_RGB_DRIVER, .yuv_type = VISION_STREAM_DRIVER},
|
||||
{.type = WideRoadCam, .rgb_type = VISION_STREAM_RGB_WIDE_ROAD, .yuv_type = VISION_STREAM_WIDE_ROAD},
|
||||
};
|
||||
std::atomic<int> publishing_ = 0;
|
||||
std::unique_ptr<VisionIpcServer> vipc_server_;
|
||||
|
||||
@@ -20,14 +20,14 @@ int main(int argc, char *argv[]) {
|
||||
QHBoxLayout *hlayout = new QHBoxLayout();
|
||||
layout->addLayout(hlayout);
|
||||
hlayout->addWidget(new CameraViewWidget("navd", VISION_STREAM_RGB_MAP, false));
|
||||
hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_RGB_BACK, false));
|
||||
hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_RGB_ROAD, false));
|
||||
}
|
||||
|
||||
{
|
||||
QHBoxLayout *hlayout = new QHBoxLayout();
|
||||
layout->addLayout(hlayout);
|
||||
hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_RGB_FRONT, false));
|
||||
hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_RGB_WIDE, false));
|
||||
hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_RGB_DRIVER, false));
|
||||
hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_RGB_WIDE_ROAD, false));
|
||||
}
|
||||
|
||||
return a.exec();
|
||||
|
||||
Reference in New Issue
Block a user