publish/subscribe arduino
hi, i want to subscribe in a node which publish 3 values from arduino. when i run: rostopic echo /servo, i receive my values, but when i run my node i receive others values. what can i do please? this is my code:
#include "ros/ros.h"
#include "std_msgs/Int8.h"
void angleCallback(const std_msgs::Int8& servo_msg)
{
ROS_INFO("I turn: [%i]", servo_msg);
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "angle_listener");
ros::NodeHandle n;
ros::Subscriber sub = n.subscribe("/servo", 1000, angleCallback);
ros::spin();
return 0;
}
Asked by Emilien on 2016-04-07 03:22:43 UTC
Comments
This is a duplicate of http://answers.ros.org/question/230978/subscribe-node/ . Please update that question instead of asking a new question. You can update your question by using the
edit
button.Asked by ahendrix on 2016-04-07 04:23:42 UTC