Choreonoid  1.5
RangeSensor.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_BODY_RANGE_SENSOR_H
7 #define CNOID_BODY_RANGE_SENSOR_H
8 
9 #include "Device.h"
10 #include <boost/shared_ptr.hpp>
11 #include <vector>
12 #include "exportdecl.h"
13 
14 namespace cnoid {
15 
17 {
18 public:
19  RangeSensor();
20  RangeSensor(const RangeSensor& org, bool copyStateOnly = false);
21 
22  virtual const char* typeName();
23  void copyStateFrom(const RangeSensor& other);
24  virtual void copyStateFrom(const DeviceState& other);
25  virtual DeviceState* cloneState() const;
26  virtual Device* clone() const;
27  virtual void forEachActualType(boost::function<bool(const std::type_info& type)> func);
28  virtual void clearState();
29  virtual int stateSize() const;
30  virtual const double* readState(const double* buf);
31  virtual double* writeState(double* out_buf) const;
32 
33  bool on() const { return on_; }
34  void on(bool on) { on_ = on; }
35 
36  double yawRange() const { return yawRange_; }
37  void setYawRange(double angle);
38  int yawResolution() const { return (yawRange_ == 0.0) ? 1 : yawResolution_; }
39  void setYawResolution(int n);
40  double yawStep() const;
41 
42  double pitchRange() const { return pitchRange_; }
43  void setPitchRange(double angle);
44  int pitchResolution() const { return (pitchRange_ == 0.0) ? 1 : pitchResolution_; }
45  void setPitchResolution(double n);
46  double pitchStep() const;
47 
48  double maxDistance() const { return maxDistance_; }
49  void setMaxDistance(double d);
50  double minDistance() const { return minDistance_; }
51  void setMinDistance(double d);
52 
53  double frameRate() const { return frameRate_; }
54  void setFrameRate(double r);
55 
56  typedef std::vector<double> RangeData;
57 
58  void setRangeDataStateClonable(bool on) { isRangeDataStateClonable_ = on; }
59  bool isRangeDataStateClonable() const { return isRangeDataStateClonable_; }
60 
64  const RangeData& rangeData() const { return *rangeData_; }
65  const RangeData& constRangeData() const { return *rangeData_; }
66  RangeData& rangeData();
67  RangeData& newRangeData();
68 
69  boost::shared_ptr<RangeData> sharedRangeData() const { return rangeData_; }
70 
76  void setRangeData(boost::shared_ptr<RangeData>& rangeData);
77 
81  double delay() const { return delay_; }
82  void setDelay(double time) { delay_ = time; }
83 
84 private:
85  bool on_;
86  bool isRangeDataStateClonable_;
87  int yawResolution_;
88  int pitchResolution_;
89  double yawRange_;
90  double pitchRange_;
91  double minDistance_;
92  double maxDistance_;
93  double frameRate_;
94  double delay_;
95  boost::shared_ptr<RangeData> rangeData_;
96 
97  RangeSensor(const RangeSensor& org, int x /* dummy */);
98  void copyRangeSensorStateFrom(const RangeSensor& other);
99 };
100 
102 
103 };
104 
105 #endif
void on(bool on)
Definition: RangeSensor.h:34
double maxDistance() const
Definition: RangeSensor.h:48
ref_ptr< RangeSensor > RangeSensorPtr
Definition: RangeSensor.h:101
double minDistance() const
Definition: RangeSensor.h:50
void setRangeDataStateClonable(bool on)
Definition: RangeSensor.h:58
const RangeData & constRangeData() const
Definition: RangeSensor.h:65
double frameRate() const
Definition: RangeSensor.h:53
double yawRange() const
Definition: RangeSensor.h:36
Definition: Referenced.h:128
bool on() const
Definition: RangeSensor.h:33
const RangeData & rangeData() const
Definition: RangeSensor.h:64
int pitchResolution() const
Definition: RangeSensor.h:44
double pitchRange() const
Definition: RangeSensor.h:42
Definition: Device.h:18
std::vector< double > RangeData
Definition: RangeSensor.h:56
int yawResolution() const
Definition: RangeSensor.h:38
Defines the minimum processing for performing pasing file for STL.
Definition: AbstractSceneLoader.h:9
bool isRangeDataStateClonable() const
Definition: RangeSensor.h:59
void setDelay(double time)
Definition: RangeSensor.h:82
boost::shared_ptr< RangeData > sharedRangeData() const
Definition: RangeSensor.h:69
double delay() const
Definition: RangeSensor.h:81
#define CNOID_EXPORT
Definition: Util/exportdecl.h:37
Definition: RangeSensor.h:16
Definition: Device.h:52