SMACC2
|
#include <cp_odom_tracker.hpp>
Classes | |
struct | PathInfo |
Public Member Functions | |
CpOdomTracker (std::string odomtopicName="/odom", std::string odomFrame="odom", OdomTrackerStrategy strategy=OdomTrackerStrategy::ODOMETRY_SUBSCRIBER) | |
virtual void | processNewPose (const geometry_msgs::msg::PoseStamped &odom) |
odom callback: Updates the path - this must be called periodically for each odometry message. | |
virtual void | odomMessageCallback (const nav_msgs::msg::Odometry::SharedPtr odom) |
virtual void | update () |
void | setWorkingMode (WorkingMode workingMode) |
void | setPublishMessages (bool value) |
void | pushPath () |
void | pushPath (std::string pathname) |
void | popPath (int pathCount=1, bool keepPreviousPath=false) |
void | clearPath () |
void | setStartPoint (const geometry_msgs::msg::PoseStamped &pose) |
void | setStartPoint (const geometry_msgs::msg::Pose &pose) |
void | setCurrentMotionGoal (const geometry_msgs::msg::PoseStamped &pose) |
void | setCurrentPathName (const std::string ¤tPathName) |
std::optional< geometry_msgs::msg::PoseStamped > | getCurrentMotionGoal () |
nav_msgs::msg::Path | getPath () |
void | logStateString (bool debug=true) |
void | updateParameters () |
void | setOdomFrame (std::string odomFrame) |
![]() | |
ISmaccComponent () | |
virtual | ~ISmaccComponent () |
virtual std::string | getName () const |
Protected Member Functions | |
void | onInitialize () override |
void | updateConfiguration () |
virtual void | rtPublishPaths (rclcpp::Time timestamp) |
virtual bool | updateRecordPath (const geometry_msgs::msg::PoseStamped &odom) |
virtual bool | updateClearPath (const geometry_msgs::msg::PoseStamped &odom) |
void | updateAggregatedStackPath () |
rcl_interfaces::msg::SetParametersResult | parametersCallback (const std::vector< rclcpp::Parameter > ¶meters) |
![]() | |
template<typename EventType > | |
void | postEvent (const EventType &ev) |
template<typename EventType > | |
void | postEvent () |
template<typename TOrthogonal , typename TSourceObject > | |
void | onOrthogonalAllocation () |
template<typename TComponent > | |
void | requiresComponent (TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist=false) |
template<typename TComponent > | |
void | requiresComponent (std::string name, TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist=false) |
template<typename TClient > | |
void | requiresClient (TClient *&requiredClientStorage) |
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs> | |
SmaccComponentType * | createSiblingComponent (TArgs... targs) |
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs> | |
SmaccComponentType * | createSiblingNamedComponent (std::string name, TArgs... targs) |
rclcpp::Node::SharedPtr | getNode () |
rclcpp::Logger | getLogger () const |
ISmaccStateMachine * | getStateMachine () |
Protected Attributes | |
rclcpp::Publisher< nav_msgs::msg::Path >::SharedPtr | robotBasePathPub_ |
rclcpp::Publisher< nav_msgs::msg::Path >::SharedPtr | robotBasePathStackedPub_ |
rclcpp::Subscription< nav_msgs::msg::Odometry >::SharedPtr | odomSub_ |
cl_nav2z::Pose * | robotPose_ |
rclcpp::TimerBase::SharedPtr | robotPoseTimer_ |
double | recordPointDistanceThreshold_ |
How much distance there is between two points of the path. | |
double | recordAngularDistanceThreshold_ |
Meters. | |
double | clearPointDistanceThreshold_ |
rads | |
double | clearAngularDistanceThreshold_ |
rads | |
std::string | odomFrame_ |
std::string | odomTopicName_ |
bool | publishMessages |
nav_msgs::msg::Path | baseTrajectory_ |
Processed path for the mouth of the reel. | |
WorkingMode | workingMode_ |
std::vector< nav_msgs::msg::Path > | pathStack_ |
std::vector< PathInfo > | pathInfos_ |
nav_msgs::msg::Path | aggregatedStackPathMsg_ |
OdomTrackerStrategy | strategy_ |
std::optional< geometry_msgs::msg::PoseStamped > | currentMotionGoal_ |
std::string | currentPathName_ |
rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr | param_callback_handle_ |
std::mutex | m_mutex_ |
![]() | |
ISmaccStateMachine * | stateMachine_ |
ISmaccClient * | owner_ |
This object tracks and saves the trajectories performed by the vehicle so that they can be used later to execute operations such as "undo motions"
Definition at line 60 of file cp_odom_tracker.hpp.
cl_nav2z::odom_tracker::CpOdomTracker::CpOdomTracker | ( | std::string | odomtopicName = "/odom", |
std::string | odomFrame = "odom", | ||
OdomTrackerStrategy | strategy = OdomTrackerStrategy::ODOMETRY_SUBSCRIBER ) |
Definition at line 34 of file cp_odom_tracker.cpp.
References odomFrame_, odomTopicName_, publishMessages, cl_nav2z::odom_tracker::RECORD_PATH, and workingMode_.
void cl_nav2z::odom_tracker::CpOdomTracker::clearPath | ( | ) |
Definition at line 338 of file cp_odom_tracker.cpp.
References baseTrajectory_, currentMotionGoal_, smacc2::ISmaccComponent::getLogger(), smacc2::ISmaccComponent::getNode(), logStateString(), m_mutex_, rtPublishPaths(), and updateAggregatedStackPath().
Referenced by cl_nav2z::CbNavigateBackwards::onEntry().
std::optional< geometry_msgs::msg::PoseStamped > cl_nav2z::odom_tracker::CpOdomTracker::getCurrentMotionGoal | ( | ) |
Definition at line 398 of file cp_odom_tracker.cpp.
References currentMotionGoal_, and m_mutex_.
Referenced by cl_nav2z::CbRetry< TCbRelativeMotion >::onEntry().
nav_msgs::msg::Path cl_nav2z::odom_tracker::CpOdomTracker::getPath | ( | ) |
Definition at line 404 of file cp_odom_tracker.cpp.
References baseTrajectory_, and m_mutex_.
Referenced by cl_nav2z::CbUndoPathBackwards::onEntry().
void cl_nav2z::odom_tracker::CpOdomTracker::logStateString | ( | bool | debug = true | ) |
Definition at line 296 of file cp_odom_tracker.cpp.
References baseTrajectory_, currentPathName_, smacc2::ISmaccComponent::getLogger(), odomSub_, pathInfos_, and pathStack_.
Referenced by clearPath(), cl_nav2z::CbUndoPathBackwards::onEntry(), cl_nav2z::CbUndoPathBackwards::onExit(), popPath(), and pushPath().
|
virtual |
Definition at line 617 of file cp_odom_tracker.cpp.
References processNewPose().
Referenced by onInitialize().
|
overrideprotectedvirtual |
Reimplemented from smacc2::ISmaccComponent.
Definition at line 60 of file cp_odom_tracker.cpp.
References clearAngularDistanceThreshold_, clearPointDistanceThreshold_, smacc2::ISmaccComponent::getLogger(), smacc2::ISmaccComponent::getNode(), cl_nav2z::odom_tracker::ODOMETRY_SUBSCRIBER, odomFrame_, odomMessageCallback(), odomSub_, odomTopicName_, param_callback_handle_, cl_nav2z::odom_tracker::parameterDeclareAndtryGetOrSet(), parametersCallback(), cl_nav2z::odom_tracker::POSE_COMPONENT, recordAngularDistanceThreshold_, recordPointDistanceThreshold_, smacc2::ISmaccComponent::requiresComponent(), robotBasePathPub_, robotBasePathStackedPub_, robotPose_, robotPoseTimer_, strategy_, and update().
|
protected |
Definition at line 118 of file cp_odom_tracker.cpp.
References clearAngularDistanceThreshold_, clearPointDistanceThreshold_, smacc2::ISmaccComponent::getLogger(), m_mutex_, odomFrame_, recordAngularDistanceThreshold_, and recordPointDistanceThreshold_.
Referenced by onInitialize().
void cl_nav2z::odom_tracker::CpOdomTracker::popPath | ( | int | pathCount = 1, |
bool | keepPreviousPath = false ) |
Definition at line 251 of file cp_odom_tracker.cpp.
References baseTrajectory_, currentMotionGoal_, smacc2::ISmaccComponent::getLogger(), logStateString(), m_mutex_, odomSub_, pathInfos_, pathStack_, and updateAggregatedStackPath().
Referenced by CpOdomTrackerActionServer::execute(), and cl_nav2z::CbUndoPathBackwards::onExit().
|
virtual |
odom callback: Updates the path - this must be called periodically for each odometry message.
Definition at line 631 of file cp_odom_tracker.cpp.
References cl_nav2z::odom_tracker::CLEAR_PATH, smacc2::ISmaccComponent::getLogger(), smacc2::ISmaccComponent::getNode(), m_mutex_, publishMessages, cl_nav2z::odom_tracker::RECORD_PATH, rtPublishPaths(), updateClearPath(), updateConfiguration(), updateRecordPath(), and workingMode_.
Referenced by odomMessageCallback(), and update().
void cl_nav2z::odom_tracker::CpOdomTracker::pushPath | ( | ) |
Definition at line 213 of file cp_odom_tracker.cpp.
References pushPath().
Referenced by CpOdomTrackerActionServer::execute(), cl_nav2z::CbNavigateForward::onEntry(), and pushPath().
void cl_nav2z::odom_tracker::CpOdomTracker::pushPath | ( | std::string | pathname | ) |
Definition at line 215 of file cp_odom_tracker.cpp.
References baseTrajectory_, currentMotionGoal_, currentPathName_, smacc2::ISmaccComponent::getLogger(), logStateString(), m_mutex_, odomSub_, pathInfos_, pathStack_, and updateAggregatedStackPath().
|
protectedvirtual |
Definition at line 415 of file cp_odom_tracker.cpp.
References aggregatedStackPathMsg_, baseTrajectory_, robotBasePathPub_, and robotBasePathStackedPub_.
Referenced by clearPath(), and processNewPose().
void cl_nav2z::odom_tracker::CpOdomTracker::setCurrentMotionGoal | ( | const geometry_msgs::msg::PoseStamped & | pose | ) |
Definition at line 392 of file cp_odom_tracker.cpp.
References currentMotionGoal_, and m_mutex_.
Referenced by cl_nav2z::CbNavigateForward::onEntry().
void cl_nav2z::odom_tracker::CpOdomTracker::setCurrentPathName | ( | const std::string & | currentPathName | ) |
Definition at line 351 of file cp_odom_tracker.cpp.
References currentPathName_, and smacc2::ISmaccComponent::getLogger().
|
inline |
Definition at line 119 of file cp_odom_tracker.hpp.
References smacc2::ISmaccComponent::getNode(), and odomFrame_.
void cl_nav2z::odom_tracker::CpOdomTracker::setPublishMessages | ( | bool | value | ) |
Definition at line 204 of file cp_odom_tracker.cpp.
References m_mutex_, publishMessages, and updateAggregatedStackPath().
Referenced by CpOdomTrackerActionServer::execute().
void cl_nav2z::odom_tracker::CpOdomTracker::setStartPoint | ( | const geometry_msgs::msg::Pose & | pose | ) |
Definition at line 372 of file cp_odom_tracker.cpp.
References baseTrajectory_, smacc2::ISmaccComponent::getLogger(), smacc2::ISmaccComponent::getNode(), m_mutex_, odomFrame_, and updateAggregatedStackPath().
void cl_nav2z::odom_tracker::CpOdomTracker::setStartPoint | ( | const geometry_msgs::msg::PoseStamped & | pose | ) |
Definition at line 357 of file cp_odom_tracker.cpp.
References baseTrajectory_, smacc2::ISmaccComponent::getLogger(), m_mutex_, and updateAggregatedStackPath().
Referenced by cl_nav2z::CbNavigateBackwards::onEntry(), and cl_nav2z::CbNavigateForward::onEntry().
void cl_nav2z::odom_tracker::CpOdomTracker::setWorkingMode | ( | WorkingMode | workingMode | ) |
Definition at line 159 of file cp_odom_tracker.cpp.
References cl_nav2z::odom_tracker::CLEAR_PATH, clearAngularDistanceThreshold_, clearPointDistanceThreshold_, smacc2::ISmaccComponent::getLogger(), cl_nav2z::odom_tracker::IDLE, m_mutex_, odomSub_, cl_nav2z::odom_tracker::RECORD_PATH, recordAngularDistanceThreshold_, recordPointDistanceThreshold_, and workingMode_.
Referenced by CpOdomTrackerActionServer::execute(), cl_nav2z::CbNavigateBackwards::onEntry(), cl_nav2z::CbNavigateForward::onEntry(), cl_nav2z::CbUndoPathBackwards::onEntry(), cl_nav2z::CbNavigateBackwards::onExit(), and cl_nav2z::CbNavigateForward::onExit().
|
virtual |
Definition at line 603 of file cp_odom_tracker.cpp.
References smacc2::ISmaccComponent::getLogger(), processNewPose(), robotPose_, and cl_nav2z::Pose::toPoseStampedMsg().
Referenced by onInitialize().
|
protected |
Definition at line 424 of file cp_odom_tracker.cpp.
References aggregatedStackPathMsg_, odomFrame_, and pathStack_.
Referenced by clearPath(), popPath(), pushPath(), setPublishMessages(), setStartPoint(), and setStartPoint().
|
protectedvirtual |
updateBackward()
Track robot base pose
Not removing point because it is enough far from the last cord point
Definition at line 441 of file cp_odom_tracker.cpp.
References baseTrajectory_, clearAngularDistanceThreshold_, clearPointDistanceThreshold_, smacc2::ISmaccComponent::getLogger(), and cl_nav2z::odom_tracker::p2pDistance().
Referenced by processNewPose().
|
protected |
reconfigCB()
Definition at line 572 of file cp_odom_tracker.cpp.
References clearAngularDistanceThreshold_, clearPointDistanceThreshold_, smacc2::ISmaccComponent::getNode(), odomFrame_, recordAngularDistanceThreshold_, and recordPointDistanceThreshold_.
Referenced by processNewPose().
void cl_nav2z::odom_tracker::CpOdomTracker::updateParameters | ( | ) |
|
protectedvirtual |
Track robot base pose
Definition at line 517 of file cp_odom_tracker.cpp.
References baseTrajectory_, smacc2::ISmaccComponent::getLogger(), smacc2::ISmaccComponent::getNode(), cl_nav2z::odom_tracker::p2pDistance(), recordAngularDistanceThreshold_, and recordPointDistanceThreshold_.
Referenced by processNewPose().
|
protected |
Definition at line 188 of file cp_odom_tracker.hpp.
Referenced by rtPublishPaths(), and updateAggregatedStackPath().
|
protected |
Processed path for the mouth of the reel.
Definition at line 174 of file cp_odom_tracker.hpp.
Referenced by clearPath(), getPath(), logStateString(), popPath(), pushPath(), rtPublishPaths(), setStartPoint(), setStartPoint(), updateClearPath(), and updateRecordPath().
|
protected |
rads
Definition at line 163 of file cp_odom_tracker.hpp.
Referenced by onInitialize(), parametersCallback(), setWorkingMode(), updateClearPath(), and updateConfiguration().
|
protected |
rads
Definition at line 160 of file cp_odom_tracker.hpp.
Referenced by onInitialize(), parametersCallback(), setWorkingMode(), updateClearPath(), and updateConfiguration().
|
protected |
Definition at line 192 of file cp_odom_tracker.hpp.
Referenced by clearPath(), getCurrentMotionGoal(), popPath(), pushPath(), and setCurrentMotionGoal().
|
protected |
Definition at line 193 of file cp_odom_tracker.hpp.
Referenced by logStateString(), pushPath(), and setCurrentPathName().
|
protected |
Definition at line 200 of file cp_odom_tracker.hpp.
Referenced by clearPath(), getCurrentMotionGoal(), getPath(), parametersCallback(), popPath(), processNewPose(), pushPath(), setCurrentMotionGoal(), setPublishMessages(), setStartPoint(), setStartPoint(), and setWorkingMode().
|
protected |
Definition at line 165 of file cp_odom_tracker.hpp.
Referenced by CpOdomTracker(), onInitialize(), parametersCallback(), setOdomFrame(), setStartPoint(), updateAggregatedStackPath(), and updateConfiguration().
|
protected |
Definition at line 147 of file cp_odom_tracker.hpp.
Referenced by logStateString(), onInitialize(), popPath(), pushPath(), and setWorkingMode().
|
protected |
Definition at line 167 of file cp_odom_tracker.hpp.
Referenced by CpOdomTracker(), and onInitialize().
|
protected |
Definition at line 198 of file cp_odom_tracker.hpp.
Referenced by onInitialize().
|
protected |
Definition at line 186 of file cp_odom_tracker.hpp.
Referenced by logStateString(), popPath(), and pushPath().
|
protected |
Definition at line 178 of file cp_odom_tracker.hpp.
Referenced by logStateString(), popPath(), pushPath(), and updateAggregatedStackPath().
|
protected |
Definition at line 171 of file cp_odom_tracker.hpp.
Referenced by CpOdomTracker(), processNewPose(), and setPublishMessages().
|
protected |
Meters.
Definition at line 157 of file cp_odom_tracker.hpp.
Referenced by onInitialize(), parametersCallback(), setWorkingMode(), updateConfiguration(), and updateRecordPath().
|
protected |
How much distance there is between two points of the path.
Definition at line 154 of file cp_odom_tracker.hpp.
Referenced by onInitialize(), parametersCallback(), setWorkingMode(), updateConfiguration(), and updateRecordPath().
|
protected |
Definition at line 141 of file cp_odom_tracker.hpp.
Referenced by onInitialize(), and rtPublishPaths().
|
protected |
Definition at line 142 of file cp_odom_tracker.hpp.
Referenced by onInitialize(), and rtPublishPaths().
|
protected |
Definition at line 149 of file cp_odom_tracker.hpp.
Referenced by onInitialize(), and update().
|
protected |
Definition at line 150 of file cp_odom_tracker.hpp.
Referenced by onInitialize().
|
protected |
Definition at line 190 of file cp_odom_tracker.hpp.
Referenced by onInitialize().
|
protected |
Definition at line 176 of file cp_odom_tracker.hpp.
Referenced by CpOdomTracker(), processNewPose(), and setWorkingMode().