Skip to content

Conversation

@Marc-404
Copy link

@Marc-404 Marc-404 commented Mar 4, 2021

No description provided.

@PeterMitrano
Copy link

FWIW I am using this on noetic without any issues, and have added a ton of additional messages from moveit

https://github.com/UM-ARM-Lab/pyrosmsg

@Marc-404
Copy link
Author

@PeterMitrano Hi, thanks for the information. I tested your fork and it works great. But I had to change two lines of code in one of your files too satisfy all of our tests:

--- a/include/pyrosmsg/converters.hpp
+++ b/include/pyrosmsg/converters.hpp
@@ -380,8 +380,7 @@ struct type_caster<geometry_msgs::TransformStamped>
     object MsgType = mod.attr("TransformStamped");
     object msg = MsgType();
     msg.attr("header") = pybind11::cast(cpp_msg.header);
-    msg.attr("child_frame_id") = pybind11::bytes(reinterpret_cast<const char *>(&cpp_msg.child_frame_id[0]),
-                                                 cpp_msg.child_frame_id.size());
+    msg.attr("child_frame_id") = pybind11::cast(cpp_msg.child_frame_id);
     msg.attr("transform") = pybind11::cast(cpp_msg.transform);
     msg.inc_ref();
     return msg;
@@ -417,8 +416,7 @@ struct type_caster<sensor_msgs::PointField>
     // avoid !!python/unicode problem.
     // msg.attr("name") = pybind11::cast(cpp_msg.name);
     // msg.attr("name") = PyString_FromString(cpp_msg.name.c_str());
-    msg.attr("name") = pybind11::bytes(
-        reinterpret_cast<const char *>(&cpp_msg.name[0]), cpp_msg.name.size());
+    msg.attr("name") = pybind11::cast(cpp_msg.name);

You actually already applied the same change to the header message.

@PeterMitrano
Copy link

If you PR that to my fork I will merge it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants