SMACC2
Loading...
Searching...
No Matches
cl_nav2z::CpWaypointNavigator Class Reference

#include <cp_waypoints_navigator.hpp>

Inheritance diagram for cl_nav2z::CpWaypointNavigator:
Inheritance graph
Collaboration diagram for cl_nav2z::CpWaypointNavigator:
Collaboration graph

Public Member Functions

 CpWaypointNavigator ()
 
void onInitialize () override
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
std::optional< std::shared_future< std::shared_ptr< rclcpp_action::ClientGoalHandle< nav2_msgs::action::NavigateToPose > > > > sendNextGoal (std::optional< NavigateNextWaypointOptions > options=std::nullopt)
 
void stopWaitingResult ()
 
 CpWaypointNavigator ()
 
void onInitialize () override
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
std::optional< std::shared_future< std::shared_ptr< rclcpp_action::ClientGoalHandle< nav2_msgs::action::NavigateToPose > > > > sendNextGoal (std::optional< NavigateNextWaypointOptions > options=std::nullopt, cl_nav2z::ClNav2Z::SmaccNavigateResultSignal::WeakPtr callback=cl_nav2z::ClNav2Z::SmaccNavigateResultSignal::WeakPtr())
 
void stopWaitingResult ()
 
- Public Member Functions inherited from cl_nav2z::CpWaypointNavigatorBase
 CpWaypointNavigatorBase ()
 
virtual ~CpWaypointNavigatorBase ()
 
void onInitialize () override
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
void loadWayPointsFromFile (std::string filepath)
 
void loadWayPointsFromFile2 (std::string filepath)
 
void setWaypoints (const std::vector< geometry_msgs::msg::Pose > &waypoints)
 
void setWaypoints (const std::vector< Pose2D > &waypoints)
 
const std::vector< geometry_msgs::msg::Pose > & getWaypoints () const
 
const std::vector< std::string > & getWaypointNames () const
 
std::optional< geometry_msgs::msg::Pose > getNamedPose (std::string name) const
 
geometry_msgs::msg::Pose getPose (int index) const
 
geometry_msgs::msg::Pose getCurrentPose () const
 
long getCurrentWaypointIndex () const
 
std::optional< std::string > getCurrentWaypointName () const
 
void rewind (int count)
 
void forward (int count)
 
void seekName (std::string name)
 
void loadWaypointsFromYamlParameter (std::string parameter_name, std::string yaml_file_package_name)
 
void notifyGoalReached ()
 
 CpWaypointNavigatorBase ()
 
virtual ~CpWaypointNavigatorBase ()
 
void onInitialize () override
 
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
void loadWayPointsFromFile (std::string filepath)
 
void loadWayPointsFromFile2 (std::string filepath)
 
void setWaypoints (const std::vector< geometry_msgs::msg::Pose > &waypoints)
 
void setWaypoints (const std::vector< Pose2D > &waypoints)
 
const std::vector< geometry_msgs::msg::Pose > & getWaypoints () const
 
const std::vector< std::string > & getWaypointNames () const
 
std::optional< geometry_msgs::msg::Pose > getNamedPose (std::string name) const
 
geometry_msgs::msg::Pose getPose (int index) const
 
geometry_msgs::msg::Pose getCurrentPose () const
 
long getCurrentWaypointIndex () const
 
std::optional< std::string > getCurrentWaypointName () const
 
void rewind (int count)
 
void forward (int count)
 
void seekName (std::string name)
 
void loadWaypointsFromYamlParameter (std::string parameter_name, std::string yaml_file_package_name)
 
void notifyGoalReached ()
 
- Public Member Functions inherited from smacc2::ISmaccComponent
 ISmaccComponent ()
 
virtual ~ISmaccComponent ()
 
virtual std::string getName () const
 

Public Attributes

ClNav2Zclient_
 
components::CpNav2ActionInterfacenav2ActionInterface_ = nullptr
 
smacc2::SmaccSignal< void()> onNavigationRequestSucceded
 
smacc2::SmaccSignal< void()> onNavigationRequestAborted
 
smacc2::SmaccSignal< void()> onNavigationRequestCancelled
 
- Public Attributes inherited from cl_nav2z::CpWaypointNavigatorBase
WaypointEventDispatcher waypointsEventDispatcher
 
long currentWaypoint_
 

Private Member Functions

void onNavigationResult (const components::CpNav2ActionInterface::WrappedResult &r)
 
void onGoalReached (const components::CpNav2ActionInterface::WrappedResult &res)
 
void onGoalCancelled (const components::CpNav2ActionInterface::WrappedResult &)
 
void onGoalAborted (const components::CpNav2ActionInterface::WrappedResult &)
 
void onNavigationResult (const ClNav2Z::WrappedResult &r)
 
void onGoalReached (const ClNav2Z::WrappedResult &res)
 
void onGoalCancelled (const ClNav2Z::WrappedResult &)
 
void onGoalAborted (const ClNav2Z::WrappedResult &)
 

Private Attributes

boost::signals2::connection succeddedNav2ZClientConnection_
 
boost::signals2::connection abortedNav2ZClientConnection_
 
boost::signals2::connection cancelledNav2ZClientConnection_
 

Additional Inherited Members

- Protected Member Functions inherited from cl_nav2z::CpWaypointNavigatorBase
void insertWaypoint (int index, geometry_msgs::msg::Pose &newpose)
 
void removeWaypoint (int index)
 
void insertWaypoint (int index, geometry_msgs::msg::Pose &newpose)
 
void removeWaypoint (int index)
 
- Protected Member Functions inherited from smacc2::ISmaccComponent
template<typename TOrthogonal , typename TClient >
void onComponentInitialization ()
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
template<typename TComponent >
void requiresComponent (TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist)
 
template<typename TComponent >
void requiresComponent (std::string name, TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist)
 
template<typename TComponent >
void requiresComponent (TComponent *&requiredComponentStorage, ComponentRequirement requirementType=ComponentRequirement::SOFT)
 
template<typename TComponent >
void requiresComponent (std::string name, TComponent *&requiredComponentStorage, ComponentRequirement requirementType=ComponentRequirement::SOFT)
 
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
 
ISmaccStateMachinegetStateMachine ()
 
- Protected Attributes inherited from cl_nav2z::CpWaypointNavigatorBase
std::vector< geometry_msgs::msg::Pose > waypoints_
 
std::vector< std::string > waypointsNames_
 
- Protected Attributes inherited from smacc2::ISmaccComponent
ISmaccStateMachinestateMachine_
 
ISmaccClientowner_
 

Detailed Description

Definition at line 46 of file cp_waypoints_navigator.hpp.

Constructor & Destructor Documentation

◆ CpWaypointNavigator() [1/2]

cl_nav2z::CpWaypointNavigator::CpWaypointNavigator ( )

Definition at line 44 of file cp_waypoints_navigator.cpp.

44{}

◆ CpWaypointNavigator() [2/2]

cl_nav2z::CpWaypointNavigator::CpWaypointNavigator ( )

Member Function Documentation

◆ onGoalAborted() [1/2]

void cl_nav2z::CpWaypointNavigator::onGoalAborted ( const ClNav2Z::WrappedResult & )
private

Definition at line 55 of file cp_waypoints_navigator.cpp.

◆ onGoalAborted() [2/2]

void cl_nav2z::CpWaypointNavigator::onGoalAborted ( const components::CpNav2ActionInterface::WrappedResult & )
private

Definition at line 61 of file cp_waypoints_navigator.cpp.

63{
65
67}

References onNavigationRequestAborted, and stopWaitingResult().

Referenced by onNavigationResult(), and sendNextGoal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onGoalCancelled() [1/2]

void cl_nav2z::CpWaypointNavigator::onGoalCancelled ( const ClNav2Z::WrappedResult & )
private

Definition at line 48 of file cp_waypoints_navigator.cpp.

49{
51
53}
smacc2::SmaccSignal< void()> onNavigationRequestCancelled

◆ onGoalCancelled() [2/2]

void cl_nav2z::CpWaypointNavigator::onGoalCancelled ( const components::CpNav2ActionInterface::WrappedResult & )
private

Definition at line 53 of file cp_waypoints_navigator.cpp.

55{
57
59}

References onNavigationRequestCancelled, and stopWaitingResult().

Referenced by onNavigationResult(), and sendNextGoal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onGoalReached() [1/2]

void cl_nav2z::CpWaypointNavigator::onGoalReached ( const ClNav2Z::WrappedResult & res)
private

Definition at line 62 of file cp_waypoints_navigator.cpp.

63{
66 RCLCPP_WARN(
67 getLogger(), "[CpWaypointNavigator] Goal result received, incrementing waypoint index: %ld",
70
71 this->notifyGoalReached();
72
74}
smacc2::SmaccSignal< void()> onNavigationRequestSucceded
rclcpp::Logger getLogger() const

◆ onGoalReached() [2/2]

void cl_nav2z::CpWaypointNavigator::onGoalReached ( const components::CpNav2ActionInterface::WrappedResult & res)
private

◆ onInitialize() [1/2]

void cl_nav2z::CpWaypointNavigator::onInitialize ( )
overridevirtual

Reimplemented from smacc2::ISmaccComponent.

Definition at line 48 of file cp_waypoints_navigator.cpp.

49{
50 this->requiresComponent(nav2ActionInterface_, ComponentRequirement::HARD);
51}
components::CpNav2ActionInterface * nav2ActionInterface_
void requiresComponent(TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist)

References nav2ActionInterface_, and smacc2::ISmaccComponent::requiresComponent().

Here is the call graph for this function:

◆ onInitialize() [2/2]

void cl_nav2z::CpWaypointNavigator::onInitialize ( )
overridevirtual

Reimplemented from smacc2::ISmaccComponent.

◆ onNavigationResult() [1/2]

void cl_nav2z::CpWaypointNavigator::onNavigationResult ( const ClNav2Z::WrappedResult & r)
private

Definition at line 308 of file cp_waypoints_navigator.cpp.

309{
310 if (r.code == rclcpp_action::ResultCode::SUCCEEDED)
311 {
312 this->onGoalReached(r);
313 }
314 else if (r.code == rclcpp_action::ResultCode::ABORTED)
315 {
316 this->onGoalAborted(r);
317 }
318 else if (r.code == rclcpp_action::ResultCode::CANCELED)
319 {
320 this->onGoalCancelled(r);
321 }
322 else
323 {
324 this->onGoalAborted(r);
325 }
326}
void onGoalReached(const components::CpNav2ActionInterface::WrappedResult &res)
void onGoalAborted(const components::CpNav2ActionInterface::WrappedResult &)
void onGoalCancelled(const components::CpNav2ActionInterface::WrappedResult &)

◆ onNavigationResult() [2/2]

void cl_nav2z::CpWaypointNavigator::onNavigationResult ( const components::CpNav2ActionInterface::WrappedResult & r)
private

Definition at line 329 of file cp_waypoints_navigator.cpp.

331{
332 if (r.code == rclcpp_action::ResultCode::SUCCEEDED)
333 {
334 this->onGoalReached(r);
335 }
336 else if (r.code == rclcpp_action::ResultCode::ABORTED)
337 {
338 this->onGoalAborted(r);
339 }
340 else if (r.code == rclcpp_action::ResultCode::CANCELED)
341 {
342 this->onGoalCancelled(r);
343 }
344 else
345 {
346 this->onGoalAborted(r);
347 }
348}

References onGoalAborted(), onGoalCancelled(), and onGoalReached().

Here is the call graph for this function:

◆ onStateOrthogonalAllocation() [1/2]

template<typename TOrthogonal , typename TSourceObject >
void cl_nav2z::CpWaypointNavigator::onStateOrthogonalAllocation ( )
inline

Definition at line 59 of file cp_waypoints_navigator.hpp.

60 {
61 client_ = dynamic_cast<ClNav2Z *>(owner_);
62 waypointsEventDispatcher.initialize<TSourceObject, TOrthogonal>(client_);
63 this->requiresComponent(nav2ActionInterface_, ComponentRequirement::HARD);
64 }
namespace cl_nav2z class ClNav2Z
ISmaccClient * owner_

References client_, WaypointEventDispatcher::initialize(), smacc2::ISmaccComponent::owner_, smacc2::ISmaccComponent::requiresComponent(), and cl_nav2z::CpWaypointNavigatorBase::waypointsEventDispatcher.

Here is the call graph for this function:

◆ onStateOrthogonalAllocation() [2/2]

template<typename TOrthogonal , typename TSourceObject >
void cl_nav2z::CpWaypointNavigator::onStateOrthogonalAllocation ( )
inline

Definition at line 56 of file cp_waypoints_navigator.hpp.

57 {
58 waypointsEventDispatcher.initialize<TSourceObject, TOrthogonal>(client_);
59 }

References client_, WaypointEventDispatcher::initialize(), and cl_nav2z::CpWaypointNavigatorBase::waypointsEventDispatcher.

Here is the call graph for this function:

◆ sendNextGoal() [1/2]

std::optional< std::shared_future< std::shared_ptr< rclcpp_action::ClientGoalHandle< nav2_msgs::action::NavigateToPose > > > > cl_nav2z::CpWaypointNavigator::sendNextGoal ( std::optional< NavigateNextWaypointOptions > options = std::nullopt)

Definition at line 200 of file cp_waypoints_navigator.cpp.

201{
202 if (currentWaypoint_ >= 0 && currentWaypoint_ < (int)waypoints_.size())
203 {
204 auto & next = waypoints_[currentWaypoint_];
205
206 std::string nextName;
207 if ((long)waypointsNames_.size() > currentWaypoint_)
208 {
210 RCLCPP_INFO(
211 getLogger(), "[CpWaypointNavigator] sending goal, waypoint: %s", nextName.c_str());
212 }
213 else
214 {
215 RCLCPP_INFO(
216 getLogger(), "[CpWaypointNavigator] sending goal, waypoint: %ld", currentWaypoint_);
217 }
218
219 nav2_msgs::action::NavigateToPose::Goal goal;
220 CpPose * p;
221 this->requiresComponent(p, ComponentRequirement::HARD);
222 auto pose = p->toPoseMsg();
223
224 // configuring goal
225 goal.pose.header.frame_id = p->getReferenceFrame();
226 //goal.pose.header.stamp = getNode()->now();
227 goal.pose.pose = next;
228
229 cl_nav2z::CpPlannerSwitcher * plannerSwitcher;
230 this->requiresComponent(plannerSwitcher, ComponentRequirement::HARD);
231
232 plannerSwitcher->setDefaultPlanners(false);
233 if (options && options->controllerName_)
234 {
235 RCLCPP_WARN(
236 getLogger(), "[WaypointsNavigator] override controller: %s",
237 options->controllerName_->c_str());
238
239 plannerSwitcher->setDesiredController(*options->controllerName_);
240 }
241 else
242 {
243 RCLCPP_WARN(getLogger(), "[WaypointsNavigator] Configuring default planners");
244 }
245
246 cl_nav2z::CpGoalCheckerSwitcher * goalCheckerSwitcher;
247 // this->requiresComponent(goalCheckerSwitcher, ComponentRequirement::HARD);
248 this->requiresComponent(goalCheckerSwitcher, ComponentRequirement::SOFT);
249
250 if (options && options->goalCheckerName_)
251 {
252 RCLCPP_WARN(
253 getLogger(), "[WaypointsNavigator] override goal checker: %s",
254 options->goalCheckerName_->c_str());
255
256 goalCheckerSwitcher->setGoalCheckerId(*options->goalCheckerName_);
257 }
258 else
259 {
260 RCLCPP_WARN(getLogger(), "[WaypointsNavigator] Configuring default goal checker");
261 goalCheckerSwitcher->setGoalCheckerId("goal_checker");
262 }
263
264 plannerSwitcher->commitPublish();
265
266 // publish stuff
267 // rclcpp::sleep_for(5s);
268
269 RCLCPP_INFO(getLogger(), "[WaypointsNavigator] Getting odom tracker");
270
272 requiresComponent(odomTracker, ComponentRequirement::SOFT);
273
274 if (odomTracker != nullptr)
275 {
276 RCLCPP_INFO(getLogger(), "[WaypointsNavigator] Storing path in odom tracker");
277
278 auto pathname = this->owner_->getStateMachine()->getCurrentState()->getName() + " - " +
279 getName() + " - " + nextName;
280 odomTracker->pushPath(pathname);
281 odomTracker->setStartPoint(pose);
283 }
284
285 // SEND GOAL
286 // if (!succeddedNav2ZClientConnection_.connected())
287 // {
288 // this->succeddedNav2ZClientConnection_ =
289 // client_->onSucceeded(&WaypointNavigator::onGoalReached, this);
290 // this->cancelledNav2ZClientConnection_ =
291 // client_->onAborted(&WaypointNavigator::onGoalCancelled, this);
292 // this->abortedNav2ZClientConnection_ =
293 // client_->onCancelled(&WaypointNavigator::onGoalAborted, this);
294 // }
295
296 // Set up navigation result handling
297 if (!succeddedNav2ZClientConnection_.connected())
298 {
305 }
306
307 return nav2ActionInterface_->sendGoal(goal);
308 }
309 else
310 {
311 RCLCPP_WARN(
312 getLogger(),
313 "[CpWaypointsNavigator] All waypoints were consumed. There is no more waypoints available.");
314 }
315
316 return std::nullopt;
317}
void setGoalCheckerId(std::string goal_checker_id)
void setDefaultPlanners(bool commit=true)
std::vector< geometry_msgs::msg::Pose > waypoints_
boost::signals2::connection succeddedNav2ZClientConnection_
boost::signals2::connection abortedNav2ZClientConnection_
boost::signals2::connection cancelledNav2ZClientConnection_
boost::signals2::connection onNavigationCancelled(void(T::*callback)(const WrappedResult &), T *object)
boost::signals2::connection onNavigationSucceeded(void(T::*callback)(const WrappedResult &), T *object)
std::shared_future< typename GoalHandle::SharedPtr > sendGoal(Goal &goal)
boost::signals2::connection onNavigationAborted(void(T::*callback)(const WrappedResult &), T *object)
void setWorkingMode(WorkingMode workingMode)
void setStartPoint(const geometry_msgs::msg::PoseStamped &pose)
ISmaccStateMachine * getStateMachine()
virtual std::string getName() const
virtual std::string getName()=0

References abortedNav2ZClientConnection_, cancelledNav2ZClientConnection_, cl_nav2z::CpPlannerSwitcher::commitPublish(), cl_nav2z::CpWaypointNavigatorBase::currentWaypoint_, smacc2::ISmaccStateMachine::getCurrentState(), smacc2::ISmaccComponent::getLogger(), smacc2::ISmaccComponent::getName(), smacc2::ISmaccState::getName(), cl_nav2z::CpPose::getReferenceFrame(), smacc2::ISmaccClient::getStateMachine(), nav2ActionInterface_, onGoalAborted(), onGoalCancelled(), onGoalReached(), cl_nav2z::components::CpNav2ActionInterface::onNavigationAborted(), cl_nav2z::components::CpNav2ActionInterface::onNavigationCancelled(), cl_nav2z::components::CpNav2ActionInterface::onNavigationSucceeded(), smacc2::ISmaccComponent::owner_, cl_nav2z::odom_tracker::CpOdomTracker::pushPath(), cl_nav2z::odom_tracker::RECORD_PATH, smacc2::ISmaccComponent::requiresComponent(), cl_nav2z::components::CpNav2ActionInterface::sendGoal(), cl_nav2z::CpPlannerSwitcher::setDefaultPlanners(), cl_nav2z::CpPlannerSwitcher::setDesiredController(), cl_nav2z::CpGoalCheckerSwitcher::setGoalCheckerId(), cl_nav2z::odom_tracker::CpOdomTracker::setStartPoint(), cl_nav2z::odom_tracker::CpOdomTracker::setWorkingMode(), succeddedNav2ZClientConnection_, cl_nav2z::CpPose::toPoseMsg(), cl_nav2z::CpWaypointNavigatorBase::waypoints_, and cl_nav2z::CpWaypointNavigatorBase::waypointsNames_.

Referenced by cl_nav2z::CbNavigateNextWaypoint::onEntry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendNextGoal() [2/2]

std::optional< std::shared_future< std::shared_ptr< rclcpp_action::ClientGoalHandle< nav2_msgs::action::NavigateToPose > > > > cl_nav2z::CpWaypointNavigator::sendNextGoal ( std::optional< NavigateNextWaypointOptions > options = std::nullopt,
cl_nav2z::ClNav2Z::SmaccNavigateResultSignal::WeakPtr callback = cl_nav2z::ClNav2Z::SmaccNavigateResultSignal::WeakPtr() )

Definition at line 192 of file cp_waypoints_navigator.cpp.

195{
196 if (currentWaypoint_ >= 0 && currentWaypoint_ < (int)waypoints_.size())
197 {
198 auto & next = waypoints_[currentWaypoint_];
199
200 std::string nextName;
201 if ((long)waypointsNames_.size() > currentWaypoint_)
202 {
204 RCLCPP_INFO(
205 getLogger(), "[CpWaypointNavigator] sending goal, waypoint: %s", nextName.c_str());
206 }
207 else
208 {
209 RCLCPP_INFO(
210 getLogger(), "[CpWaypointNavigator] sending goal, waypoint: %ld", currentWaypoint_);
211 }
212
213 ClNav2Z::Goal goal;
215 auto pose = p->toPoseMsg();
216
217 // configuring goal
218 goal.pose.header.frame_id = p->getReferenceFrame();
219 //goal.pose.header.stamp = getNode()->now();
220 goal.pose.pose = next;
221
222 auto plannerSwitcher = client_->getComponent<CpPlannerSwitcher>();
223 plannerSwitcher->setDefaultPlanners(false);
224 if (options && options->controllerName_)
225 {
226 RCLCPP_WARN(
227 getLogger(), "[WaypointsNavigator] override controller: %s",
228 options->controllerName_->c_str());
229
230 plannerSwitcher->setDesiredController(*options->controllerName_);
231 }
232 else
233 {
234 RCLCPP_WARN(getLogger(), "[WaypointsNavigator] Configuring default planners");
235 }
236
237 auto goalCheckerSwitcher = client_->getComponent<CpGoalCheckerSwitcher>();
238
239 if (options && options->goalCheckerName_)
240 {
241 RCLCPP_WARN(
242 getLogger(), "[WaypointsNavigator] override goal checker: %s",
243 options->goalCheckerName_->c_str());
244
245 goalCheckerSwitcher->setGoalCheckerId(*options->goalCheckerName_);
246 }
247 else
248 {
249 RCLCPP_WARN(getLogger(), "[WaypointsNavigator] Configuring default goal checker");
250 goalCheckerSwitcher->setGoalCheckerId("goal_checker");
251 }
252
253 plannerSwitcher->commitPublish();
254
255 // publish stuff
256 // rclcpp::sleep_for(5s);
257
258 RCLCPP_INFO(getLogger(), "[WaypointsNavigator] Getting odom tracker");
260 if (odomTracker != nullptr)
261 {
262 RCLCPP_INFO(getLogger(), "[WaypointsNavigator] Storing path in odom tracker");
263
264 auto pathname = this->owner_->getStateMachine()->getCurrentState()->getName() + " - " +
265 getName() + " - " + nextName;
266 odomTracker->pushPath(pathname);
267 odomTracker->setStartPoint(pose);
268 odomTracker->setWorkingMode(cl_nav2z::odom_tracker::WorkingMode::RECORD_PATH);
269 }
270
271 // SEND GOAL
272 // if (!succeddedNav2ZClientConnection_.connected())
273 // {
274 // this->succeddedNav2ZClientConnection_ =
275 // client_->onSucceeded(&WaypointNavigator::onGoalReached, this);
276 // this->cancelledNav2ZClientConnection_ =
277 // client_->onAborted(&WaypointNavigator::onGoalCancelled, this);
278 // this->abortedNav2ZClientConnection_ =
279 // client_->onCancelled(&WaypointNavigator::onGoalAborted, this);
280 // }
281
282 auto callbackptr = resultCallback.lock();
284 *callbackptr, &CpWaypointNavigator::onNavigationResult, this);
285
286 return client_->sendGoal(goal, resultCallback);
287 }
288 else
289 {
290 RCLCPP_WARN(
291 getLogger(),
292 "[CpWaypointsNavigator] All waypoints were consumed. There is no more waypoints available.");
293 }
294
295 return std::nullopt;
296}
void onNavigationResult(const components::CpNav2ActionInterface::WrappedResult &r)
geometry_msgs::msg::Pose toPoseMsg()
Definition cp_pose.hpp:57
ISmaccStateMachine * getStateMachine()
boost::signals2::connection createSignalConnection(TSmaccSignal &signal, TMemberFunctionPrototype callback, TSmaccObjectType *object)
std::shared_future< typename GoalHandle::SharedPtr > sendGoal(Goal &goal, typename SmaccActionResultSignal::WeakPtr resultCallback=typename SmaccActionResultSignal::WeakPtr())

References cl_nav2z::odom_tracker::RECORD_PATH, cl_nav2z::CpPlannerSwitcher::setDefaultPlanners(), and cl_nav2z::Pose::toPoseMsg().

Here is the call graph for this function:

◆ stopWaitingResult() [1/2]

void cl_nav2z::CpWaypointNavigator::stopWaitingResult ( )

Definition at line 188 of file cp_waypoints_navigator.cpp.

189{
190 if (succeddedNav2ZClientConnection_.connected())
191 {
192 this->succeddedNav2ZClientConnection_.disconnect();
193 this->cancelledNav2ZClientConnection_.disconnect();
194 this->abortedNav2ZClientConnection_.disconnect();
195 }
196}

References abortedNav2ZClientConnection_, cancelledNav2ZClientConnection_, and succeddedNav2ZClientConnection_.

Referenced by cl_nav2z::CbNavigateNextWaypoint::onExit(), onGoalAborted(), onGoalCancelled(), and onGoalReached().

Here is the caller graph for this function:

◆ stopWaitingResult() [2/2]

void cl_nav2z::CpWaypointNavigator::stopWaitingResult ( )

Member Data Documentation

◆ abortedNav2ZClientConnection_

boost::signals2::connection cl_nav2z::CpWaypointNavigator::abortedNav2ZClientConnection_
private

Definition at line 84 of file cp_waypoints_navigator.hpp.

Referenced by sendNextGoal(), and stopWaitingResult().

◆ cancelledNav2ZClientConnection_

boost::signals2::connection cl_nav2z::CpWaypointNavigator::cancelledNav2ZClientConnection_
private

Definition at line 85 of file cp_waypoints_navigator.hpp.

Referenced by sendNextGoal(), and stopWaitingResult().

◆ client_

ClNav2Z * cl_nav2z::CpWaypointNavigator::client_

Definition at line 51 of file cp_waypoints_navigator.hpp.

Referenced by onStateOrthogonalAllocation().

◆ nav2ActionInterface_

components::CpNav2ActionInterface* cl_nav2z::CpWaypointNavigator::nav2ActionInterface_ = nullptr

Definition at line 52 of file cp_waypoints_navigator.hpp.

Referenced by onInitialize(), and sendNextGoal().

◆ onNavigationRequestAborted

smacc2::SmaccSignal< void()> cl_nav2z::CpWaypointNavigator::onNavigationRequestAborted

Definition at line 73 of file cp_waypoints_navigator.hpp.

Referenced by onGoalAborted().

◆ onNavigationRequestCancelled

smacc2::SmaccSignal< void()> cl_nav2z::CpWaypointNavigator::onNavigationRequestCancelled

Definition at line 74 of file cp_waypoints_navigator.hpp.

Referenced by onGoalCancelled().

◆ onNavigationRequestSucceded

smacc2::SmaccSignal< void()> cl_nav2z::CpWaypointNavigator::onNavigationRequestSucceded

Definition at line 72 of file cp_waypoints_navigator.hpp.

Referenced by onGoalReached().

◆ succeddedNav2ZClientConnection_

boost::signals2::connection cl_nav2z::CpWaypointNavigator::succeddedNav2ZClientConnection_
private

Definition at line 83 of file cp_waypoints_navigator.hpp.

Referenced by sendNextGoal(), and stopWaitingResult().


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