Ask Your Question
0

Rosserial_windows /message_info fail and other errors

asked 2017-07-09 11:09:50 -0500

retepvan gravatar image

updated 2017-07-09 11:25:53 -0500

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-07-09 11:17:00 -0500

gvdhoorn gravatar image

You're missing the message_info node, which seems to make rosserial rather unhappy.

The socket.launch launch file in rosserial_server starts this (here):

<launch>
  <node pkg="rosserial_server" type="socket_node" name="rosserial_server" />
  <node pkg="rosserial_python" type="message_info_service.py" name="rosserial_message_info" />
</launch>

I'd try to launch the launch file instead of rosrunning the single node and see whether things improve.

edit flag offensive delete link more

Comments

Thank you, that worked! However, I have to shutdown the socket manually every time I want to re-run the application, otherwise new values aren't published. I presume it has to do with not closing the socket cleanly - do you know how I could do that?

retepvan gravatar imageretepvan ( 2017-07-09 11:55:59 -0500 )edit

Which 'socket' are you referring to? On the ROS side or the Windows side?

gvdhoorn gravatar imagegvdhoorn ( 2017-07-09 11:57:58 -0500 )edit

On the ROS side. Right now I terminate the loop of the windows application with ctrl+c and when I re-run it without restarting the ROS socket (by interrupting and running roslaunch rosserial_server socket.launch), the values aren't being published. If I restart the ROS socket, everything works fine.

retepvan gravatar imageretepvan ( 2017-07-09 12:24:41 -0500 )edit

That would seem to indicate that your Windows program doesn't clean up / close down its socket correctly. The ROS side then keeps it open for the timeout period, waiting for the WIndows side to re-establish the conx. I'd look on the rosserial_windows side.

gvdhoorn gravatar imagegvdhoorn ( 2017-07-09 12:31:35 -0500 )edit

Actually, I can make the echo work by restarting the rostopic echo terminals every time I run the windows program. Rostopic list keeps displaying my topics until I interrupt the echo terminals, even after the windows program has finished. It may have to do with new topic IDs being created every run.

retepvan gravatar imageretepvan ( 2017-07-09 17:45:46 -0500 )edit

I had exactly the same problem and roslaunch worked for me. Thank you very much.

Ivan_OUyang gravatar imageIvan_OUyang ( 2019-07-18 14:03:30 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2017-07-09 11:09:50 -0500

Seen: 382 times

Last updated: Jul 09 '17