Skip to main content

ControlStereoVisualOdometry Class Template

Thin lifecycle, reset, and status control surface for the native stereo VO runtime. More...

Declaration​

template <StereoVisualOdometryOperation operation>
class moveit_pro::behaviors::ControlStereoVisualOdometry<operation> { ... }

Included Headers​

#include <control_stereo_visual_odometry.hpp>

Base class​

classServiceClientBehaviorBase<ServiceT>

A base class for behaviors which need to send a request to a ROS service client and wait for a result. More...

Public Member Typedefs Index​

template <StereoVisualOdometryOperation operation>
usingService = moveit_pro_nav_msgs::srv::ControlStereoVisualOdometry

Public Constructors Index​

template <StereoVisualOdometryOperation operation>
ControlStereoVisualOdometry (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
template <StereoVisualOdometryOperation operation>
ControlStereoVisualOdometry (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< ClientInterfaceBase< Service > > client_interface)

Constructor taking an explicit service client, to support testing with a mock. More...

Private Member Functions Index​

template <StereoVisualOdometryOperation operation>
voidseedNoReadingOutputs ()

Write the three health outputs as "no reading", before anything can fail. More...

template <StereoVisualOdometryOperation operation>
auto getServiceName () override -> tl::expected< std::string, std::string >

User-provided function to get the name of the service when initializing the service client. More...

template <StereoVisualOdometryOperation operation>
BT::NodeStatusonStart () override

Seed the health outputs on the tick thread, then start the asynchronous call. More...

template <StereoVisualOdometryOperation operation>
auto getResponseTimeout () override -> tl::expected< std::chrono::duration< double >, std::string >

Optional user-provided function to set the timeout used when waiting for the service response. More...

template <StereoVisualOdometryOperation operation>
auto createRequest () override -> tl::expected< Service::Request, std::string >

User-provided function to create the service request. More...

template <StereoVisualOdometryOperation operation>
auto processResponse (const Service::Response &response) override -> tl::expected< bool, std::string >
template <StereoVisualOdometryOperation operation>
auto getFuture () override -> std::shared_future< tl::expected< bool, std::string > > &

Gets the shared future which is used to monitor the progress of the async process. More...

Private Member Attributes Index​

template <StereoVisualOdometryOperation operation>
std::shared_future< tl::expected< bool, std::string > >future_

Public Static Functions Index​

template <StereoVisualOdometryOperation operation>
static BT::PortsListprovidedPorts ()
template <StereoVisualOdometryOperation operation>
static BT::KeyValueVectormetadata ()

Public Static Attributes Index​

template <StereoVisualOdometryOperation operation>
static constexpr autokResetPosePort = "reset_pose"
template <StereoVisualOdometryOperation operation>
static constexpr autokServiceNamePort = "service_name"
template <StereoVisualOdometryOperation operation>
static constexpr autokResponseTimeoutPort = "response_timeout"
template <StereoVisualOdometryOperation operation>
static constexpr autokRuntimeStatePort = "runtime_state"
template <StereoVisualOdometryOperation operation>
static constexpr autokTrackingStatePort = "tracking_state"
template <StereoVisualOdometryOperation operation>
static constexpr autokSynchronizedFramesPort = "synchronized_frames"
template <StereoVisualOdometryOperation operation>
static constexpr autokRejectedFramesPort = "rejected_frames"
template <StereoVisualOdometryOperation operation>
static constexpr autokReinitializationsPort = "reinitializations"
template <StereoVisualOdometryOperation operation>
static constexpr autokStatusMessagePort = "status_message"

Description​

Thin lifecycle, reset, and status control surface for the native stereo VO runtime.

Sends one typed command to the long-lived stereo visual odometry component and reports its runtime, tracking, and frame-accounting status without owning inference resources. The command is fixed by the template parameter, so each registered Behavior name issues exactly one operation. The tick fails when the service reports failure, and the output ports still carry the runtime's measured status in that case. When the call itself does not complete, runtime_state reads UNKNOWN, tracking_state reads unknown, and status_message says there was no reading, rather than a previous tick's values; the three frame counters keep their last reading, because zero is a real count and would read as a runtime that restarted.

The service response is uniform across all four commands, so every instantiation provides the same six status outputs.

Data Port NamePort TypeObject Type
reset_poseinputbool
service_nameinputstd::string
response_timeoutinputdouble
runtime_stateoutputuint8_t
tracking_stateoutputstd::string
synchronized_framesoutputuint64_t
rejected_framesoutputuint64_t
reinitializationsoutputuint64_t
status_messageoutputstd::string

reset_pose is offered by ResetStereoVisualOdometry alone; the other three names ignore it, so they do not provide it.

Definition at line 58 of file control_stereo_visual_odometry.hpp.

Public Member Typedefs​

Service​

template <StereoVisualOdometryOperation operation>
using moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::Service = moveit_pro_nav_msgs::srv::ControlStereoVisualOdometry

Definition at line 62 of file control_stereo_visual_odometry.hpp.

Public Constructors​

ControlStereoVisualOdometry()​

template <StereoVisualOdometryOperation operation>
moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::ControlStereoVisualOdometry (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources)
Parameters
name

Behavior Tree node name.

config

Behavior Tree node configuration.

shared_resources

Shared MoveIt Pro Behavior resources.

Declaration at line 79 of file control_stereo_visual_odometry.hpp, definition at line 128 of file control_stereo_visual_odometry.cpp.

ControlStereoVisualOdometry()​

template <StereoVisualOdometryOperation operation>
moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::ControlStereoVisualOdometry (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources, std::unique_ptr< ClientInterfaceBase< Service > > client_interface)

Constructor taking an explicit service client, to support testing with a mock.

Parameters
name

Behavior Tree node name.

config

Behavior Tree node configuration.

shared_resources

Shared MoveIt Pro Behavior resources.

client_interface

Service client this Behavior sends its command through.

Declaration at line 89 of file control_stereo_visual_odometry.hpp, definition at line 136 of file control_stereo_visual_odometry.cpp.

Private Member Functions​

createRequest()​

template <StereoVisualOdometryOperation operation>
tl::expected< moveit_pro_nav_msgs::srv::ControlStereoVisualOdometry::Request, std::string > moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::createRequest ()
virtual

User-provided function to create the service request.

Returns

Returns a service request message. If not successful, returns an error message. Note that the criteria for success or failure is defined by the user's implementation of this function.

Declaration at line 109 of file control_stereo_visual_odometry.hpp, definition at line 213 of file control_stereo_visual_odometry.cpp.

getFuture()​

template <StereoVisualOdometryOperation operation>
std::shared_future< tl::expected< bool, std::string > > & moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::getFuture ()
inline virtual

Gets the shared future which is used to monitor the progress of the async process.

Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member.

This exists to prevent destruction of the derived class while the async process is still in-progress. If the derived class is destroyed, the definitions of the functions used within doWork() will be destroyed too, which will result in the virtual functions in the base class being called instead and cause a fault.

This function will force derived classes to add an instance of this type and return a reference to it. The base class can then use this virtual function to access the shared future in functions like onStart.

By adding this virtual function we're properly demonstrating how this future depends on things from the derived class and the natural flow of object lifetimes will do the hard work for us. The std::shared_future destructor will get the value of the future before the derived class is destructed assuming it's the last reference to the shared state. Doing it this way means neither the base nor derived class should need to implement a destructor which is a nice property to have.

Returns

Returns the shared_future, which should be owned by the child class.

Definition at line 112 of file control_stereo_visual_odometry.hpp.

getResponseTimeout()​

template <StereoVisualOdometryOperation operation>
tl::expected< std::chrono::duration< double >, std::string > moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::getResponseTimeout ()
virtual

Optional user-provided function to set the timeout used when waiting for the service response.

If no user-defined implementation is provided, the default implementation returns a negative duration, which will cause the service client to wait for the response without timing out.

Returns

Returns the service response timeout duration. If not successful, returns an error message. Note that the criteria for success or failure is defined by the user's implementation of this function.

Declaration at line 108 of file control_stereo_visual_odometry.hpp, definition at line 196 of file control_stereo_visual_odometry.cpp.

getServiceName()​

template <StereoVisualOdometryOperation operation>
tl::expected< std::string, std::string > moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::getServiceName ()
virtual

User-provided function to get the name of the service when initializing the service client.

Returns

Returns the name of the service. If not successful, returns an error message. Note that the criteria for success or failure is defined by the user's implementation of this function.

Declaration at line 105 of file control_stereo_visual_odometry.hpp, definition at line 157 of file control_stereo_visual_odometry.cpp.

onStart()​

template <StereoVisualOdometryOperation operation>
BT::NodeStatus moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::onStart ()

Seed the health outputs on the tick thread, then start the asynchronous call.

Declaration at line 107 of file control_stereo_visual_odometry.hpp, definition at line 185 of file control_stereo_visual_odometry.cpp.

processResponse()​

template <StereoVisualOdometryOperation operation>
tl::expected< bool, std::string > moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::processResponse (const Service::Response & response)

Declaration at line 110 of file control_stereo_visual_odometry.hpp, definition at line 234 of file control_stereo_visual_odometry.cpp.

seedNoReadingOutputs()​

template <StereoVisualOdometryOperation operation>
void moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::seedNoReadingOutputs ()

Write the three health outputs as "no reading", before anything can fail.

The counters are deliberately not touched: they are monotonic, so a fabricated zero would read as a runtime that restarted rather than as a tick that got no answer, and staleness is the lesser wrong for them.

Declaration at line 103 of file control_stereo_visual_odometry.hpp, definition at line 172 of file control_stereo_visual_odometry.cpp.

Private Member Attributes​

future_​

template <StereoVisualOdometryOperation operation>
std::shared_future<tl::expected<bool, std::string> > moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::future_

Definition at line 116 of file control_stereo_visual_odometry.hpp.

Public Static Functions​

metadata()​

template <StereoVisualOdometryOperation operation>
BT::KeyValueVector moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::metadata ()
static

Declaration at line 94 of file control_stereo_visual_odometry.hpp, definition at line 151 of file control_stereo_visual_odometry.cpp.

providedPorts()​

template <StereoVisualOdometryOperation operation>
BT::PortsList moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::providedPorts ()
static

Declaration at line 93 of file control_stereo_visual_odometry.hpp, definition at line 145 of file control_stereo_visual_odometry.cpp.

Public Static Attributes​

kReinitializationsPort​

template <StereoVisualOdometryOperation operation>
constexpr auto moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::kReinitializationsPort = "reinitializations"
constexpr static

Definition at line 71 of file control_stereo_visual_odometry.hpp.

kRejectedFramesPort​

template <StereoVisualOdometryOperation operation>
constexpr auto moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::kRejectedFramesPort = "rejected_frames"
constexpr static

Definition at line 70 of file control_stereo_visual_odometry.hpp.

kResetPosePort​

template <StereoVisualOdometryOperation operation>
constexpr auto moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::kResetPosePort = "reset_pose"
constexpr static

Definition at line 64 of file control_stereo_visual_odometry.hpp.

kResponseTimeoutPort​

template <StereoVisualOdometryOperation operation>
constexpr auto moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::kResponseTimeoutPort = "response_timeout"
constexpr static

Definition at line 66 of file control_stereo_visual_odometry.hpp.

kRuntimeStatePort​

template <StereoVisualOdometryOperation operation>
constexpr auto moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::kRuntimeStatePort = "runtime_state"
constexpr static

Definition at line 67 of file control_stereo_visual_odometry.hpp.

kServiceNamePort​

template <StereoVisualOdometryOperation operation>
constexpr auto moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::kServiceNamePort = "service_name"
constexpr static

Definition at line 65 of file control_stereo_visual_odometry.hpp.

kStatusMessagePort​

template <StereoVisualOdometryOperation operation>
constexpr auto moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::kStatusMessagePort = "status_message"
constexpr static

Definition at line 72 of file control_stereo_visual_odometry.hpp.

kSynchronizedFramesPort​

template <StereoVisualOdometryOperation operation>
constexpr auto moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::kSynchronizedFramesPort = "synchronized_frames"
constexpr static

Definition at line 69 of file control_stereo_visual_odometry.hpp.

kTrackingStatePort​

template <StereoVisualOdometryOperation operation>
constexpr auto moveit_pro::behaviors::ControlStereoVisualOdometry< operation >::kTrackingStatePort = "tracking_state"
constexpr static

Definition at line 68 of file control_stereo_visual_odometry.hpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.