michaeljenkin / unityros

a unity ros tool
35 stars 41 forks source link

Publishing OccupancyGrid Message to ROS #10

Open AbbasSidaoui opened 6 years ago

AbbasSidaoui commented 6 years ago

Hello, Thank you for your work! I am using your library to send and receive some SLAM maps between unity and ROS. I have succeeded in sending OccupancyGrid msgs from ROS to Unity. However, when trying to send msg back from Unity I am having the "op" error below:

[ERROR] [WallTime: 1514206643.195341] [Client 1] Received a message without an op. All messages require 'op' field with value one of: ['service_response', 'unadvertise_service', 'call_service', 'publish', 'fragment', 'subscribe', 'advertise_service', 'unsubscribe', 'unadvertise', 'advertise']. Original message was:

{"op": "publish", "topic": "/Unitymap", "msg": { "info": {"origin": {"position": {"y": -10, "x": -10, "z": 0}, "orientation": {"y": 0, "x": 0, "z": 0, "w": 1}}, "width": 192, "map_load_time": {"secs": 0, "nsecs": 0}, "resolution": 0.1, "height": 192}, "header": {"stamp": {"secs": 1514206624, "nsecs": 631136325}, "frame_id"= "map", "seq": 2422}, "data":[0,0,0,0,0,0,0,0,0]}} --->> I deleted the data to save some space here.

I have been stuck in this a error for a while, your help is much appreciated!!

michaeljenkin commented 6 years ago

Likely source of the error is a Mal-formed json message. Basically the Unity side just takes the json message and parses out the op field and it can’t find an op field in the message. To debug this take the entire message and give it to some json message parser and look for the offending issue. One possibility is the "frame_id"= "map”, line below.

Michael

On Dec 25, 2017, at 9:37 AM, Abbas Sidaoui notifications@github.com wrote:

Hello, Thank you for your work! I am using your library to send and receive some SLAM maps between unity and ROS. I have succeeded in sending OccupancyGrid msgs from ROS to Unity. However, when trying to send msg back from Unity I am having the "op" error below:

[ERROR] [WallTime: 1514206643.195341] [Client 1] Received a message without an op. All messages require 'op' field with value one of: ['service_response', 'unadvertise_service', 'call_service', 'publish', 'fragment', 'subscribe', 'advertise_service', 'unsubscribe', 'unadvertise', 'advertise']. Original message was:

{"op": "publish", "topic": "/Unitymap", "msg": { "info": {"origin": {"position": {"y": -10, "x": -10, "z": 0}, "orientation": {"y": 0, "x": 0, "z": 0, "w": 1}}, "width": 192, "map_load_time": {"secs": 0, "nsecs": 0}, "resolution": 0.1, "height": 192 }, "header": {"stamp": {"secs": 1514206624, "nsecs": 631136325}, "frame_id"= "map", "seq": 2422 }, "data":[0,0,0,0,0,0,0,0,0] --->> I deleted the data to save some space here. } }

I have been stuck in this a error for a while, your help is much appreciated!!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/michaeljenkin/unityros/issues/10, or mute the thread https://github.com/notifications/unsubscribe-auth/AJy_km54gjjwfm_EDgRYHunk9DR3cx11ks5tD7MTgaJpZM4RMUMh.