YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Navigation2D_nwc_yarp_iNav2DCtrl.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
8#include <yarp/os/Log.h>
10#include <yarp/os/LogStream.h>
11#include <mutex>
12#include <cmath>
13
16using namespace yarp::dev;
17using namespace yarp::dev::Nav2D;
18using namespace yarp::os;
19using namespace yarp::sig;
20
21namespace {
22YARP_LOG_COMPONENT(NAVIGATION2D_NWC_YARP, "yarp.device.navigation2D_nwc_yarp")
23}
24
25//------------------------------------------------------------------------------------------------------------------------------
26
28{
29 std::lock_guard <std::mutex> lg(m_mutex);
31 if (!ret.ret)
32 {
33 yCError(NAVIGATION2D_NWC_YARP, "Unable to get_navigation_status_RPC");
34 return ret.ret;
35 }
37 return ret.ret;
38}
39
45
47{
48 std::lock_guard <std::mutex> lg(m_mutex);
49 return m_nav_RPC.suspend_navigation_RPC(time_s);
50}
51
53{
54 std::lock_guard <std::mutex> lg(m_mutex);
56}
57
59{
60 std::lock_guard <std::mutex> lg(m_mutex);
62}
63
65{
66 std::lock_guard <std::mutex> lg(m_mutex);
67 auto ret = m_nav_RPC.get_all_navigation_waypoints_RPC(trajectory_type);
68 if (!ret.ret)
69 {
70 yCError(NAVIGATION2D_NWC_YARP, "Unable to get_current_nav_waypoint_RPC");
71 return ret.ret;
72 }
73 waypoints = ret.waypoints;
74 return ret.ret;
75}
76
78{
79 std::lock_guard <std::mutex> lg(m_mutex);
81 if (!ret.ret)
82 {
83 yCError(NAVIGATION2D_NWC_YARP, "Unable to get_current_nav_waypoint_RPC");
84 return ret.ret;
85 }
86 curr_waypoint = ret.waypoint;
87 return ret.ret;
88}
89
91{
92 std::lock_guard <std::mutex> lg(m_mutex);
94 if (!ret.ret)
95 {
96 yCError(NAVIGATION2D_NWC_YARP, "Unable to get_current_nav_waypoint_RPC");
97 return ret.ret;
98 }
99 map = ret.mapgrid;
100 return ret.ret;
101}
bool ret
virtual yarp::dev::ReturnValue resume_navigation_RPC()
virtual return_get_current_nav_map get_current_navigation_map_RPC(const yarp::dev::Nav2D::NavigationMapTypeEnum map_type)
virtual return_get_navigation_status get_navigation_status_RPC()
virtual yarp::dev::ReturnValue suspend_navigation_RPC(const double time_s)
virtual return_get_current_nav_waypoint get_current_nav_waypoint_RPC()
virtual yarp::dev::ReturnValue stop_navigation_RPC()
virtual yarp::dev::ReturnValue recompute_current_navigation_path_RPC()
virtual return_get_all_nav_waypoints get_all_navigation_waypoints_RPC(const yarp::dev::Nav2D::TrajectoryTypeEnum trajectory_type)
yarp::dev::ReturnValue getCurrentNavigationWaypoint(yarp::dev::Nav2D::Map2DLocation &curr_waypoint) override
Returns the current waypoint pursued by the navigation algorithm.
yarp::dev::ReturnValue suspendNavigation(const double time_s) override
Ask to the robot to suspend the current navigation task for a defined amount of time.
yarp::dev::ReturnValue stopNavigation() override
Terminates the current navigation task.
yarp::dev::ReturnValue getNavigationStatus(yarp::dev::Nav2D::NavigationStatusEnum &status) override
Gets the current status of the navigation task.
yarp::dev::ReturnValue getAllNavigationWaypoints(yarp::dev::Nav2D::TrajectoryTypeEnum trajectory_type, yarp::dev::Nav2D::Map2DPath &waypoints) override
Returns the list of waypoints generated by the navigation algorithm.
yarp::dev::ReturnValue recomputeCurrentNavigationPath() override
Forces the navigation system to recompute the path from the current robot position to the current goa...
yarp::dev::ReturnValue getCurrentNavigationMap(yarp::dev::Nav2D::NavigationMapTypeEnum map_type, yarp::dev::Nav2D::MapGrid2D &map) override
Returns the current navigation map processed by the navigation algorithm.
yarp::dev::ReturnValue resumeNavigation() override
Resume a previously suspended navigation task.
A mini-server for performing network communication in the background.
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.