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 
18 namespace yarp
19 {
20  namespace dev
21  {
22  class IAxisInfo;
23  class IAxisInfoRaw;
24 
26  {
30  };
31  }
32 }
33 
40 {
41 public:
45  virtual ~IAxisInfo() {}
46 
47  /* Get the name for a particular axis.
48  * @param axis joint number
49  * @param name the axis name
50  * @return true if everything goes fine, false otherwise.
51  */
52  virtual bool getAxisName(int axis, std::string& name) = 0;
53 
54  /* Get the joint type (e.g. revolute/prismatic) for a particular axis.
55  * @param axis joint number
56  * @param type the joint type
57  * @return true if everything goes fine, false otherwise.
58  */
59  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; }
60 };
61 
66 {
67 public:
71  virtual ~IAxisInfoRaw() {}
72 
73  /* Get the name for a particular axis.
74  * @param axis joint number
75  * @param name the axis name
76  * @return true if everything goes fine, false otherwise.
77  */
78  virtual bool getAxisNameRaw(int axis, std::string& name) = 0;
79 
80  /* Get the joint type (e.g. revolute/prismatic) for a particular axis.
81  * @param axis joint number
82  * @param type the joint type
83  * @return true if everything goes fine, false otherwise.
84  */
85  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; };
86 };
87 
88 // interface IAxisInfo
91 
92 #endif // YARP_DEV_IAXISINFO_H
constexpr yarp::conf::vocab32_t VOCAB_INFO_TYPE
Definition: IAxisInfo.h:90
constexpr yarp::conf::vocab32_t VOCAB_INFO_NAME
Definition: IAxisInfo.h:89
#define yFatal(...)
Definition: Log.h:290
Interface for getting information about specific axes, if available.
Definition: IAxisInfo.h:66
virtual bool getAxisNameRaw(int axis, std::string &name)=0
virtual ~IAxisInfoRaw()
Destructor.
Definition: IAxisInfo.h:71
virtual bool getJointTypeRaw(int axis, yarp::dev::JointTypeEnum &type)
Definition: IAxisInfo.h:85
Interface for getting information about specific axes, if available.
Definition: IAxisInfo.h:40
virtual bool getAxisName(int axis, std::string &name)=0
virtual bool getJointType(int axis, yarp::dev::JointTypeEnum &type)
Definition: IAxisInfo.h:59
virtual ~IAxisInfo()
Destructor.
Definition: IAxisInfo.h:45
std::int32_t vocab32_t
Definition: numeric.h:78
@ VOCAB_JOINTTYPE_REVOLUTE
Definition: IAxisInfo.h:27
@ VOCAB_JOINTTYPE_PRISMATIC
Definition: IAxisInfo.h:28
@ VOCAB_JOINTTYPE_UNKNOWN
Definition: IAxisInfo.h:29
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:28
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_dev_API
Definition: api.h:18