Choreonoid  1.8
RateGyroSensor.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_BODY_RATE_GYRO_SENSOR_H
7 #define CNOID_BODY_RATE_GYRO_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 RateGyroSensor : public Device
18 {
19 public:
21  RateGyroSensor(const RateGyroSensor& org, bool copyStateOnly = false);
22 
23  virtual const char* typeName() const override;
24  void copyStateFrom(const RateGyroSensor& 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& w() const { return w_; }
34  Vector3& w() { return w_; }
35 
36  const Vector3& w_max() const { return spec->w_max; }
37  Vector3& w_max() { return spec->w_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 w_; // w = omega = angular velocity
47 
48  struct Spec {
49  Vector3 w_max;
50  };
51  std::unique_ptr<Spec> spec;
52 };
53 
55 
56 }
57 
58 #endif
cnoid::RateGyroSensorPtr
ref_ptr< RateGyroSensor > RateGyroSensorPtr
Definition: RateGyroSensor.h:54
cnoid::RateGyroSensor::w_max
const Vector3 & w_max() const
Definition: RateGyroSensor.h:36
cnoid::RateGyroSensor
Definition: RateGyroSensor.h:17
cnoid::Mapping
Definition: ValueTree.h:253
Device.h
cnoid::RateGyroSensor::w
Vector3 & w()
Definition: RateGyroSensor.h:34
cnoid::Vector3
Eigen::Vector3d Vector3
Definition: EigenTypes.h:57
cnoid::ref_ptr
Definition: Referenced.h:103
cnoid::RateGyroSensor::w_max
Vector3 & w_max()
Definition: RateGyroSensor.h:37
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::CloneMap
Definition: CloneMap.h:13
cnoid::DeviceState
Definition: Device.h:20
cnoid::Referenced
Definition: Referenced.h:54
cnoid::RateGyroSensor::w
const Vector3 & w() const
Definition: RateGyroSensor.h:33
cnoid::Device
Definition: Device.h:53