Esp32 External Interrupts for Encoder + ROS spinOnce() restarting.

asked 2020-01-17 12:01:19 -0600

noshluk2 gravatar image

Hi i am working on a Mobile Robot ( 2 wheel diff-drive) the error is regarding the

  • ros:: SpinOnce()

Here is My code for main loop;

void loop()
{  
  if(node.connected()){
    lwheel_msg.data = enc_value_L; // containing the left wheel encoder counts
    rwheel_msg.data = enc_value_R; // containing the left wheel encoder counts
    Serial.print(enc_value_L);Serial.print("/");Serial.println(enc_value_R); // checking the values
    lwheel_pub.publish(&lwheel_msg); // publishing   
    rwheel_pub.publish(&rwheel_msg);
  }else{
    node.spinOnce(); } // Here is the problem ( apparently ) 
                       // if I comment spinOnce() and use ESP32 simply -> no ERRORS 
}

error =

 Guru Meditaion error : Core 1 panicked ( interrupt wdt timeout on cpu1)

WORKS FINE WHEN :

Without ros::spinOnce() which means without using Ros -> simple esp32 robot and checking results in serial monitor .Every thing works fine .. Encoders using interrupt keep running without restarting or Core Panick error.

edit retag flag offensive close merge delete