YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Navigation2D_nwc_yarp_iVelActs.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 {
22 YARP_LOG_COMPONENT(NAVIGATION2D_NWC_YARP, "yarp.device.navigation2D_nwc_yarp")
23}
24
25//------------------------------------------------------------------------------------------------------------------------------
26
27ReturnValue Navigation2D_nwc_yarp::getLastVelocityCommand(double& x_vel, double& y_vel, double& theta_vel)
28{
29 std::lock_guard <std::mutex> lg(m_mutex);
31 if (!ret.ret)
32 {
33 yCError(NAVIGATION2D_NWC_YARP, "Unable to get_last_velocity_command_RPC");
34 return ret.ret;
35 }
36 x_vel = ret.x_vel;
37 y_vel = ret.y_vel;
38 theta_vel = ret.theta_vel;
39 return ret.ret;
40}
41
42ReturnValue Navigation2D_nwc_yarp::applyVelocityCommand(double x_vel, double y_vel, double theta_vel, double timeout)
43{
44 std::lock_guard <std::mutex> lg(m_mutex);
45 return m_nav_RPC.apply_velocity_command_RPC(x_vel,y_vel,theta_vel, timeout);
46}
bool ret
virtual return_get_last_velocity_command get_last_velocity_command_RPC()
virtual yarp::dev::ReturnValue apply_velocity_command_RPC(const double x_vel, const double y_vel, const double theta_vel, const double timeout)
yarp::dev::ReturnValue getLastVelocityCommand(double &x_vel, double &y_vel, double &theta_vel) override
Returns the last applied velocity command.
yarp::dev::ReturnValue applyVelocityCommand(double x_vel, double y_vel, double theta_vel, double timeout=0.1) override
Apply a velocity command.
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.