YARP
Yet Another Robot Platform
IAxisInfo.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_DEV_IAXISINFO_H
11 #define YARP_DEV_IAXISINFO_H
12 
13 #include <string>
14 
15 #include <yarp/os/Log.h>
16 #include <yarp/os/Vocab.h>
17 #include <yarp/dev/api.h>
18 
21 namespace yarp
22 {
23  namespace dev
24  {
25  class IAxisInfo;
26  class IAxisInfoRaw;
27 
29  {
33  };
34  }
35 }
36 
43 {
44 public:
48  virtual ~IAxisInfo() {}
49 
50  /* Get the name for a particular axis.
51  * @param axis joint number
52  * @param name the axis name
53  * @return true if everything goes fine, false otherwise.
54  */
55  virtual bool getAxisName(int axis, std::string& name) = 0;
56 
57  /* Get the joint type (e.g. revolute/prismatic) for a particular axis.
58  * @param axis joint number
59  * @param type the joint type
60  * @return true if everything goes fine, false otherwise.
61  */
62  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; }
63 };
64 
69 {
70 public:
74  virtual ~IAxisInfoRaw() {}
75 
76  /* Get the name for a particular axis.
77  * @param axis joint number
78  * @param name the axis name
79  * @return true if everything goes fine, false otherwise.
80  */
81  virtual bool getAxisNameRaw(int axis, std::string& name) = 0;
82 
83  /* Get the joint type (e.g. revolute/prismatic) for a particular axis.
84  * @param axis joint number
85  * @param type the joint type
86  * @return true if everything goes fine, false otherwise.
87  */
88  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; };
89 };
90 
91 // interface IAxisInfo
94 
95 #endif // YARP_DEV_IAXISINFO_H
yarp::os::createVocab
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
Definition: Vocab.h:22
yFatal
#define yFatal(...)
Definition: Log.h:293
yarp::dev::VOCAB_JOINTTYPE_REVOLUTE
@ VOCAB_JOINTTYPE_REVOLUTE
Definition: IAxisInfo.h:30
yarp::dev::IAxisInfo::~IAxisInfo
virtual ~IAxisInfo()
Destructor.
Definition: IAxisInfo.h:48
Log.h
yarp::dev::VOCAB_JOINTTYPE_PRISMATIC
@ VOCAB_JOINTTYPE_PRISMATIC
Definition: IAxisInfo.h:31
yarp::dev::IAxisInfo
Interface for getting information about specific axes, if available.
Definition: IAxisInfo.h:43
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::dev::IAxisInfoRaw::getJointTypeRaw
virtual bool getJointTypeRaw(int axis, yarp::dev::JointTypeEnum &type)
Definition: IAxisInfo.h:88
yarp::dev::IAxisInfo::getJointType
virtual bool getJointType(int axis, yarp::dev::JointTypeEnum &type)
Definition: IAxisInfo.h:62
VOCAB_INFO_NAME
constexpr yarp::conf::vocab32_t VOCAB_INFO_NAME
Definition: IAxisInfo.h:92
yarp::dev::IAxisInfoRaw
Interface for getting information about specific axes, if available.
Definition: IAxisInfo.h:69
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::conf::vocab32_t
std::int32_t vocab32_t
Definition: numeric.h:52
Vocab.h
VOCAB_INFO_TYPE
constexpr yarp::conf::vocab32_t VOCAB_INFO_TYPE
Definition: IAxisInfo.h:93
yarp::dev::IAxisInfoRaw::getAxisNameRaw
virtual bool getAxisNameRaw(int axis, std::string &name)=0
yarp::dev::IAxisInfo::getAxisName
virtual bool getAxisName(int axis, std::string &name)=0
api.h
yarp::dev::VOCAB_JOINTTYPE_UNKNOWN
@ VOCAB_JOINTTYPE_UNKNOWN
Definition: IAxisInfo.h:32
yarp::dev::JointTypeEnum
JointTypeEnum
Definition: IAxisInfo.h:29
yarp::dev::IAxisInfoRaw::~IAxisInfoRaw
virtual ~IAxisInfoRaw()
Destructor.
Definition: IAxisInfo.h:74