#ifndef SNAKE_H #define SNAKE_H #include #include "rapidjson/include/rapidjson/document.h" #include "rapidjson/include/rapidjson/writer.h" #include "rapidjson/include/rapidjson/stringbuffer.h" #include "rapidjson/include/rapidjson/ostreamwrapper.h" using namespace std; // C++ implementation of ROS messages in json representation to communicate with rosbridge. namespace rosbridge_msgs { // C++ representation of ros::Time with fromJson and toJson functions for rosbridge. // fromJson not yet implemented. class Time{ public: Time(); Time(uint32_t secs, uint32_t nsecs); bool toJson(rapidjson::Document &doc, rapidjson::Document::AllocatorType &allocator); uint32_t secs; uint32_t nsecs; }; // C++ representation of std_msgs/Header with fromJson and toJson functions for rosbridge. // fromJson not yet implemented. class Header{ public: Header(); Header(uint32_t seq, const Time &stamp, std::string frame_id); bool toJson(rapidjson::Document &doc, rapidjson::Document::AllocatorType &allocator); uint32_t seq; Time stamp; std::string frame_id; }; // C++ representation of geometry_msgs/Point32 with fromJson and toJson functions for rosbridge. // fromJson not yet implemented. class Point32{ public: Point32(); Point32(_Float32 x, _Float32 y, _Float32 z); bool toJson(rapidjson::Document &doc, rapidjson::Document::AllocatorType &allocator); _Float32 x; _Float32 y; _Float32 z; }; // C++ representation of geometry_msgs/Polygon with fromJson and toJson functions for rosbridge. // fromJson not yet implemented. class Polygon{ public: Polygon(); Polygon(const std::vector &points); bool toJson(rapidjson::Document &doc, rapidjson::Document::AllocatorType &allocator); std::vector points; }; // C++ representation of geometry_msgs/PolygonStamped with fromJson and toJson functions for rosbridge. // fromJson not yet implemented. class PolygonStamped{ public: PolygonStamped(); PolygonStamped(const Header &header, const Polygon &polygon); bool toJson(rapidjson::Document &doc, rapidjson::Document::AllocatorType &allocator); Header header; Polygon polygon; }; // C++ representation of jsk_recognition_msgs/PolygonArray with fromJson and toJson functions for rosbridge. // fromJson not yet implemented. class PolygonArray{ public: PolygonArray(); PolygonArray(const Header &header, const std::vector &polygons, const std::vector &labels, const std::vector<_Float32> &likelihood); bool toJson(rapidjson::Document &doc, rapidjson::Document::AllocatorType &allocator); Header header; std::vector polygons; std::vector labels; std::vector<_Float32> likelihood; }; } #endif // SNAKE_H