Device.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2020 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
7 #include <mc_rbdyn/api.h>
8 
9 #include <SpaceVecAlg/SpaceVecAlg>
10 
11 #include <memory>
12 #include <string>
13 
14 namespace mc_rbdyn
15 {
16 
17 struct Robot;
18 
19 struct Device;
20 using DevicePtr = std::unique_ptr<Device>;
21 using Sensor = Device;
23 
30 {
35  Device(const std::string & name);
36 
38  Device(const std::string & name, const std::string & parent, const sva::PTransformd & X_p_s);
39 
40  Device(const Device &) = delete;
41  Device & operator=(const Device &) = delete;
42 
43  Device(Device &&) = default;
44  Device & operator=(Device &&) = default;
45 
46  virtual ~Device() noexcept = default;
47 
49  inline const std::string & name() const { return name_; }
50 
52  inline const std::string & type() const { return type_; }
53 
55  inline const std::string & parent() const { return parent_; }
56 
58  inline void parent(const std::string & p) { parent_ = p; }
59 
61  inline const sva::PTransformd & X_p_d() const { return X_p_s_; }
62 
64  inline const sva::PTransformd & X_p_s() const { return X_p_s_; }
65 
67  inline void X_p_d(const sva::PTransformd & pt) { X_p_s_ = pt; }
68 
70  inline void X_p_s(const sva::PTransformd & pt) { X_p_s_ = pt; }
71 
73  inline sva::PTransformd X_0_d(const mc_rbdyn::Robot & robot) const { return X_0_s(robot); }
74 
76  sva::PTransformd X_0_s(const mc_rbdyn::Robot & robot) const;
77 
79  virtual DevicePtr clone() const = 0;
80 
81 protected:
83  std::string type_;
85  std::string name_;
87  std::string parent_;
89  sva::PTransformd X_p_s_;
90 };
91 
92 } // namespace mc_rbdyn
mc_rbdyn::Device::parent_
std::string parent_
Definition: Device.h:87
mc_rbdyn::Device
Definition: Device.h:29
mc_rbdyn::Robot
Definition: Robot.h:62
mc_rbdyn::Device::type
const std::string & type() const
Definition: Device.h:52
mc_rbdyn::Device::X_p_s
const sva::PTransformd & X_p_s() const
Definition: Device.h:64
mc_rbdyn::Device::X_p_s
void X_p_s(const sva::PTransformd &pt)
Definition: Device.h:70
mc_rbdyn::SensorPtr
DevicePtr SensorPtr
Definition: Device.h:22
mc_rbdyn::Device::name_
std::string name_
Definition: Device.h:85
mc_rbdyn::Device::X_0_d
sva::PTransformd X_0_d(const mc_rbdyn::Robot &robot) const
Definition: Device.h:73
api.h
mc_rbdyn::Device::name
const std::string & name() const
Definition: Device.h:49
MC_RBDYN_DLLAPI
#define MC_RBDYN_DLLAPI
Definition: api.h:50
mc_rbdyn::Device::type_
std::string type_
Definition: Device.h:83
mc_rbdyn::Device::parent
const std::string & parent() const
Definition: Device.h:55
mc_rbdyn::DevicePtr
std::unique_ptr< Device > DevicePtr
Definition: Device.h:20
mc_rbdyn::Device::X_p_d
const sva::PTransformd & X_p_d() const
Definition: Device.h:61
mc_rbdyn
Definition: generic_gripper.h:14
mc_rtc::gui::Robot
auto Robot(const std::string &name, GetT get_fn)
Definition: Robot.h:56
mc_rbdyn::Device::X_p_s_
sva::PTransformd X_p_s_
Definition: Device.h:89
mc_rbdyn::Device::X_p_d
void X_p_d(const sva::PTransformd &pt)
Definition: Device.h:67
mc_rbdyn::Device::parent
void parent(const std::string &p)
Definition: Device.h:58