Skip to content

Commit 3132dc6

Browse files
authored
Fix checkResolFps
1 parent 71eb2bb commit 3132dc6

File tree

1 file changed

+51
-61
lines changed

1 file changed

+51
-61
lines changed

zed_nodelets/src/zed_nodelet/src/zed_wrapper_nodelet.cpp

Lines changed: 51 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ void ZEDWrapperNodelet::checkResolFps()
14481448
case sl::RESOLUTION::HD2K:
14491449
if (mCamFrameRate != 15)
14501450
{
1451-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD2K. Set to 15 FPS.");
1451+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD2K. Forced to 15 FPS.");
14521452
mCamFrameRate = 15;
14531453
}
14541454

@@ -1457,26 +1457,26 @@ void ZEDWrapperNodelet::checkResolFps()
14571457
case sl::RESOLUTION::HD1080:
14581458
if (mZedUserCamModel == sl::MODEL::ZED_X || mZedUserCamModel == sl::MODEL::ZED_XM)
14591459
{
1460-
if (mCamFrameRate == 60 || mCamFrameRate == 30)
1460+
if (mCamFrameRate == 60 || mCamFrameRate == 30 || mCamFrameRate == 15)
14611461
{
14621462
break;
14631463
}
14641464

1465-
if (mCamFrameRate > 30 && mCamFrameRate < 60)
1465+
if (mCamFrameRate < 23)
14661466
{
1467-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Set to 30 FPS.");
1467+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Forced to 15 FPS.");
1468+
mCamFrameRate = 15;
1469+
}
1470+
else if (mCamFrameRate >= 23 && mCamFrameRate < 45)
1471+
{
1472+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Forced to 30 FPS.");
14681473
mCamFrameRate = 30;
14691474
}
1470-
else if (mCamFrameRate > 60)
1475+
else if (mCamFrameRate >= 45)
14711476
{
1472-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Set to 60 FPS.");
1477+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Forced to 60 FPS.");
14731478
mCamFrameRate = 60;
14741479
}
1475-
else
1476-
{
1477-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Set to 30 FPS.");
1478-
mCamFrameRate = 30;
1479-
}
14801480
}
14811481
else
14821482
{
@@ -1485,21 +1485,16 @@ void ZEDWrapperNodelet::checkResolFps()
14851485
break;
14861486
}
14871487

1488-
if (mCamFrameRate > 15 && mCamFrameRate < 30)
1488+
if (mCamFrameRate < 23)
14891489
{
1490-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Set to 15 FPS.");
1490+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Forced to 15 FPS.");
14911491
mCamFrameRate = 15;
14921492
}
1493-
else if (mCamFrameRate > 30)
1493+
else if (mCamFrameRate >= 23)
14941494
{
1495-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Set to 30 FPS.");
1495+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Forced to 30 FPS.");
14961496
mCamFrameRate = 30;
14971497
}
1498-
else
1499-
{
1500-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Set to 15 FPS.");
1501-
mCamFrameRate = 15;
1502-
}
15031498
}
15041499

15051500
break;
@@ -1510,25 +1505,25 @@ void ZEDWrapperNodelet::checkResolFps()
15101505
break;
15111506
}
15121507

1513-
if (mCamFrameRate > 15 && mCamFrameRate < 30)
1508+
if (mCamFrameRate < 23)
15141509
{
1515-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD720. Set to 15 FPS.");
1510+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Forced to 15 FPS.");
15161511
mCamFrameRate = 15;
1517-
}
1518-
else if (mCamFrameRate > 30 && mCamFrameRate < 60)
1512+
}
1513+
else if (mCamFrameRate >= 23 && mCamFrameRate < 45)
15191514
{
1520-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD720. Set to 30 FPS.");
1515+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Forced to 30 FPS.");
15211516
mCamFrameRate = 30;
15221517
}
1523-
else if (mCamFrameRate > 60)
1518+
else if (mCamFrameRate >= 45)
15241519
{
1525-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD720. Set to 60 FPS.");
1520+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Forced to 60 FPS.");
15261521
mCamFrameRate = 60;
15271522
}
15281523
else
15291524
{
1530-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD720. Set to 15 FPS.");
1531-
mCamFrameRate = 15;
1525+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Forced to 30 FPS.");
1526+
mCamFrameRate = 30;
15321527
}
15331528

15341529
break;
@@ -1539,31 +1534,26 @@ void ZEDWrapperNodelet::checkResolFps()
15391534
break;
15401535
}
15411536

1542-
if (mCamFrameRate > 15 && mCamFrameRate < 30)
1537+
if (mCamFrameRate < 23)
15431538
{
1544-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution VGA. Set to 15 FPS.");
1539+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution VGA. Forced to 15 FPS.");
15451540
mCamFrameRate = 15;
15461541
}
1547-
else if (mCamFrameRate > 30 && mCamFrameRate < 60)
1542+
else if (mCamFrameRate >= 23 && mCamFrameRate < 45)
15481543
{
1549-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution VGA. Set to 30 FPS.");
1544+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution VGA. Forced to 30 FPS.");
15501545
mCamFrameRate = 30;
15511546
}
1552-
else if (mCamFrameRate > 60 && mCamFrameRate < 100)
1547+
else if (mCamFrameRate >= 45 && mCamFrameRate < 80)
15531548
{
1554-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution VGA. Set to 60 FPS.");
1549+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution VGA. Forced to 60 FPS.");
15551550
mCamFrameRate = 60;
15561551
}
1557-
else if (mCamFrameRate > 100)
1552+
else if (mCamFrameRate >= 80)
15581553
{
1559-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution VGA. Set to 100 FPS.");
1554+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution VGA. Forced to 100 FPS.");
15601555
mCamFrameRate = 100;
15611556
}
1562-
else
1563-
{
1564-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution VGA. Set to 15 FPS.");
1565-
mCamFrameRate = 15;
1566-
}
15671557

15681558
break;
15691559

@@ -1573,45 +1563,45 @@ void ZEDWrapperNodelet::checkResolFps()
15731563
break;
15741564
}
15751565

1576-
if (mCamFrameRate > 30 && mCamFrameRate < 60)
1566+
if (mCamFrameRate < 45)
15771567
{
1578-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1200. Set to 30 FPS.");
1568+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1200. Forced to 30 FPS.");
15791569
mCamFrameRate = 30;
15801570
}
1581-
else if (mCamFrameRate > 60)
1571+
else if (mCamFrameRate >= 45)
15821572
{
1583-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1200. Set to 60 FPS.");
1573+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1200. Forced to 60 FPS.");
15841574
mCamFrameRate = 60;
15851575
}
1586-
else
1587-
{
1588-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1200. Set to 30 FPS.");
1589-
mCamFrameRate = 30;
1590-
}
15911576

15921577
break;
15931578

15941579
case sl::RESOLUTION::SVGA:
1595-
if (mCamFrameRate == 120 || mCamFrameRate == 60)
1580+
if (mCamFrameRate == 120 || mCamFrameRate == 60 || mCamFrameRate == 30 || mCamFrameRate == 15)
15961581
{
15971582
break;
15981583
}
15991584

1600-
if (mCamFrameRate > 60 && mCamFrameRate < 120)
1585+
if (mCamFrameRate < 23)
16011586
{
1602-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution SVGA. Set to 60 FPS.");
1603-
mCamFrameRate = 60;
1604-
}
1605-
else if (mCamFrameRate > 120)
1587+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Forced to 15 FPS.");
1588+
mCamFrameRate = 15;
1589+
}
1590+
else if (mCamFrameRate >= 23 && mCamFrameRate < 45)
16061591
{
1607-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution SVGA. Set to 120 FPS.");
1608-
mCamFrameRate = 120;
1592+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Forced to 30 FPS.");
1593+
mCamFrameRate = 30;
16091594
}
1610-
else
1595+
else if (mCamFrameRate >= 45 && mCamFrameRate < 90)
16111596
{
1612-
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution SVGA. Set to 60 FPS.");
1597+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1080. Forced to 60 FPS.");
16131598
mCamFrameRate = 60;
16141599
}
1600+
else if (mCamFrameRate >= 90)
1601+
{
1602+
NODELET_WARN_STREAM("Wrong FrameRate (" << mCamFrameRate << ") for the resolution HD1200. Forced to 120 FPS.");
1603+
mCamFrameRate = 120;
1604+
}
16151605

16161606
break;
16171607

0 commit comments

Comments
 (0)