Skip to content

Commit

Permalink
Fix rosbag2_py transport test for py capsule (ros2#707)
Browse files Browse the repository at this point in the history
* Fix rosbag2_py transport test for py capsule

Change introduced by ros2/rclpy#741 conflicted with parallel work in ros2#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
emersonknapp committed Apr 1, 2021
1 parent deefd19 commit f1d7d92
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 * raw_obj = PyObject_CallMethod(source.ptr(), "get_c_qos_profile", "");
const auto py_obj = py::cast<py::object>(raw_obj);
const auto rmw_qos_profile = py_obj.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 f1d7d92

Please sign in to comment.