Bidirectional rosserial communication
Hello everyone,
I am having some trouble regarding a program that connects a RPi3 with ROS and a UNO board. The idea is that the node in RPi advertises on a certain topic that UNO's node is suscribed to. Also, the other way around is meant with another topic, in which the UNO advertises. I have some trouble when defining the publisher on the UNO's code, I don't know if i should put something like:
a)
ros::Publisher pub_boton("topic", &message);
b)
ros::Publisher pub_boton = nh.advertise <std_msgs::Int8> ("topic", 1000);
I saw a) in many examples, but I don't find it in any official documentation.
Another problem I have is that, when I try to publish a std_msgs/Int8, by doing:
#include "std_msgs/Int8.h"
std_msgs::Int8 message;
int b=1; message.data=b;
ros::Publisher pub_boton("topic",&message);
I get the following error:
Nodo_rosserial_ultrasonicov2.ino:12:1: error: ‘message’ does not name a type
I don't get it, as I do specify the type of the message.
Thank you in advance.
Have u checked rosserial_arduino. Make sure you have included
It would be useful to know which line is line 12 of your source code.