openrave.org

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
spacesampler.h
Go to the documentation of this file.
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2006-2011 Rosen Diankov <rosen.diankov@gmail.com>
3 //
4 // This file is part of OpenRAVE.
5 // OpenRAVE is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef OPENRAVE_SPACESAMPLER_H
23 #define OPENRAVE_SPACESAMPLER_H
24 
25 namespace OpenRAVE {
26 
29  IT_Open=0,
33 };
34 
38 };
39 
44 {
45 public:
46  SpaceSamplerBase(EnvironmentBasePtr penv) : InterfaceBase(PT_SpaceSampler, penv) {
47  }
48  virtual ~SpaceSamplerBase() {
49  }
50 
52  static inline InterfaceType GetInterfaceTypeStatic() {
53  return PT_SpaceSampler;
54  }
55 
57  virtual void SetSeed(uint32_t seed) OPENRAVE_DUMMY_IMPLEMENTATION;
58 
60  virtual void SetSpaceDOF(int dof) OPENRAVE_DUMMY_IMPLEMENTATION;
61 
63  virtual int GetDOF() const = 0;
64 
70  virtual int GetNumberOfValues() const = 0;
71 
72  virtual bool Supports(SampleDataType type) const = 0;
73 
77  virtual void GetLimits(std::vector<dReal>& vLowerLimit, std::vector<dReal>& vUpperLimit) const OPENRAVE_DUMMY_IMPLEMENTATION;
78 
82  virtual void GetLimits(std::vector<uint32_t>& vLowerLimit, std::vector<uint32_t>& vUpperLimit) const OPENRAVE_DUMMY_IMPLEMENTATION;
83 
91  virtual void SampleSequence(std::vector<dReal>& samples, size_t num=1,IntervalType interval=IT_Closed) OPENRAVE_DUMMY_IMPLEMENTATION;
92 
96  virtual dReal SampleSequenceOneReal(IntervalType interval=IT_Closed)
97  {
98  OPENRAVE_ASSERT_OP_FORMAT0(GetDOF(),==,1,"sample can only be 1 dof", ORE_InvalidState);
99  std::vector<dReal> samples(1);
100  // by default, use SampleSequence
101  SampleSequence(samples,1,interval);
102  return samples.at(0);
103  }
104 
111  virtual void SampleSequence(std::vector<uint32_t>& sample, size_t num=1) OPENRAVE_DUMMY_IMPLEMENTATION;
112 
116  virtual uint32_t SampleSequenceOneUInt32()
117  {
118  OPENRAVE_ASSERT_OP_FORMAT0(GetDOF(),==,1,"sample can only be 1 dof", ORE_InvalidState);
119  std::vector<uint32_t> samples(1);
120  // by default, use SampleSequence
121  SampleSequence(samples,1);
122  return samples.at(0);
123  }
124 
128  virtual void SampleComplete(std::vector<dReal>& samples, size_t num,IntervalType interval=IT_Closed) OPENRAVE_DUMMY_IMPLEMENTATION;
129 
133  virtual void SampleComplete(std::vector<uint32_t>& samples, size_t num) OPENRAVE_DUMMY_IMPLEMENTATION;
134 
136  //virtual void SetDistanceMetric(const boost::function<dReal(const std::vector<dReal>&, const std::vector<dReal>&)>& distmetricfn) OPENRAVE_DUMMY_IMPLEMENTATION;
137 
138 
139 private:
140  virtual const char* GetHash() const {
142  }
143 };
144 
145 } // end namespace OpenRAVE
146 
147 #endif