YARP
Yet Another Robot Platform
IAxisInfo.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef YARP_DEV_IAXISINFO_H
8#define YARP_DEV_IAXISINFO_H
9
10#include <string>
11
12#include <yarp/os/Log.h>
13#include <yarp/os/Vocab.h>
14#include <yarp/dev/api.h>
15
18namespace yarp::dev {
19class IAxisInfo;
20class IAxisInfoRaw;
21
23{
27};
28} // namespace yarp::dev
29
36{
37public:
41 virtual ~IAxisInfo() {}
42
43 /* Get the name for a particular axis.
44 * @param axis joint number
45 * @param name the axis name
46 * @return true if everything goes fine, false otherwise.
47 */
48 virtual bool getAxisName(int axis, std::string& name) = 0;
49
50 /* Get the joint type (e.g. revolute/prismatic) for a particular axis.
51 * @param axis joint number
52 * @param type the joint type
53 * @return true if everything goes fine, false otherwise.
54 */
55 virtual bool getJointType(int axis, yarp::dev::JointTypeEnum& type) { yFatal("getJointType() not implemented on your device, cannot proceed further. Please report the problem on yarp issue tracker"); return false; }
56};
57
62{
63public:
67 virtual ~IAxisInfoRaw() {}
68
69 /* Get the name for a particular axis.
70 * @param axis joint number
71 * @param name the axis name
72 * @return true if everything goes fine, false otherwise.
73 */
74 virtual bool getAxisNameRaw(int axis, std::string& name) = 0;
75
76 /* Get the joint type (e.g. revolute/prismatic) for a particular axis.
77 * @param axis joint number
78 * @param type the joint type
79 * @return true if everything goes fine, false otherwise.
80 */
81 virtual bool getJointTypeRaw(int axis, yarp::dev::JointTypeEnum& type) { yFatal("getJointType() not implemented on your device, cannot proceed further. Please report the problem on yarp issue tracker"); return false; };
82};
83
84// interface IAxisInfo
87
88#endif // YARP_DEV_IAXISINFO_H
constexpr yarp::conf::vocab32_t VOCAB_INFO_TYPE
Definition: IAxisInfo.h:86
constexpr yarp::conf::vocab32_t VOCAB_INFO_NAME
Definition: IAxisInfo.h:85
#define yFatal(...)
Definition: Log.h:377
Interface for getting information about specific axes, if available.
Definition: IAxisInfo.h:62
virtual bool getAxisNameRaw(int axis, std::string &name)=0
virtual ~IAxisInfoRaw()
Destructor.
Definition: IAxisInfo.h:67
virtual bool getJointTypeRaw(int axis, yarp::dev::JointTypeEnum &type)
Definition: IAxisInfo.h:81
Interface for getting information about specific axes, if available.
Definition: IAxisInfo.h:36
virtual bool getAxisName(int axis, std::string &name)=0
virtual bool getJointType(int axis, yarp::dev::JointTypeEnum &type)
Definition: IAxisInfo.h:55
virtual ~IAxisInfo()
Destructor.
Definition: IAxisInfo.h:41
std::int32_t vocab32_t
Definition: numeric.h:78
For streams capable of holding different kinds of content, check what they actually have.
@ VOCAB_JOINTTYPE_REVOLUTE
Definition: IAxisInfo.h:24
@ VOCAB_JOINTTYPE_PRISMATIC
Definition: IAxisInfo.h:25
@ VOCAB_JOINTTYPE_UNKNOWN
Definition: IAxisInfo.h:26
constexpr yarp::conf::vocab32_t createVocab32(char a, char b=0, char c=0, char d=0)
Create a vocab from chars.
Definition: Vocab.h:27
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_dev_API
Definition: api.h:18