ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OK I could finally solve the problem. The issue was the definition of the frame_id. While the ROS message definition declares the frame_id as string (http://docs.ros.org/api/std_msgs/html/msg/Header.html), the rosbridge parser fails to interpret it regardless how you set it in a variable. The only way to get it working is to hardcode the frame_id as empty string (\"frame_id\":\"\") in the json object, such as:

String joynode = "{\"op\":\"publish\",\"topic\":\"/joy\",\"msg\":{\"header\":{\"seq\":" + sequence_ID + ",\"stamp\":{\"secs\":" + time_stamp_sec + ",\"nsecs\":" + timestamp_nsec + "},\"frame_id\":\"\"},\"axes\":" + json_joy_axes +",\"buttons\":" + json_joy_buttons + "}}";

As soon as frame_id contains anything else but a hardcoded empty string, rosbridge will fail.