Arduino published topics do not appear [rosserial_server] [closed]

asked 2016-09-28 14:12:52 -0600

anonymous user



i wrote some code on my Arduino Mega 2560 that reads Quadrature Encoders of my Robot for odometry. For connection i am using rosserial_server. It did work once. But now topics are not publishing anymore. When calling rostopic list arduino_odom and debug topics are not listed. I tried several reboots but nothing seems to help. I also tried to reflash the code onto Arduino.

I hope somebody can help me.

Here is a extract of the code:

    ros::NodeHandle nh;
 // Publish Odometry from Arduino
  geometry_msgs::Twist odom_msg;
  ros::Publisher arduinoPub ("arduino_odom", &odom_msg);

   //Publisher for Debugging
 geometry_msgs::Twist debug_msg;
 ros::Publisher Debug ("debug", &debug_msg);

void setup()
 pinMode(leftencoderA, INPUT); 
 pinMode(leftencoderB, INPUT); 
 digitalWrite(leftencoderA, HIGH);                // turn on pullup resistor
 digitalWrite(leftencoderB, HIGH);
 attachInterrupt(1, leftencoder, RISING);

 pinMode(rightencoderA, INPUT); 
 pinMode(rightencoderB, INPUT); 
 digitalWrite(rightencoderA, HIGH);                // turn on pullup resistor
 digitalWrite(rightencoderB, HIGH);
 attachInterrupt(0, rightencoder, RISING);



void loop()
  odom_msg.linear.x  = LeftVelocity;
  odom_msg.linear.y  = RightVelocity;

  debug_msg.linear.x = leftenc;
  debug_msg.linear.y = rightenc;

  debug_msg.angular.x = LeftVelocity;
  debug_msg.angular.y = RightVelocity;


edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2020-11-16 16:41:57.687632


No ideas? :(

anonymous userAnonymous ( 2016-09-30 05:23:39 -0600 )edit

Could you send the output of rosserial_server? You could try specifying baud rate and serial device. See this especially the serial device number changes sometimes without apparent reason... (arduino could be /dev/ttyACM1, while default is /dev/ttyACM0)

JRikken gravatar image JRikken  ( 2016-09-30 09:47:25 -0600 )edit

Thanks for your tips. I tried to specify some parameters with no success. Still no topics.

Somehow it works perfect with Rosserial python implementation. So i will work python for now.

anonymous userAnonymous ( 2016-09-30 13:05:42 -0600 )edit