MotionApproval Class
Everything the motion approval gate needs from its process: whether an app is asking for approval, where an operator's answer is delivered, and the two ROS entities that feed them. More...
Declaration
Included Headers
Public Constructors Index
| MotionApproval (const MotionApproval &)=delete | |
| MotionApproval (MotionApproval &&)=delete | |
| MotionApproval (const std::shared_ptr< rclcpp::Node > &node, const rclcpp::CallbackGroup::SharedPtr &group, MotionApprovalSwitch::SteadyNowFn now={}) | |
|
Subscribes to the app's requests and advertises the answer service, both for the life of this object. More... | |
Public Operators Index
| MotionApproval & | operator= (const MotionApproval &)=delete |
| MotionApproval & | operator= (MotionApproval &&)=delete |
Public Member Functions Index
| bool | isArmed () const |
|
True while some connected Desktop App is asking for every motion to be approved. More... | |
| void | noteApprovalRequested () |
|
Record that a connected Desktop App is asking for approval right now. More... | |
| bool | takeDisarmNotice () |
|
Claim the one-shot notice that the gate has stopped arming, if there is one to claim. More... | |
| MotionApprovalPromptSlot::AnswerCell | tryClaim (const std::string &preview_id) |
|
Take the answer cell for a new prompt, or nullptr when another prompt already holds it. More... | |
Private Member Attributes Index
| std::shared_ptr< MotionApprovalSwitch > | switch_ |
| std::shared_ptr< MotionApprovalPromptSlot > | slot_ |
| std::shared_ptr< rclcpp::SubscriptionBase > | subscription_ |
| std::shared_ptr< rclcpp::ServiceBase > | service_ |
Description
Everything the motion approval gate needs from its process: whether an app is asking for approval, where an operator's answer is delivered, and the two ROS entities that feed them.
One object rather than four members on BehaviorContext, because the parts are only correct together — the subscription is meaningless without the switch it feeds, and a switch nothing feeds silently never arms. Holding them here also keeps that coupling out of the Behavior API: this type lives in internal, so it is not covered by the compatibility guarantee and can change without a deprecation.
The callbacks observe the switch and the slot weakly, because dropping a subscription handle cannot join a callback that is already running and a component container keeps spinning across unload_node. That is what makes destroying this object safe while its node is still being spun.
Definition at line 34 of file motion_approval.hpp.
Public Constructors
MotionApproval()
| delete |
Definition at line 37 of file motion_approval.hpp.
MotionApproval()
| delete |
Definition at line 39 of file motion_approval.hpp.
MotionApproval()
|
Subscribes to the app's requests and advertises the answer service, both for the life of this object.
- Parameters
-
node Node to create the subscription and service on.
group Callback group both are created in; reentrant, so an operator's answer is not queued behind an unrelated long callback while a Behavior blocks waiting for it.
now Steady-clock source for the switch, injectable so a test can advance time without sleeping. Empty means the real clock.
Declaration at line 50 of file motion_approval.hpp, definition at line 109 of file motion_approval.cpp.
Public Operators
operator=()
| delete |
Definition at line 38 of file motion_approval.hpp.
operator=()
| delete |
Definition at line 40 of file motion_approval.hpp.
Public Member Functions
isArmed()
|
True while some connected Desktop App is asking for every motion to be approved.
Declaration at line 54 of file motion_approval.hpp, definition at line 120 of file motion_approval.cpp.
noteApprovalRequested()
|
Record that a connected Desktop App is asking for approval right now.
Declaration at line 57 of file motion_approval.hpp, definition at line 125 of file motion_approval.cpp.
takeDisarmNotice()
|
Claim the one-shot notice that the gate has stopped arming, if there is one to claim.
Declaration at line 60 of file motion_approval.hpp, definition at line 130 of file motion_approval.cpp.
tryClaim()
|
Take the answer cell for a new prompt, or nullptr when another prompt already holds it.
Declaration at line 63 of file motion_approval.hpp, definition at line 135 of file motion_approval.cpp.
Private Member Attributes
service_
|
Definition at line 70 of file motion_approval.hpp.
slot_
|
Definition at line 67 of file motion_approval.hpp.
subscription_
|
Definition at line 69 of file motion_approval.hpp.
switch_
|
Definition at line 66 of file motion_approval.hpp.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.