From 57264d5a765f81678911032db99b02d985453a22 Mon Sep 17 00:00:00 2001 From: Guilherme Affonso Date: Sun, 23 Oct 2022 09:59:13 +0900 Subject: [PATCH] (roseus_bt) Use CopyDocument in remote subscriber --- .../include/roseus_bt/eus_remote_subscriber_node.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/roseus_bt/include/roseus_bt/eus_remote_subscriber_node.h b/roseus_bt/include/roseus_bt/eus_remote_subscriber_node.h index b1285143a..a736114d4 100644 --- a/roseus_bt/include/roseus_bt/eus_remote_subscriber_node.h +++ b/roseus_bt/include/roseus_bt/eus_remote_subscriber_node.h @@ -4,6 +4,7 @@ #include #include #include +#include namespace BT { @@ -34,7 +35,7 @@ class EusRemoteSubscriberNode: public BT::ActionNodeBase static PortsList providedPorts() { return { InputPort("topic_name", "name of the subscribed topic"), - OutputPort("output_port", "port to where messages are redirected"), + OutputPort("output_port", "port to where messages are redirected"), OutputPort("received_port", "port set to true every time a message is received"), InputPort("host_name", "name of the rosbridge_server host"), InputPort("host_port", "port of the rosbridge_server host") @@ -76,12 +77,9 @@ class EusRemoteSubscriberNode: public BT::ActionNodeBase void setOutputFromMessage(const std::string& name, const rapidjson::Value& message) { - rapidjson::StringBuffer strbuf; - rapidjson::Writer writer(strbuf); - rapidjson::Document document; + rapidjson::CopyDocument document; document.CopyFrom(message, document.GetAllocator()); - document.Accept(writer); - setOutput(name, strbuf.GetString()); + setOutput(name, document); } };