cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

RealTime Scheduler Watchdog Error

RealTime Scheduler Watchdog Error

Andrefs
Established Member

I'm using the scheduler rt example as a basis for my program and in this moment I have one cycle running with 2ms cycle time in this part of the code:

Andrefs_0-1715329423915.png

In addiction to this, I have another cycle (non real time) running in the finalStateMachine. When the state is on SCHED_OPERATING, my cycle runs. So far so good and the code runs well.

My problem is that when I add more code to this part (non real time), some cycles to read info (readsync) and process information, my RealTime cycle is affected and take more time to complete (more than 2ms).

It's supposed the non real time affects the real time process? Or could I be doing something wrong?

3 REPLIES 3

CodeShepherd
Community Moderator
Community Moderator

How do you determine if your code is running in real time or not? It sounds like only have one callable executing both of the code so both also are called every two ms.

Yes, it's only one callable. However, in the rt scheduler example, we have this note before the finalStateMachine function:
//! Implementation of the final state machine, handles none realtime actions (outside the scheduler context)"

So, with this I understand that this function called by a thread is independent of the scheduler. But I can be wrong...

nickH
Community Moderator
Community Moderator

Yes you are right. The finalStateMachine() runs in a separate thread and not in the scheduler context. See Callable.cpp line 28-35: 

  //! Starts the final state machine in a separate thread.
  void Callable::finalStateMachineStart()
  {
    TRACE_INFO("#%d", m_instanceID);

    m_finalStateMachineState = FinalStateMachineState::IDLE;
    m_thread = std::thread(&Callable::finalStateMachine, this);
  }

Thats why we can do a std::this_thread::sleep_for(std::chrono::seconds(1)) in line 196. And the watchdog ist not called. 

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist