Ignition Math

API Reference

6.9.3~pre2
DiffDriveOdometry.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef IGNITION_MATH_DIFFDRIVEODOMETRY_HH_
18 #define IGNITION_MATH_DIFFDRIVEODOMETRY_HH_
19 
20 #include <chrono>
21 #include <memory>
22 #include <ignition/math/Angle.hh>
23 #include <ignition/math/Export.hh>
24 #include <ignition/math/config.hh>
25 
26 namespace ignition
27 {
28  namespace math
29  {
30  // Use a steady clock
32 
33  // Inline bracket to help doxygen filtering.
34  inline namespace IGNITION_MATH_VERSION_NAMESPACE {
35  //
36  // Forward declarations.
37  class DiffDriveOdometryPrivate;
38 
42  class IGNITION_MATH_VISIBLE DiffDriveOdometry
82  {
86  public: explicit DiffDriveOdometry(size_t _windowSize = 10);
87 
89  public: ~DiffDriveOdometry();
90 
93  public: void Init(const clock::time_point &_time);
94 
97  public: bool Initialized() const;
98 
105  public: bool Update(const Angle &_leftPos, const Angle &_rightPos,
106  const clock::time_point &_time);
107 
110  public: const Angle &Heading() const;
111 
114  public: double X() const;
115 
118  public: double Y() const;
119 
122  public: double LinearVelocity() const;
123 
126  public: const Angle &AngularVelocity() const;
127 
132  public: void SetWheelParams(double _wheelSeparation,
133  double _leftWheelRadius, double _rightWheelRadius);
134 
137  public: void SetVelocityRollingWindowSize(size_t _size);
138 
139 #ifdef _WIN32
140 // Disable warning C4251 which is triggered by
141 // std::unique_ptr
142 #pragma warning(push)
143 #pragma warning(disable: 4251)
144 #endif
147 #ifdef _WIN32
148 #pragma warning(pop)
149 #endif
150  };
151  }
152  }
153 }
154 
155 #endif
The Angle class is used to simplify and clarify the use of radians and degrees measurements. A default constructed Angle instance has a value of zero radians/degrees.
Definition: Angle.hh:61
Definition: Angle.hh:42