Data loss in rosserial for arduino to pc [closed]
Hi there.
I using rosserial to communicate pc to arduino. I use timer interruptions for publishing.
But, when I use timer interruptions, rosserial said "wrong checksum for topic id and msg". This error occurs in almost same timing, such as one in 20 seconds.
Is there anyone who understands the cause?
Thanks in advance.
My codes here.
#include <ros.h>
#include <std_msgs/UInt64.h>
#include <CurieTimerOne.h>
ros::NodeHandle nh;
std_msgs::UInt64 msgs;
ros::Publisher unnamed_publisher("empty_topic", &msgs);
void intFunc()
{
msgs.data = millis();
unnamed_publisher.publish(&msgs);
}
void setup()
{
nh.initNode();
nh.advertise(unnamed_publisher);
// Interrupt 50 hz
int secToMicro = 1e6;
int Hz = 100;
CurieTimerOne.start(secToMicro / Hz, intFunc);
}
void loop()
{
delay(100);
nh.spinOnce();
}