YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
IJoypadController.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
7
8using namespace yarp::dev;
9
11
12ReturnValue IJoypadController::getAllAxes(std::vector<double>& values)
13{
14 size_t num_of_axes = 0;
15 ReturnValue ret = this->getAxisCount(num_of_axes);
16 if (!ret)
17 {
18 return ret;
19 }
20 for (size_t i = 0; i < num_of_axes; i++)
21 {
22 double value = 0.0;
23 ret = this->getAxis(i, value);
24 values.push_back(value);
25 }
26
27 return ReturnValue_ok;
28}
#define ReturnValue_ok
Definition ReturnValue.h:82
virtual yarp::dev::ReturnValue getAxisCount(size_t &axis_count)=0
Get number of axes.
virtual ~IJoypadController()
Destructor.
virtual yarp::dev::ReturnValue getAllAxes(std::vector< double > &values)
Get the values of all available joystick axes.
virtual yarp::dev::ReturnValue getAxis(size_t axis_id, double &value)=0
Get the value of an axis if present, return false otherwise.
For streams capable of holding different kinds of content, check what they actually have.