Repository navigation
Use py::class_ for rcl_action_goal_handle_t - #751
Conversation
|
In a certain condition, the state of an |
|
@ros-pull-request-builder retest this |
|
Something seems off with the diff on github. It looks like this PR includes all of #756 - the conversion of Publisher and Subscription. Is that intended? |
|
@greg the Publisher and Subscriber PR is in (in the |
Signed-off-by: Greg Balke <[email protected]>
Signed-off-by: Greg Balke <[email protected]>
Signed-off-by: Greg Balke <[email protected]>
Signed-off-by: Greg Balke <[email protected]>
Signed-off-by: Greg Balke <[email protected]>
Signed-off-by: Greg Balke <[email protected]>
Signed-off-by: Greg Balke <[email protected]>
cefb06f to
edcdc04
Compare
Signed-off-by: Greg Balke <[email protected]>
Signed-off-by: Greg Balke <[email protected]>
edcdc04 to
a92ad1f
Compare
| ACCEPT = 2 | ||
|
|
||
|
|
||
| class GoalEvent(Enum): |
There was a problem hiding this comment.
Since GoalEvent was on the module before, put GoalEvent = _rclpy.GoalEvent as done here:
Lines 20 to 21 in a75529d
| """ | ||
| self._handle = _rclpy.rclpy_action_accept_new_goal( | ||
| action_server._handle, goal_info) | ||
| self._goal = _rclpy.ActionGoalHandle(action_server._handle, goal_info) |
There was a problem hiding this comment.
_goal means something else in this context. I would make this _goal_handle rather than _goal. An action server receives goals from clients, and then uses a goal handle to track the state of the goal.
| "rclpy_action_goal_handle_is_active", &rclpy_action_goal_handle_is_active, | ||
| "Check if a goal is active."); | ||
|
|
||
| define_action_goal_handle(m); |
There was a problem hiding this comment.
I would put this in _rclpy_pybind11.cpp. I hope that _rclpy_action.cpp will go away once everything is converted.
|
|
||
| py::capsule | ||
| rclpy::ActionGoalHandle | ||
| rclpy_action_accept_new_goal(py::capsule pyaction_server, py::object pygoal_info_msg) |
There was a problem hiding this comment.
Recommend replacing the code calling rclpy_action_accept_new_goal with the creation of an _rclpy.ActionGoalHandle(...) in Python to get rid of this API.
| ActionGoalHandle::ActionGoalHandle( | ||
| py::capsule pyaction_server, py::object pygoal_info_msg) | ||
| { | ||
| auto action_server = get_pointer<rcl_action_server_t *>( |
There was a problem hiding this comment.
I think an ActionGoalHandle instance needs to keep the ActionServer alive - but that's hard because ActionServer isn't using the rclpy_handle_t wrapper. I don't think we can do anything about it in this PR, and it's a preexisting bug. This is just making a note that the ActionServer PR should add an std::shared_ptr to the ActionServer on ActionGoalHandle.
* Convert Publisher and Subscription to use C++ Classes (#756) * Convert Publisher and Subscription to C++ Classes Signed-off-by: ahcorde <[email protected]> * Fixed destructor issues Signed-off-by: ahcorde <[email protected]> * [pub/sub 756 addition] use std::shared_ptr holder type and shared_from_this (#757) * Use std::shared_ptr holder type Signed-off-by: Shane Loretz <[email protected]> * Use shared_from_this for pub/sub Signed-off-by: Shane Loretz <[email protected]> * Make Timer keep Clock wrapper Signed-off-by: Shane Loretz <[email protected]> * Fixed publisher and subscription destructors Signed-off-by: ahcorde <[email protected]> * Added feedback Signed-off-by: ahcorde <[email protected]> * Fixed docs Signed-off-by: ahcorde <[email protected]> Co-authored-by: Shane Loretz <[email protected]> * Use py::class_ for rcl_action_goal_handle_t (#751) * Class object Signed-off-by: Greg Balke <[email protected]> * Python adjustments Signed-off-by: Greg Balke <[email protected]> * Adjustments to server and enum Signed-off-by: Greg Balke <[email protected]> * Adjust destructor calls Signed-off-by: Greg Balke <[email protected]> * Clear out destructor Signed-off-by: Greg Balke <[email protected]> * Do what rclcpp did Signed-off-by: Greg Balke <[email protected]> * Remove iostream (used for debugging) Signed-off-by: Greg Balke <[email protected]> * Matching upstream changes Signed-off-by: Greg Balke <[email protected]> * Convert ActionClient to use C++ classes (#759) * Convert ActionClient to use C++ classes Signed-off-by: ahcorde <[email protected]> * Added feedback Signed-off-by: ahcorde <[email protected]> * Added convert_from_py to utils Signed-off-by: ahcorde <[email protected]> * improved docs Signed-off-by: ahcorde <[email protected]> * nits to adapt the code to pybind11 Signed-off-by: ahcorde <[email protected]> * throw a exception in convert_from_py Signed-off-by: ahcorde <[email protected]> * Fixed docs Signed-off-by: ahcorde <[email protected]> * Convert ActionServer to use C++ Classes (#766) * Convert ActionServer to use C++ Classes Signed-off-by: ahcorde <[email protected]> * Fixed Test_action_server Signed-off-by: ahcorde <[email protected]> * Improved docs Signed-off-by: ahcorde <[email protected]> * Improved docs and minor fixes Signed-off-by: ahcorde <[email protected]> * Convert WaitSet to use C++ Classes (#769) * Convert WaitSet to use C++ Classes Signed-off-by: ahcorde <[email protected]> * added feedback Signed-off-by: ahcorde <[email protected]> * Removed unused structs (#770) Signed-off-by: ahcorde <[email protected]> * Convert Guardcondition to use C++ classes (#772) * Convert Guardcondition to use C++ classes Signed-off-by: ahcorde <[email protected]> * make destroy guard condition capsule function private Signed-off-by: ahcorde <[email protected]> * Pybind11 action goal handle nitpicks (#767) * Add GoalEvent back to module Signed-off-by: Shane Loretz <[email protected]> * self._goal -> self._goal_handle Signed-off-by: Shane Loretz <[email protected]> * Remove unused API Signed-off-by: Shane Loretz <[email protected]> Co-authored-by: ahcorde <[email protected]> * Pybind11 actionserver nitpicks and docblock improvements (#774) Signed-off-by: ahcorde <[email protected]> * Convert Node and Context to use C++ Classes (#771) * convert Node and Context to use C++ Classes Signed-off-by: ahcorde <[email protected]> * Added feedback Signed-off-by: ahcorde <[email protected]> * Added feedback Signed-off-by: ahcorde <[email protected]> * Implement solution 1 Signed-off-by: ahcorde <[email protected]> * Prevent double early destruction of destroyable This along with an extra call to `destroy_node()` in `Node.__del__` was causing a segfault in the test_publisher test. The problem is `destroy_when_not_in_use()` was being called twice, and the second time is now a problem because rcl_ptrs_ is dereferenced in the qos_event destroy() method. Signed-off-by: Shane Loretz <[email protected]> * Remove unnecessary Node.__del__ This should not be required. If it is, it means there's a bug that shows when the Node is garbage collected. Signed-off-by: Shane Loretz <[email protected]> * Fix order of pointers in RclPtrs structs The order of the pointers in the RclPtrs structs is important. Things at the bottom are destroyed first, so children must be placed underneath the parent's that must be kept alive. Signed-off-by: Shane Loretz <[email protected]> * Intentionally copy rclpy:: objects instead of having RclPtrs structs (#773) * Rough pass converting everything Signed-off-by: Shane Loretz <[email protected]> * Fixes to get copy destruction order working Signed-off-by: Shane Loretz <[email protected]> * Fix qos_event test flakiness Signed-off-by: Shane Loretz <[email protected]> Signed-off-by: ahcorde <[email protected]> * MacOS warning Signed-off-by: ahcorde <[email protected]> * added feedback and removed some files Signed-off-by: ahcorde <[email protected]> * Create only one context otherwise throw a exception Signed-off-by: ahcorde <[email protected]> Co-authored-by: Shane Loretz <[email protected]> Co-authored-by: Shane Loretz <[email protected]> Co-authored-by: Alejandro Hernández Cordero <[email protected]> Co-authored-by: Greg Balke <[email protected]> Co-authored-by: ahcorde <[email protected]>
* Class object Signed-off-by: Greg Balke <[email protected]> * Python adjustments Signed-off-by: Greg Balke <[email protected]> * Adjustments to server and enum Signed-off-by: Greg Balke <[email protected]> * Adjust destructor calls Signed-off-by: Greg Balke <[email protected]> * Clear out destructor Signed-off-by: Greg Balke <[email protected]> * Do what rclcpp did Signed-off-by: Greg Balke <[email protected]> * Remove iostream (used for debugging) Signed-off-by: Greg Balke <[email protected]> * Matching upstream changes Signed-off-by: Greg Balke <[email protected]>
* Class object Signed-off-by: Greg Balke <[email protected]> * Python adjustments Signed-off-by: Greg Balke <[email protected]> * Adjustments to server and enum Signed-off-by: Greg Balke <[email protected]> * Adjust destructor calls Signed-off-by: Greg Balke <[email protected]> * Clear out destructor Signed-off-by: Greg Balke <[email protected]> * Do what rclcpp did Signed-off-by: Greg Balke <[email protected]> * Remove iostream (used for debugging) Signed-off-by: Greg Balke <[email protected]> * Matching upstream changes Signed-off-by: Greg Balke <[email protected]> Signed-off-by: Shane Loretz <[email protected]>
* Class object Signed-off-by: Greg Balke <[email protected]> * Python adjustments Signed-off-by: Greg Balke <[email protected]> * Adjustments to server and enum Signed-off-by: Greg Balke <[email protected]> * Adjust destructor calls Signed-off-by: Greg Balke <[email protected]> * Clear out destructor Signed-off-by: Greg Balke <[email protected]> * Do what rclcpp did Signed-off-by: Greg Balke <[email protected]> * Remove iostream (used for debugging) Signed-off-by: Greg Balke <[email protected]> * Matching upstream changes Signed-off-by: Greg Balke <[email protected]> Signed-off-by: Shane Loretz <[email protected]>
Part of #665.