Gazebo Math

API Reference

6.15.1
gz/math/MecanumDriveOdometry.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 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_MECANUMDRIVEODOMETRY_HH_
18 #define GZ_MATH_MECANUMDRIVEODOMETRY_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  // Inline bracket to help doxygen filtering.
31  inline namespace IGNITION_MATH_VERSION_NAMESPACE {
32  // Forward declarations.
33  class MecanumDriveOdometryPrivate;
34 
52  class IGNITION_MATH_VISIBLE MecanumDriveOdometry
53  {
54  // Use a steady clock
56 
60  public: explicit MecanumDriveOdometry(size_t _windowSize = 10);
61 
63  public: ~MecanumDriveOdometry();
64 
67  public: void Init(const clock::time_point &_time);
68 
71  public: bool Initialized() const;
72 
81  public: bool Update(
82  const Angle &_frontLeftPos, const Angle &_frontRightPos,
83  const Angle &_backLeftPos, const Angle &_backRightPos,
84  const clock::time_point &_time);
85 
88  public: const Angle &Heading() const;
89 
92  public: double X() const;
93 
96  public: double Y() const;
97 
100  public: double LinearVelocity() const;
101 
104  public: double LateralVelocity() const;
105 
108  public: const Angle &AngularVelocity() const;
109 
115  public: void SetWheelParams(double _wheelSeparation, double _wheelBase,
116  double _leftWheelRadius, double _rightWheelRadius);
119  public: void SetVelocityRollingWindowSize(size_t _size);
120 
123  public: double WheelSeparation() const;
124 
127  public: double WheelBase() const;
128 
131  public: double LeftWheelRadius() const;
132 
135  public: double RightWheelRadius() const;
136 
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  } // namespace IGNITION_MATH_VERSION_NAMESPACE
151  } // namespace math
152 } // namespace ignition
153 #endif // GZ_MATH_MECANUMDRIVEODOMETRY_HH_
void SetWheelParams(double _wheelSeparation, double _wheelBase, double _leftWheelRadius, double _rightWheelRadius)
Set the wheel parameters including the radius and separation.
double LateralVelocity() const
Get the lateral velocity.
Definition: gz/math/AdditivelySeparableScalarField3.hh:27
bool Initialized() const
Get whether Init has been called.
double RightWheelRadius() const
Get the rightwheel radius.
MecanumDriveOdometry(size_t _windowSize=10)
Constructor.
double Y() const
Get the Y position.
double LinearVelocity() const
Get the linear velocity.
double X() const
Get the X position.
double WheelBase() const
Get the wheel base.
double WheelSeparation() const
Get the wheel separation.
bool Update(const Angle &_frontLeftPos, const Angle &_frontRightPos, const Angle &_backLeftPos, const Angle &_backRightPos, 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.
const Angle & AngularVelocity() const
Get the angular velocity.
void Init(const clock::time_point &_time)
Initialize the odometry.
The Angle class is used to simplify and clarify the use of radians and degrees measurements....
Definition: gz/math/Angle.hh:61
Computes odometry values based on a set of kinematic properties and wheel speeds for a Mecanum-drive ...
Definition: gz/math/MecanumDriveOdometry.hh:52
const Angle & Heading() const
Get the heading.
double LeftWheelRadius() const
Get the left wheel radius.