diff --git a/package.xml b/package.xml index af9c9f0070d48185f5eb4024e7d85bbf4cdd7f69..9c174ca2a39c7bb9c7c88e6e48fb6542b1cc07fc 100644 --- a/package.xml +++ b/package.xml @@ -44,6 +44,7 @@ <!-- <test_depend>gtest</test_depend> --> <buildtool_depend>catkin</buildtool_depend> <depend>gazebo_msgs</depend> + <depend>sensor_msgs</depend> <depend>lrs_msgs_common</depend> <depend>lrs_srvs_wdb</depend> <depend>tf</depend> diff --git a/src/codegen_json_bson/__init__.py b/src/codegen_json_bson/__init__.py index 0ede9fb8bce031b6ce63f31b8635dca8b9b5ec7f..05f274181a4a5467d2516860dbd4750ce400d458 100644 --- a/src/codegen_json_bson/__init__.py +++ b/src/codegen_json_bson/__init__.py @@ -427,7 +427,7 @@ def type_is_complex(ty): "FIPAAclMessage", "PathElementTree", "TSTExecStatus", "TSTExecInfo", "BoundingBoxCVL", "ImageSize", "CVLImage", "DiagnosticStatus", "MultiArrayDimension", "Point32", "KeyValue", "TransformStamped", "ChannelFloat32", "PointField", "Marker", - "LandingDetection", "CompressedImage", + "LandingDetection", "CompressedImage", "PointCloud2", "TargetPrediction", "DepotBookingInfo", "SalientPoint", "LrsVisionDetection", "DelLogItem", "StringList", "Team", "VisionDetection", "SearchUnit", "SearchCell", "PathElement", "ResourceInfo", "Interval", "NavigationData", "GeopointHeadingSpeed", @@ -450,6 +450,8 @@ def field_assignment_get_json_value(field, ty, fieldtype, name): if ty == "bytes": res = "" res += f'// {ty} {field} {fieldtype} {name}\n' + if name == "PointCloud2": + res += f' res["{field}"] = macaron::Base64::Encode(msg.{field});\n' if name == "CompressedImage": res += f' res["{field}"] = macaron::Base64::Encode(msg.{field});\n' if name == "CVLImage": @@ -507,6 +509,16 @@ def field_assignment_parse_json_value(field, ty, fieldtype, name): res += " for (unsigned int i=0; i<out.size(); i++) {\n" res += f' msg.{field}.push_back(out[i]);\n' res += " }" + if name == "PointCloud2": + res += " std::string out;\n" + res += f' std::string res = macaron::Base64::Decode(m["{field}"].asString(), out);\n' + res += " if (res != \"\") {\n" + res += " ROS_ERROR(\"FAILED TO DECODE CVL IMAGE Base64 Data: %s\", res.c_str());\n" + res += " return false;\n" + res += " }\n" + res += " for (unsigned int i=0; i<out.size(); i++) {\n" + res += f' msg.{field}.push_back(out[i]);\n' + res += " }" return res listprefix = "" gen_for_list = True