roswasm_suite icon indicating copy to clipboard operation
roswasm_suite copied to clipboard

bug: give error during compilation with std_msgs::Duration

Open muddassir93 opened this issue 3 years ago • 0 comments

Thank you so much for this wonderful library for converting ros msgs to JSON and vice versa. It works fine for all msgs but It stuck when I tried to serialize the std_msgs::Duration using roscpp_json_serialize.

Please have a look at the code and its compilation error below:

    // serialization works fine
    std_msgs::Duration msg;
    msg.data = ros::Duration(10);
    ROS_INFO_STREAM("msg: " << msg);
    
    std::string msgStr = roscpp_json::serialize(msg);
    ROS_INFO_STREAM("msgStr: " << msgStr);
    
    
    std_msgs::Duration msg1;
    msg1 = roscpp_json::deserialize<std_msgs::Duration>(msgStr);   //gives error at this line
    ROS_INFO_STREAM("msg1: " << msg1);

Errors     << test_save_load_trajectory:make /home/dell/workspace/ros1/hivebotics/logs/test_save_load_trajectory/build.make.014.log
In file included from /home/dell/workspace/ros1/hivebotics/src/abluo_ros/abluo_programme/test_save_load_trajectory/src/test_save_load_trajectory.cpp:55:
/home/dell/workspace/ros1/hivebotics/src/abluo_ros/third_party_packages/roswasm_suite/roscpp_json_serialize/include/roscpp_json_serialize/deserialize.h: In instantiation of ‘void roscpp_json::JSONIter<reversed>::parse_impl(MSG&, const Value&) [with MSG = ros::Duration; bool reversed = false; rapidjson::Value = rapidjson::GenericValue<rapidjson::UTF8<> >]’:
/home/dell/workspace/ros1/hivebotics/src/abluo_ros/third_party_packages/roswasm_suite/roscpp_json_serialize/include/roscpp_json_serialize/deserialize.h:39:9:   required from ‘typename std::enable_if<std::is_class<T>::value>::type roscpp_json::JSONIter<reversed>::extract(T&, const Value&) [with T = ros::Duration; bool reversed = false; typename std::enable_if<std::is_class<T>::value>::type = void; rapidjson::Value = rapidjson::GenericValue<rapidjson::UTF8<> >]’
/home/dell/workspace/ros1/hivebotics/src/abluo_ros/third_party_packages/roswasm_suite/roscpp_json_serialize/include/roscpp_json_serialize/deserialize.h:158:9:   required from ‘void roscpp_json::JSONIter<reversed>::next(T&) [with T = ros::Duration; bool reversed = false]’
/opt/ros/noetic/include/visualization_msgs/Marker.h:466:7:   required from ‘static void ros::serialization::Serializer<visualization_msgs::Marker_<ContainerAllocator> >::allInOne(Stream&, T) [with Stream = roscpp_json::JSONIter<false>; T = visualization_msgs::Marker_<std::allocator<void> >&; ContainerAllocator = std::allocator<void>]’
/home/dell/workspace/ros1/hivebotics/src/abluo_ros/third_party_packages/roswasm_suite/roscpp_json_serialize/include/roscpp_json_serialize/deserialize.h:111:79:   required from ‘void roscpp_json::JSONIter<reversed>::parse_impl(MSG&, const Value&) [with MSG = visualization_msgs::Marker_<std::allocator<void> >; bool reversed = false; rapidjson::Value = rapidjson::GenericValue<rapidjson::UTF8<> >]’
/home/dell/workspace/ros1/hivebotics/src/abluo_ros/third_party_packages/roswasm_suite/roscpp_json_serialize/include/roscpp_json_serialize/deserialize.h:39:9:   required from ‘typename std::enable_if<std::is_class<T>::value>::type roscpp_json::JSONIter<reversed>::extract(T&, const Value&) [with T = visualization_msgs::Marker_<std::allocator<void> >; bool reversed = false; typename std::enable_if<std::is_class<T>::value>::type = void; rapidjson::Value = rapidjson::GenericValue<rapidjson::UTF8<> >]’
/home/dell/workspace/ros1/hivebotics/src/abluo_ros/third_party_packages/roswasm_suite/roscpp_json_serialize/include/roscpp_json_serialize/deserialize.h:190:13:   [ skipping 8 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/home/dell/workspace/ros1/hivebotics/src/abluo_ros/third_party_packages/roswasm_suite/roscpp_json_serialize/include/roscpp_json_serialize/deserialize.h:190:13:   required from ‘void roscpp_json::JSONIter<reversed>::next(std::vector<T, Allocator>&) [with T = moveit_task_constructor_msgs::SubSolution_<std::allocator<void> >; Allocator = std::allocator<moveit_task_constructor_msgs::SubSolution_<std::allocator<void> > >; bool reversed = false]’
/home/dell/workspace/ros1/hivebotics/devel/.private/moveit_task_constructor_msgs/include/moveit_task_constructor_msgs/Solution.h:793:7:   required from ‘static void ros::serialization::Serializer<moveit_task_constructor_msgs::Solution_<ContainerAllocator> >::allInOne(Stream&, T) [with Stream = roscpp_json::JSONIter<false>; T = moveit_task_constructor_msgs::Solution_<std::allocator<void> >&; ContainerAllocator = std::allocator<void>]’
/home/dell/workspace/ros1/hivebotics/src/abluo_ros/third_party_packages/roswasm_suite/roscpp_json_serialize/include/roscpp_json_serialize/deserialize.h:111:79:   required from ‘void roscpp_json::JSONIter<reversed>::parse_impl(MSG&, const Value&) [with MSG = moveit_task_constructor_msgs::Solution_<std::allocator<void> >; bool reversed = false; rapidjson::Value = rapidjson::GenericValue<rapidjson::UTF8<> >]’
/home/dell/workspace/ros1/hivebotics/src/abluo_ros/third_party_packages/roswasm_suite/roscpp_json_serialize/include/roscpp_json_serialize/deserialize.h:151:9:   required from ‘MSG roscpp_json::JSONIter<reversed>::parse_service_list(const string&) [with MSG = moveit_task_constructor_msgs::Solution_<std::allocator<void> >; bool reversed = false; std::string = std::__cxx11::basic_string<char>]’
/home/dell/workspace/ros1/hivebotics/src/abluo_ros/third_party_packages/roswasm_suite/roscpp_json_serialize/include/roscpp_json_serialize/deserialize.h:206:58:   required from ‘MSG roscpp_json::deserialize(const string&, bool) [with MSG = moveit_task_constructor_msgs::Solution_<std::allocator<void> >; bool reversed = false; std::string = std::__cxx11::basic_string<char>]’
/home/dell/workspace/ros1/hivebotics/src/abluo_ros/abluo_programme/test_save_load_trajectory/src/test_save_load_trajectory.cpp:527:100:   required from here
/home/dell/workspace/ros1/hivebotics/src/abluo_ros/third_party_packages/roswasm_suite/roscpp_json_serialize/include/roscpp_json_serialize/deserialize.h:111:79: error: ‘allInOne<roscpp_json::JSONIter<reversed>, MSG&>’ is not a member of ‘ros::serialization::Serializer<ros::Duration>’
  111 |         ros::serialization::Serializer<MSG>::template allInOne<JSONIter, MSG&>(*this, msg);

muddassir93 avatar Mar 08 '23 15:03 muddassir93