Skip to main content

MotionApprovalSwitch Class

Tracks whether a MoveIt Pro Desktop App is currently asking for every robot motion to be approved. More...

Declaration​

class moveit_pro::behaviors::MotionApprovalSwitch { ... }

Included Headers​

#include <motion_approval_switch.hpp>

Public Member Typedefs Index​

usingSteadyNowFn = std::function< std::chrono::steady_clock::time_point()>

Public Constructors Index​

MotionApprovalSwitch (SteadyNowFn now=[] { return std::chrono::steady_clock::now();})

Public Member Functions Index​

voidnoteApprovalRequested ()

Record that a connected Desktop App is asking for approval right now. More...

boolisArmed () const

True while some connected Desktop App is asking for every motion to be approved. More...

booltakeDisarmNotice ()

Claim the one-shot notice that the gate has stopped arming, if there is one to claim. More...

Private Member Attributes Index​

SteadyNowFnnow_fn_
std::atomic< bool >has_request_ { false }
std::atomic< std::chrono::steady_clock::time_point >last_request_ { std::chrono::steady_clock::time_point{} }
std::atomic< bool >disarm_notice_pending_ { false }

Description​

Tracks whether a MoveIt Pro Desktop App is currently asking for every robot motion to be approved.

The app repeats the request on a timer instead of latching it, because the web bridge protocol carries no QoS and so cannot advertise a transient_local publisher. Only the asking is ever sent: an app that does not want the gate stays silent rather than saying so, which is what lets several operators share one Runtime without one of them switching the gate off for the others. Silence is therefore the only way the gate is released, and it is released by a timeout rather than by a message — so no ROS participant can disarm it by publishing.

Holds no ROS state; the owner feeds it with noteApprovalRequested() from a subscription callback.

Definition at line 35 of file motion_approval_switch.hpp.

Public Member Typedefs​

SteadyNowFn​

using moveit_pro::behaviors::MotionApprovalSwitch::SteadyNowFn = std::function<std::chrono::steady_clock::time_point()>

Definition at line 38 of file motion_approval_switch.hpp.

Public Constructors​

MotionApprovalSwitch()​

moveit_pro::behaviors::MotionApprovalSwitch::MotionApprovalSwitch (SteadyNowFn now=[] { return std::chrono::steady_clock::now();})
explicit
Parameters
now

Steady-clock source, injectable so tests can advance time without sleeping. Wall-clock deliberately: this measures an external app's liveness over a network, not simulated robot time, and the publisher's own repeat is a wall-clock timer — honouring /use_sim_time would disarm the gate whenever simulation fell behind.

Declaration at line 45 of file motion_approval_switch.hpp, definition at line 14 of file motion_approval_switch.cpp.

Public Member Functions​

isArmed()​

bool moveit_pro::behaviors::MotionApprovalSwitch::isArmed ()

True while some connected Desktop App is asking for every motion to be approved.

Also answers "is anyone still there to approve": with only the asking on the wire, a Behavior already waiting can watch this go false and fail rather than wait for an answer nobody will send.

Declaration at line 55 of file motion_approval_switch.hpp, definition at line 27 of file motion_approval_switch.cpp.

noteApprovalRequested()​

void moveit_pro::behaviors::MotionApprovalSwitch::noteApprovalRequested ()

Record that a connected Desktop App is asking for approval right now.

Declaration at line 48 of file motion_approval_switch.hpp, definition at line 18 of file motion_approval_switch.cpp.

takeDisarmNotice()​

bool moveit_pro::behaviors::MotionApprovalSwitch::takeDisarmNotice ()

Claim the one-shot notice that the gate has stopped arming, if there is one to claim.

True at most once per quiet spell: some app asked for approval, nothing has repeated it inside the timeout, and motion is now about to run ungated. The next request re-arms the notice, so a later quiet spell reports again while a long one stays silent instead of warning on every motion. Not const — claiming consumes it.

Declaration at line 64 of file motion_approval_switch.hpp, definition at line 39 of file motion_approval_switch.cpp.

Private Member Attributes​

disarm_notice_pending_​

std::atomic<bool> moveit_pro::behaviors::MotionApprovalSwitch::disarm_notice_pending_ { false }

Definition at line 72 of file motion_approval_switch.hpp.

has_request_​

std::atomic<bool> moveit_pro::behaviors::MotionApprovalSwitch::has_request_ { false }

Definition at line 70 of file motion_approval_switch.hpp.

last_request_​

std::atomic<std::chrono::steady_clock::time_point> moveit_pro::behaviors::MotionApprovalSwitch::last_request_ { std::chrono::steady_clock::time_point{} }

Definition at line 71 of file motion_approval_switch.hpp.

now_fn_​

SteadyNowFn moveit_pro::behaviors::MotionApprovalSwitch::now_fn_

Definition at line 67 of file motion_approval_switch.hpp.


The documentation for this class was generated from the following files:


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.