Skip to content

Commit

Permalink
Fix rosbag2_py transport test for py capsule
Browse files Browse the repository at this point in the history
Change introduced by ros2/rclpy#741 conflicted with parallel work in #702, the combination causing nightly test failure for `rosbag2_py`'s `_transport.cpp` tests. Fix to use the new `py::object` for `rmw_qos_profile_t` to fix the tests.

Signed-off-by: Emerson Knapp <eknapp@amazon.com>
  • Loading branch information
Emerson Knapp committed Apr 1, 2021
1 parent deefd19 commit f2b2401
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rosbag2_py/src/rosbag2_py/_transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ namespace

rclcpp::QoS qos_from_handle(const py::handle source)
{
auto py_capsule = PyObject_CallMethod(source.ptr(), "get_c_qos_profile", "");
const auto rmw_qos_profile = reinterpret_cast<rmw_qos_profile_t *>(
PyCapsule_GetPointer(py_capsule, "rmw_qos_profile_t"));
const auto qos_init = rclcpp::QoSInitialization::from_rmw(*rmw_qos_profile);
return rclcpp::QoS{qos_init, *rmw_qos_profile};
PyObject * obj = PyObject_CallMethod(source.ptr(), "get_c_qos_profile", "");
auto o = py::cast<py::object>(obj);
auto rmw_qos_profile = o.cast<rmw_qos_profile_t>();
const auto qos_init = rclcpp::QoSInitialization::from_rmw(rmw_qos_profile);
return rclcpp::QoS{qos_init, rmw_qos_profile};
}

QoSMap qos_map_from_py_dict(const py::dict & dict)
Expand Down

0 comments on commit f2b2401

Please sign in to comment.