question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Complex message type altered after bridge server sending back to clients

See original GitHub issue

For complex message type, like sensor_msgs/msg/JointState, the message object altered when the rosbridge server tried sending back it to the clients. Here it is:

  • publish sensor_msg/msg/JointState message type:
{ op: 'publish', id: 'publish_setup_jointstate', topic: 'subscribe_jointstate_topic',
  msg: {
    header: {
      stamp: {
        sec: 123456, nanosec: 789
      },
      frame_id: 'main frame'},
    name: ['Tom', 'Jerry'],
    position: [1, 2],
    velocity: [2, 3],
    effort: [4, 5, 6]}}
  • Returned response:
{ op: 'publish', topic: 'subscribe_jointstate_topic',
  msg: {
    header: {
        stamp: [Object],
        frame_id: 'main frame' },
     name: [ 'Tom', 'Jerry' ],
     position: { '0': 1, '1': 2 },
     velocity: { '0': 2, '1': 3 },
     effort: { '0': 4, '1': 5, '2': 6 } } }

The structure of the message altered after serialization. This happened when calling JSON.stringify() and JSON.parse() of the JointState message object.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
qiuzhongcommented, Mar 12, 2018

We should figure out why before a publisher node sending this JointState type message, the JSON.stringify works:

{"header":{
    "stamp":{
      "sec":123456,
      "nanosec":789},
 "frame_id":"main frame"},
 "name":["Tom","Jerry"],
 "position":[1,2],
  "velocity":[2,3],
  "effort":[4,5,6]}

While a subscription node received this message, then the JSON.stringify didn’t work:

{ "header":{
    "stamp":{
    "sec":123456,
    "nanosec":789},
  "frame_id":"main frame"},
  "name":["Tom","Jerry"],
  "position":{"0":1,"1":2},
  "velocity":{"0":2,"1":3},
  "effort":{"0":4,"1":5,"2":6}}
0reactions
minggangwcommented, Mar 14, 2018

So let’s close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Design pattern for handling multiple message types
It provides decoupling of message sending and processing with patterns such as request/response, Command/Query, One-way, Pub/Sub, async, polymorphic dispatching ...
Read more >
Proof Engineering: FIX Gateways
This is a technical article about the FIX protocol and how we modified QuickFIX/J for our Algorithmic Trading use case.
Read more >
JMS message conversion approaches
JMS client data conversion is the conversion of Java™ primitives and objects into bytes in a JMS message as it is sent to...
Read more >
Actions - ROS 2 Design
An action client sends one or more goals (an action to be performed) and monitors their progress. There may be multiple clients per...
Read more >
2. Sockets and Patterns | ØMQ - The Guide
Many architectures follow some kind of client/server model, where the server is ... So the message is not necessarily sent when zmq_send() returns...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found