Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increasing timing errors with rosserial #610

Open
Hommus opened this issue Feb 7, 2023 · 0 comments
Open

Increasing timing errors with rosserial #610

Hommus opened this issue Feb 7, 2023 · 0 comments

Comments

@Hommus
Copy link

Hommus commented Feb 7, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant