RealTime Scheduler Watchdog Error

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:

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?

Best reply by nickH

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. 

View original
3 replies