Skip to content

Commit db7b0e7

Browse files
committed
Fixed: mrpt::reactivenav::CReactiveNavigationSystem and mrpt::reactivenav::CReactiveNavigationSystem3D didn't obey the "enableConsoleOutput" constructor flag
1 parent 6481ce7 commit db7b0e7

2 files changed

Lines changed: 24 additions & 12 deletions

File tree

libs/reactivenav/src/CReactiveNavigationSystem.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ void CReactiveNavigationSystem::performNavigationStep()
406406
{
407407
m_robot.stop();
408408
m_navigationState = IDLE;
409-
printf_debug("Navigation target was reached!\n" );
409+
if (m_enableConsoleOutput) printf_debug("Navigation target was reached!\n" );
410410

411411
if (!navigationEndEventSent)
412412
{
@@ -641,26 +641,32 @@ void CReactiveNavigationSystem::performNavigationStep()
641641
timerForExecutionPeriod.Tic();
642642

643643

644-
printf_debug("CMD:%.02lfm/s,%.02lfd/s \t",
644+
if (m_enableConsoleOutput)
645+
{
646+
printf_debug("CMD:%.02lfm/s,%.02lfd/s \t",
645647
(double)cmd_v,
646648
(double)RAD2DEG( cmd_w ) );
647649

648-
printf_debug(" T=%.01lfms Exec:%.01lfms|%.01lfms \t",
650+
printf_debug(" T=%.01lfms Exec:%.01lfms|%.01lfms \t",
649651
1000.0*meanExecutionPeriod,
650652
1000.0*meanExecutionTime,
651653
1000.0*meanTotalExecutionTime );
654+
}
652655

653656
if (!skipNormalReactiveNavigation)
654657
{
655-
printf_debug("E=%.01lf ", (double)selectedHolonomicMovement.evaluation );
656-
printf_debug("PTG#%i ", nSelectedPTG);
658+
if (m_enableConsoleOutput)
659+
{
660+
printf_debug("E=%.01lf ", (double)selectedHolonomicMovement.evaluation );
661+
printf_debug("PTG#%i ", nSelectedPTG);
662+
}
657663
}
658664
else
659665
{
660666
nSelectedPTG = 0;
661667
}
662668

663-
printf_debug("\n");
669+
if (m_enableConsoleOutput) printf_debug("\n");
664670

665671
// ---------------------------------------
666672
// Generate log record

libs/reactivenav/src/CReactiveNavigationSystem3D.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ void CReactiveNavigationSystem3D::performNavigationStep()
417417
{
418418
m_robot.stop();
419419
m_navigationState = IDLE;
420-
printf_debug("Navigation target was reached!\n" );
420+
if (m_enableConsoleOutput) printf_debug("Navigation target was reached!\n" );
421421

422422
if (!navigationEndEventSent)
423423
{
@@ -582,26 +582,32 @@ void CReactiveNavigationSystem3D::performNavigationStep()
582582
timerForExecutionPeriod.Tic();
583583

584584

585-
printf_debug("CMD:%.02lfm/s,%.02lfd/s \t",
585+
if (m_enableConsoleOutput)
586+
{
587+
printf_debug("CMD:%.02lfm/s,%.02lfd/s \t",
586588
(double)new_cmd_v,
587589
(double)RAD2DEG( new_cmd_w ) );
588590

589-
printf_debug(" T=%.01lfms Exec:%.01lfms|%.01lfms \t",
591+
printf_debug(" T=%.01lfms Exec:%.01lfms|%.01lfms \t",
590592
1000.0*meanExecutionPeriod,
591593
1000.0*meanExecutionTime,
592594
1000.0*meanTotalExecutionTime );
595+
}
593596

594597
if (!skipNormalReactiveNavigation)
595598
{
596-
printf_debug("E=%.01lf ", (double)selectedHolonomicMovement.evaluation );
597-
printf_debug("PTG#%i ", nSelectedPTG);
599+
if (m_enableConsoleOutput)
600+
{
601+
printf_debug("E=%.01lf ", (double)selectedHolonomicMovement.evaluation );
602+
printf_debug("PTG#%i ", nSelectedPTG);
603+
}
598604
}
599605
else
600606
{
601607
nSelectedPTG = 0;
602608
}
603609

604-
printf_debug("\n");
610+
if (m_enableConsoleOutput) printf_debug("\n");
605611

606612

607613
// ---------------------------------------

0 commit comments

Comments
 (0)