Ignition Math

API Reference

6.4.0
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 
104  public: bool Update(const Angle &_leftPos, const Angle &_rightPos,
105  const clock::time_point &_time);
106 
109  public: const Angle &Heading() const;
110 
113  public: double X() const;
114 
117  public: double Y() const;
118 
121  public: double LinearVelocity() const;
122 
125  public: const Angle &AngularVelocity() const;
126 
131  public: void SetWheelParams(double _wheelSeparation,
132  double _leftWheelRadius, double _rightWheelRadius);
133 
136  public: void SetVelocityRollingWindowSize(size_t _size);
137 
138 #ifdef _WIN32
139 // Disable warning C4251 which is triggered by
140 // std::unique_ptr
141 #pragma warning(push)
142 #pragma warning(disable: 4251)
143 #endif
146 #ifdef _WIN32
147 #pragma warning(pop)
148 #endif
149  };
150  }
151  }
152 }
153 
154 #endif
An angle and related functions.
Definition: Angle.hh:51
Definition: Angle.hh:42