Open Hommus opened 1 year ago
I'm running the following code on a SAMD21 chip (identical to the Arduino Zero) and seeing a gradual timing offset between the MCU and my host device (a Xavier NX). Any suggestions on how to debug this? Are the functions just called too fast?
#include "Arduino.h" #include <ros.h> #include <std_msgs/Time.h> ros::NodeHandle nh; std_msgs::Time time_msg; ros::Publisher chatter_time("chatter_time", &time_msg); void setup() { nh.getHardware()->setBaud(500000); nh.initNode(); nh.advertise(chatter_time); } void loop() { time_msg.data = nh.now(); chatter_time.publish( &time_msg ); nh.spinOnce(); delay(1); }
# Terminal 1 roscore # Terminal 2 rosrun rosserial_arduino serial_node.py _port:=/dev/versavis _baud:=500000 # Terminal 3 rostopic echo /chatter_time --offset
data: secs: 0 nsecs: 5362967 --- data: secs: 0 nsecs: 3650985 --- data: secs: 0 nsecs: 2202932 --- data: secs: 0 nsecs: 828882 --- data: secs: -1 nsecs: 999503046 --- data: secs: -1 nsecs: 998166096 ... data: secs: -1 nsecs: 5201935 --- data: secs: -1 nsecs: 3447084 --- data: secs: -1 nsecs: 2268113 --- data: secs: -1 nsecs: 1016040 --- data: secs: -2 nsecs: 999823003 --- data: secs: -2 nsecs: 998548088 --- data: secs: -2 nsecs: 996856040 --- data: secs: -2 nsecs: 995202994
I'm running the following code on a SAMD21 chip (identical to the Arduino Zero) and seeing a gradual timing offset between the MCU and my host device (a Xavier NX). Any suggestions on how to debug this? Are the functions just called too fast?