YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
MobileBaseVelocityControlServerImpl.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025-2025 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
7#include <yarp/os/LogStream.h>
9
12using namespace yarp::os;
13using namespace yarp::dev;
14using namespace yarp::dev::Nav2D;
15using namespace std;
16
17
18namespace {
19YARP_LOG_COMPONENT(MOBVEL_NWS_YARP, "yarp.device.MobileBaseVelocityControl_nws_yarp.IMobileBaseVelocityControlRPCd")
20}
21
22ReturnValue IMobileBaseVelocityControlRPCd::applyVelocityCommandRPC(const double x_vel, const double y_vel, const double theta_vel, const double timeout)
23{
24 std::lock_guard <std::mutex> lg(m_mutex);
25
26 auto ret =m_iNavVel->applyVelocityCommand(x_vel, y_vel, theta_vel, timeout);
27
28 if (!ret)
29 {
30 yCError(MOBVEL_NWS_YARP, "Unable to applyVelocityCommandRPC");
31 }
32 return ret;
33}
34
36{
38 std::lock_guard <std::mutex> lg(m_mutex);
39
40 double x_vel = 0;
41 double y_vel = 0;
42 double t_vel = 0;
43 retrievedFromRPC.ret = m_iNavVel->getLastVelocityCommand(x_vel, y_vel, t_vel);
44
45 if (!retrievedFromRPC.ret)
46 {
47 yCError(MOBVEL_NWS_YARP, "Unable to getLastVelocityCommandRPC");
48 }
49
50 retrievedFromRPC.x_vel = x_vel;
51 retrievedFromRPC.y_vel = y_vel;
52 retrievedFromRPC.theta_vel = t_vel;
53 return retrievedFromRPC;
54}
bool ret
yarp::dev::ReturnValue applyVelocityCommandRPC(const double x_vel, const double y_vel, const double theta_vel, const double timeout) override
return_getLastVelocityCommand getLastVelocityCommandRPC() override
virtual yarp::dev::ReturnValue getLastVelocityCommand(double &x_vel, double &y_vel, double &theta_vel)=0
Returns the last applied velocity command.
virtual yarp::dev::ReturnValue applyVelocityCommand(double x_vel, double y_vel, double theta_vel, double timeout=0.1)=0
Apply a velocity command.
A mini-server for performing network communication in the background.
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
STL namespace.
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.