YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Navigation2D_nwc_yarp_iNav2DTarget.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
32
34{
35 std::lock_guard <std::mutex> lg(m_mutex);
37}
38
40{
41 std::lock_guard <std::mutex> lg(m_mutex);
43}
44
46{
47 std::lock_guard <std::mutex> lg(m_mutex);
49 if (!ret.ret)
50 {
51 yCError(NAVIGATION2D_NWC_YARP, "Unable to get_absolute_location_of_current_target_RPC");
52 return ret.ret;
53 }
54 loc = ret.loc;
55 return ret.ret;
56}
57
59{
60 std::lock_guard <std::mutex> lg(m_mutex);
62 if (!ret.ret)
63 {
64 yCError(NAVIGATION2D_NWC_YARP, "Unable to get_relative_location_of_current_target_RPC");
65 return ret.ret;
66 }
67 x = ret.x;
68 y = ret.y;
69 theta = ret.theta;
70 return ret.ret;
71}
72
bool ret
virtual yarp::dev::ReturnValue goto_target_by_absolute_location_RPC(const yarp::dev::Nav2D::Map2DLocation &loc)
virtual yarp::dev::ReturnValue goto_target_by_relative_location1_RPC(const double x, const double y)
virtual return_get_abs_loc_of_curr_target get_absolute_location_of_current_target_RPC()
virtual yarp::dev::ReturnValue follow_path_RPC(const yarp::dev::Nav2D::Map2DPath &path)
virtual return_get_rel_loc_of_curr_target get_relative_location_of_current_target_RPC()
virtual yarp::dev::ReturnValue goto_target_by_relative_location2_RPC(const double x, const double y, const double theta)
yarp::dev::ReturnValue gotoTargetByAbsoluteLocation(yarp::dev::Nav2D::Map2DLocation loc) override
Ask the robot to reach a position defined in the world reference frame.
yarp::dev::ReturnValue followPath(const yarp::dev::Nav2D::Map2DPath &locs) override
Ask the robot to navigate through a set of locations defined in the world reference frame.
yarp::dev::ReturnValue gotoTargetByRelativeLocation(double x, double y, double theta) override
Ask the robot to reach a position defined in the robot reference frame.
yarp::dev::ReturnValue getRelativeLocationOfCurrentTarget(double &x, double &y, double &theta) override
Gets the last navigation target in the robot reference frame.
yarp::dev::ReturnValue getAbsoluteLocationOfCurrentTarget(yarp::dev::Nav2D::Map2DLocation &loc) override
Gets the last navigation target in the world reference frame.
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.