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
39bool Navigation2D_nwc_yarp::gotoTargetByRelativeLocation(double x, double y, double theta)
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 false;
53 }
54 loc = ret.loc;
55 return true;
56}
57
58bool Navigation2D_nwc_yarp::getRelativeLocationOfCurrentTarget(double& x, double& y, double& theta)
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 false;
66 }
67 x = ret.x;
68 y = ret.y;
69 theta = ret.theta;
70 return true;
71}
bool ret
virtual bool goto_target_by_relative_location2_RPC(const double x, const double y, const double theta)
virtual return_get_abs_loc_of_curr_target get_absolute_location_of_current_target_RPC()
virtual bool goto_target_by_absolute_location_RPC(const yarp::dev::Nav2D::Map2DLocation &loc)
virtual return_get_rel_loc_of_curr_target get_relative_location_of_current_target_RPC()
virtual bool goto_target_by_relative_location1_RPC(const double x, const double y)
bool gotoTargetByRelativeLocation(double x, double y, double theta) override
Ask the robot to reach a position defined in the robot reference frame.
bool getAbsoluteLocationOfCurrentTarget(yarp::dev::Nav2D::Map2DLocation &loc) override
Gets the last navigation target in the world reference frame.
bool gotoTargetByAbsoluteLocation(yarp::dev::Nav2D::Map2DLocation loc) override
Ask the robot to reach a position defined in the world reference frame.
bool getRelativeLocationOfCurrentTarget(double &x, double &y, double &theta) override
Gets the last navigation target in the robot 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.