Choreonoid  1.8
AccelerationSensor.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_BODY_ACCELERATION_SENSOR_H
7 #define CNOID_BODY_ACCELERATION_SENSOR_H
8 
9 #include "Device.h"
10 #include <memory>
11 #include "exportdecl.h"
12 
13 namespace cnoid {
14 
15 class Mapping;
16 
17 class CNOID_EXPORT AccelerationSensor : public Device
18 {
19 public:
21  AccelerationSensor(const AccelerationSensor& org, bool copyStateOnly = false);
22 
23  virtual const char* typeName() const override;
24  void copyStateFrom(const AccelerationSensor& other);
25  virtual void copyStateFrom(const DeviceState& other) override;
26  virtual DeviceState* cloneState() const override;
27  virtual void forEachActualType(std::function<bool(const std::type_info& type)> func) override;
28  virtual void clearState() override;
29  virtual int stateSize() const override;
30  virtual const double* readState(const double* buf) override;
31  virtual double* writeState(double* out_buf) const override;
32 
33  const Vector3& dv() const { return dv_; }
34  Vector3& dv() { return dv_; }
35 
36  const Vector3& dv_max() const { return spec->dv_max; }
37  Vector3& dv_max() { return spec->dv_max; }
38 
39  bool readSpecifications(const Mapping* info);
40  bool writeSpecifications(Mapping* info) const;
41 
42 protected:
43  virtual Referenced* doClone(CloneMap* cloneMap) const override;
44 
45 private:
46  Vector3 dv_;
47 
48  struct Spec {
49  Vector3 dv_max;
50  };
51  std::unique_ptr<Spec> spec;
52 };
53 
55 
56 }
57 
58 #endif
cnoid::AccelerationSensor
Definition: AccelerationSensor.h:17
cnoid::Mapping
Definition: ValueTree.h:253
Device.h
cnoid::Vector3
Eigen::Vector3d Vector3
Definition: EigenTypes.h:57
cnoid::ref_ptr
Definition: Referenced.h:103
cnoid::AccelerationSensor::dv_max
const Vector3 & dv_max() const
Definition: AccelerationSensor.h:36
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::CloneMap
Definition: CloneMap.h:13
cnoid::AccelerationSensor::dv_max
Vector3 & dv_max()
Definition: AccelerationSensor.h:37
cnoid::DeviceState
Definition: Device.h:20
cnoid::Referenced
Definition: Referenced.h:54
cnoid::Device
Definition: Device.h:53
cnoid::AccelerationSensor::dv
Vector3 & dv()
Definition: AccelerationSensor.h:34
cnoid::AccelerationSensor::dv
const Vector3 & dv() const
Definition: AccelerationSensor.h:33
cnoid::AccelerationSensorPtr
ref_ptr< AccelerationSensor > AccelerationSensorPtr
Definition: AccelerationSensor.h:54