Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

ROSからM5stackにふれる その4:log

実際のところ

#include <ros.h>
#include <M5Stack.h>


ros::NodeHandle nh;

void setup()
{
  // initialize the M5Stack object
  M5.begin();
  M5.Power.begin();

  nh.initNode();
}

void loop()
{
  //wait until you are actually connected
  while (!nh.connected())
  {
    nh.spinOnce();
  }
 
  //Now you can send all of the statements you want
  //to be logged at the appropriate verbosity level
  nh.logdebug("Debug Statement");
  nh.loginfo("Program info");
  nh.logwarn("Warnings.");
  nh.logerror("Errors..");
  nh.logfatal("Fatalities!");
  delay(5000);
}