-
 

json_transport repository

Repository Summary

Checkout URI https://github.com/locusrobotics/json_transport.git
VCS Type git
VCS Version devel
Last Updated 2024-12-05
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

Name Version
json_msgs 0.10.0
json_transport 0.10.0

README

json_transport

Build Status

Providing schemaless transport over ROS pub/sub via JSON. This is useful when schema is enforced elsewhere, or the data is truly schemaless (i.e. parameters, diagnostics).

C++

The provided serializers allow publishing and subscribing json_transport::json_t datatypes, which are nlohmann::json under the hood.

The nlohmann/json.hpp library is bundled in, but can be dropped for an apt dependency in artful, or if the package is bloomed into the rosdistro.

#include "json_transport/json_transport.hpp"

json_transport::json_t sent = {
  {"this_is_json", true},
  {"pi", 3.141},
  {"list_of_plugins", {
    "every_kind",
    "of_plugin",
    "you_can_imagine"
  }},
};

ros::NodeHandle nh;
auto publisher = nh.advertise<json_transport::json_t>("json", 1, true);
publisher.publish(sent);

auto received = ros::topic::waitForMessage<json_transport::json_t>("json");

assert(*received == sent);

Nested json_msg/Json types can be packed/unpacked via helper methods:

MyCustomMessage message();
message.json_field = json_transport::pack(json_data)

assert(json_data == json_transport::unpack(message.json_field))

Python

The provided json_transport.PackedJson data type allows publishing and subscribing anything that can be serialized/deserialized natively via the stdlib json module.

import json_transport
import rospy

rospy.init_node('json_talker')
pub = rospy.Publisher('json', json_transport.PackedJson, queue_size=1, latch=True)
pub.publish(1)
pub.publish([1, 2, 3])
pub.publish({'a': 1, 'b': 2, 'c': 3})

msg = rospy.wait_for_message('json', json_transport.PackedJson)

assert msg.data == {'a': 1, 'b': 2, 'c': 3}

Nested json_msg/Json types can be packed/unpacked via helper methods:

msg = MyCustomMessage(
    json_field=json_transport.pack(serializable_data)
)

assert serializable_data == json_transport.unpack(msg.json_field)

CONTRIBUTING

No CONTRIBUTING.md found.

Repository Summary

Checkout URI https://github.com/locusrobotics/json_transport.git
VCS Type git
VCS Version devel
Last Updated 2024-12-05
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

Name Version
json_msgs 0.10.0
json_transport 0.10.0

README

json_transport

Build Status

Providing schemaless transport over ROS pub/sub via JSON. This is useful when schema is enforced elsewhere, or the data is truly schemaless (i.e. parameters, diagnostics).

C++

The provided serializers allow publishing and subscribing json_transport::json_t datatypes, which are nlohmann::json under the hood.

The nlohmann/json.hpp library is bundled in, but can be dropped for an apt dependency in artful, or if the package is bloomed into the rosdistro.

#include "json_transport/json_transport.hpp"

json_transport::json_t sent = {
  {"this_is_json", true},
  {"pi", 3.141},
  {"list_of_plugins", {
    "every_kind",
    "of_plugin",
    "you_can_imagine"
  }},
};

ros::NodeHandle nh;
auto publisher = nh.advertise<json_transport::json_t>("json", 1, true);
publisher.publish(sent);

auto received = ros::topic::waitForMessage<json_transport::json_t>("json");

assert(*received == sent);

Nested json_msg/Json types can be packed/unpacked via helper methods:

MyCustomMessage message();
message.json_field = json_transport::pack(json_data)

assert(json_data == json_transport::unpack(message.json_field))

Python

The provided json_transport.PackedJson data type allows publishing and subscribing anything that can be serialized/deserialized natively via the stdlib json module.

import json_transport
import rospy

rospy.init_node('json_talker')
pub = rospy.Publisher('json', json_transport.PackedJson, queue_size=1, latch=True)
pub.publish(1)
pub.publish([1, 2, 3])
pub.publish({'a': 1, 'b': 2, 'c': 3})

msg = rospy.wait_for_message('json', json_transport.PackedJson)

assert msg.data == {'a': 1, 'b': 2, 'c': 3}

Nested json_msg/Json types can be packed/unpacked via helper methods:

msg = MyCustomMessage(
    json_field=json_transport.pack(serializable_data)
)

assert serializable_data == json_transport.unpack(msg.json_field)

CONTRIBUTING

No CONTRIBUTING.md found.

Repository Summary

Checkout URI https://github.com/locusrobotics/json_transport.git
VCS Type git
VCS Version devel
Last Updated 2024-12-05
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

Name Version
json_msgs 0.10.0
json_transport 0.10.0

README

json_transport

Build Status

Providing schemaless transport over ROS pub/sub via JSON. This is useful when schema is enforced elsewhere, or the data is truly schemaless (i.e. parameters, diagnostics).

C++

The provided serializers allow publishing and subscribing json_transport::json_t datatypes, which are nlohmann::json under the hood.

The nlohmann/json.hpp library is bundled in, but can be dropped for an apt dependency in artful, or if the package is bloomed into the rosdistro.

#include "json_transport/json_transport.hpp"

json_transport::json_t sent = {
  {"this_is_json", true},
  {"pi", 3.141},
  {"list_of_plugins", {
    "every_kind",
    "of_plugin",
    "you_can_imagine"
  }},
};

ros::NodeHandle nh;
auto publisher = nh.advertise<json_transport::json_t>("json", 1, true);
publisher.publish(sent);

auto received = ros::topic::waitForMessage<json_transport::json_t>("json");

assert(*received == sent);

Nested json_msg/Json types can be packed/unpacked via helper methods:

MyCustomMessage message();
message.json_field = json_transport::pack(json_data)

assert(json_data == json_transport::unpack(message.json_field))

Python

The provided json_transport.PackedJson data type allows publishing and subscribing anything that can be serialized/deserialized natively via the stdlib json module.

import json_transport
import rospy

rospy.init_node('json_talker')
pub = rospy.Publisher('json', json_transport.PackedJson, queue_size=1, latch=True)
pub.publish(1)
pub.publish([1, 2, 3])
pub.publish({'a': 1, 'b': 2, 'c': 3})

msg = rospy.wait_for_message('json', json_transport.PackedJson)

assert msg.data == {'a': 1, 'b': 2, 'c': 3}

Nested json_msg/Json types can be packed/unpacked via helper methods:

msg = MyCustomMessage(
    json_field=json_transport.pack(serializable_data)
)

assert serializable_data == json_transport.unpack(msg.json_field)

CONTRIBUTING

No CONTRIBUTING.md found.