Gazebo Math

API Reference

6.15.1
gz/math/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 GZ_MATH_DIFFDRIVEODOMETRY_HH_
18 #define GZ_MATH_DIFFDRIVEODOMETRY_HH_
19 
20 #include <chrono>
21 #include <memory>
22 #include <gz/math/Angle.hh>
23 #include <gz/math/Export.hh>
24 #include <gz/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
Definition: gz/math/AdditivelySeparableScalarField3.hh:27
const Angle & Heading() const
Get the heading.
void SetWheelParams(double _wheelSeparation, double _leftWheelRadius, double _rightWheelRadius)
Set the wheel parameters including the radius and separation.
Computes odometry values based on a set of kinematic properties and wheel speeds for a diff-drive veh...
Definition: gz/math/DiffDriveOdometry.hh:81
double Y() const
Get the Y position.
void Init(const clock::time_point &_time)
Initialize the odometry.
DiffDriveOdometry(size_t _windowSize=10)
Constructor.
double X() const
Get the X position.
bool Initialized() const
Get whether Init has been called.
const Angle & AngularVelocity() const
Get the angular velocity.
double LinearVelocity() const
Get the linear velocity.
The Angle class is used to simplify and clarify the use of radians and degrees measurements....
Definition: gz/math/Angle.hh:61
bool Update(const Angle &_leftPos, const Angle &_rightPos, const clock::time_point &_time)
Updates the odometry class with latest wheels and steerings position.
void SetVelocityRollingWindowSize(size_t _size)
Set the velocity rolling window size.