Rosserial_windows /message_info fail and other errors
I've got Windows 10 and Ubuntu 16.04 machines connected via crossover cable - good connection with 0% data loss (ping test).
I ran the rosserial_windows tutorial code (also with a string and float message), but the rostopic echo terminal prints the test values only ~1 in every 20 runs of the application, meaning that most of the time the publishing doesn't work. Even when it prints, most values are lost (e.g. only last 20 out of 100 published float values are printed). And sometimes, the echo terminal does nothing and 10 seconds later suddenly prints a couple of values.
The above happens randomly, keeping the same code and same settings. I have tried restarting terminals and roscore as well as various combinations of Sleep() values at various points in the code without success.
Furthermore, the socket_node terminal throws these errors every time I run the application:
me@me-Latitude-E6320:~$ rosrun rosserial_server socket_node
[ INFO] [1499599015.241172592]: Listening for rosserial TCP connections on port 11411
[ INFO] [1499603182.806853843]: waitForService: Service [/message_info] has not been advertised, waiting...
[ WARN] [1499603187.808410969]: Timed out waiting for message_info service to become available.
[ WARN] [1499603187.810210617]: Failed to call message_info service. Proceeding without full message definition.
[ WARN] [1499603187.810350448]: Advertising on topic [/float] with an empty message definition. Some tools (e.g. rosbag) may not work correctly.
[ WARN] [1499603187.815449686]: Failed to call message_info service. Proceeding without full message definition.
[ WARN] [1499603187.815541812]: Advertising on topic [/chatter] with an empty message definition. Some tools (e.g. rosbag) may not work correctly.
[ WARN] [1499603193.034867068]: Socket asio error, closing socket: system:104
Here is the application code for a simple float publish:
#include "tchar.h"
#include <iostream>
#include "ros.h"
#include "duration.cpp"
#include "time.cpp"
#include "WindowsSocket.h"
#include "WindowsSocket.cpp"
#include <sstream>
#include <std_msgs\String.h>
#include <std_msgs\Float64.h>
using std::string;
int _tmain(int argc, _TCHAR * argv[])
{
ros::NodeHandle nh;
char *ros_master = "192.168.1.2:11411";
printf("Connecting to server at %s\n", ros_master);
nh.initNode(ros_master);
printf("Advertising message\n");
std_msgs::Float64 float_msg;
ros::Publisher chpub("chatter", &float_msg);
nh.advertise(chpub);
printf("Go robot go!\n");
for (int i=0; i<100; i++)
{
float_msg.data = (float) 1.503;
chpub.publish(&float_msg);
printf("printing number : %f\n", float_msg.data);
nh.spinOnce();
Sleep(100);
}
printf("All done!\n");
return 0;
}
Do you know how I could resolve these issues and make the publishing work reliably? I need to transfer position and orientation float values at a fast rate from a sensor to move a ROS-controlled robot.
I would appreciate any help. Thanks.