ControlStereoVisualOdometry Class Template
Thin lifecycle, reset, and status control surface for the native stereo VO runtime. More...
Declaration
class moveit_pro::behaviors::ControlStereoVisualOdometry<operation> { ... }
Included Headers
Base class
| class | ServiceClientBehaviorBase<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> | |
| using | Service = 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> | |
| void | seedNoReadingOutputs () |
|
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::NodeStatus | onStart () 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::PortsList | providedPorts () |
template <StereoVisualOdometryOperation operation> | |
| static BT::KeyValueVector | metadata () |
Public Static Attributes Index
template <StereoVisualOdometryOperation operation> | |
| static constexpr auto | kResetPosePort = "reset_pose" |
template <StereoVisualOdometryOperation operation> | |
| static constexpr auto | kServiceNamePort = "service_name" |
template <StereoVisualOdometryOperation operation> | |
| static constexpr auto | kResponseTimeoutPort = "response_timeout" |
template <StereoVisualOdometryOperation operation> | |
| static constexpr auto | kRuntimeStatePort = "runtime_state" |
template <StereoVisualOdometryOperation operation> | |
| static constexpr auto | kTrackingStatePort = "tracking_state" |
template <StereoVisualOdometryOperation operation> | |
| static constexpr auto | kSynchronizedFramesPort = "synchronized_frames" |
template <StereoVisualOdometryOperation operation> | |
| static constexpr auto | kRejectedFramesPort = "rejected_frames" |
template <StereoVisualOdometryOperation operation> | |
| static constexpr auto | kReinitializationsPort = "reinitializations" |
template <StereoVisualOdometryOperation operation> | |
| static constexpr auto | kStatusMessagePort = "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 Name | Port Type | Object Type |
|---|---|---|
| reset_pose | input | bool |
| service_name | input | std::string |
| response_timeout | input | double |
| runtime_state | output | uint8_t |
| tracking_state | output | std::string |
| synchronized_frames | output | uint64_t |
| rejected_frames | output | uint64_t |
| reinitializations | output | uint64_t |
| status_message | output | std::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
|
Definition at line 62 of file control_stereo_visual_odometry.hpp.
Public Constructors
ControlStereoVisualOdometry()
|
- 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()
|
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()
| 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()
| 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()
| 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()
| 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()
|
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()
|
Declaration at line 110 of file control_stereo_visual_odometry.hpp, definition at line 234 of file control_stereo_visual_odometry.cpp.
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_
|
Definition at line 116 of file control_stereo_visual_odometry.hpp.
Public Static Functions
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()
| 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
| constexpr static |
Definition at line 71 of file control_stereo_visual_odometry.hpp.
kRejectedFramesPort
| constexpr static |
Definition at line 70 of file control_stereo_visual_odometry.hpp.
kResetPosePort
| constexpr static |
Definition at line 64 of file control_stereo_visual_odometry.hpp.
kResponseTimeoutPort
| constexpr static |
Definition at line 66 of file control_stereo_visual_odometry.hpp.
kRuntimeStatePort
| constexpr static |
Definition at line 67 of file control_stereo_visual_odometry.hpp.
kServiceNamePort
| constexpr static |
Definition at line 65 of file control_stereo_visual_odometry.hpp.
kStatusMessagePort
| constexpr static |
Definition at line 72 of file control_stereo_visual_odometry.hpp.
kSynchronizedFramesPort
| constexpr static |
Definition at line 69 of file control_stereo_visual_odometry.hpp.
kTrackingStatePort
| 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.