hi, i create a subscribe sevo controller like this tutorial wiki/rosserial_arduino/Tutorials/Servo Controller and i want to create a publisher on my PC. i try with this code, but it doesnt work. could you help me please?
int main(int argc, char **argv)
{
ros::init(argc, argv, "servo_publisher");
ros::NodeHandle n;
ros::Publisher servo_pub = n.advertise<std_msgs::UInt16>("servo", 1000);
ros::Rate loop_rate(10);
int count = 0;
while(ros::ok())
{
std_msgs::UInt16 cmd_msg;
cmd_msg.data = 10;
ROS_INFO("%i",cmd_msg.data);
servo_pub.publish(cmd_msg);
ros::spin();
loop_rate.sleep();
++count;
}
return 0;
}
Originally posted by Emilien on ROS Answers with karma: 167 on 2016-05-03
Post score: 0