XBotInterface  2.4.1
XBotInterface provides a generic API to model and control a robot.
GenericSensor.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 IIT-ADVR
3  * Author: Arturo Laurenzi, Luca Muratore
4  * email: arturo.laurenzi@iit.it, luca.muratore@iit.it
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>
18 */
19 
20 #ifndef __XBOT__GENERIC_SENSOR__
21 #define __XBOT__GENERIC_SENSOR__
22 
23 #include <string>
24 #include <memory>
25 #include <iostream>
26 #include <Eigen/Geometry>
27 #include <eigen_conversions/eigen_kdl.h>
28 #include <srdfdom_advr/model.h>
29 
30 namespace XBot {
31 
36  class GenericSensor {
37 
38  public:
39 
40  typedef std::shared_ptr<GenericSensor> Ptr;
41  typedef std::shared_ptr<const GenericSensor> ConstPtr;
42 
47  GenericSensor();
48 
55  GenericSensor(urdf::LinkConstSharedPtr sensor_link, int sensor_id);
56 
62  const std::string& getParentLinkName() const;
63 
69  const std::string& getParentJointName() const;
70 
76  const std::string& getSensorName() const;
77 
83  const int getSensorId() const;
84 
90  const Eigen::Affine3d& getSensorPose() const;
91 
97  double getTimestamp() const;
98 
105  void setTimestamp(double timestamp);
106 
107 
108  protected:
109 
110  private:
111 
112  std::string _sensor_name;
113  int _sensor_id;
114 
115  std::string _parent_link_name, _parent_joint_name;
116  Eigen::Affine3d _parent_link_T_sensor_link;
117  double _timestamp;
118 
119  };
120 }
121 
122 #endif
XBot::GenericSensor::Ptr
std::shared_ptr< GenericSensor > Ptr
Definition: GenericSensor.h:40
XBot::GenericSensor::getSensorPose
const Eigen::Affine3d & getSensorPose() const
Getter for the sensor pose w.r.t.
Definition: GenericSensor.cpp:81
XBot::GenericSensor
Generic sensor abstraction.
Definition: GenericSensor.h:36
XBot::GenericSensor::getSensorId
const int getSensorId() const
Getter for the sensor id.
Definition: GenericSensor.cpp:68
XBot::GenericSensor::setTimestamp
void setTimestamp(double timestamp)
Setter for the timestamp of the sensor reading.
Definition: GenericSensor.cpp:91
XBot::GenericSensor::getParentJointName
const std::string & getParentJointName() const
Getter for the sensor parent joint name.
Definition: GenericSensor.cpp:52
XBot::GenericSensor::ConstPtr
std::shared_ptr< const GenericSensor > ConstPtr
Definition: GenericSensor.h:41
XBot::GenericSensor::GenericSensor
GenericSensor()
Default constructor.
Definition: GenericSensor.cpp:46
XBot::GenericSensor::getParentLinkName
const std::string & getParentLinkName() const
Getter for the sensor parent link name.
Definition: GenericSensor.cpp:58
XBot::GenericSensor::getSensorName
const std::string & getSensorName() const
Getter for the sensor name.
Definition: GenericSensor.cpp:63
XBot
Definition: IXBotModel.h:20
XBot::GenericSensor::getTimestamp
double getTimestamp() const
Getter for the timestamp of the last sensor reading.
Definition: GenericSensor.cpp:86