Gazebo Math

API Reference

7.5.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 gz::math
27 {
28  // Inline bracket to help doxygen filtering.
29  inline namespace GZ_MATH_VERSION_NAMESPACE {
30  // Forward declarations.
31  class MecanumDriveOdometryPrivate;
32 
50  class GZ_MATH_VISIBLE MecanumDriveOdometry
51  {
52  // Use a steady clock
54 
58  public: explicit MecanumDriveOdometry(size_t _windowSize = 10);
59 
62 
65  public: void Init(const clock::time_point &_time);
66 
69  public: bool Initialized() const;
70 
79  public: bool Update(
80  const Angle &_frontLeftPos, const Angle &_frontRightPos,
81  const Angle &_backLeftPos, const Angle &_backRightPos,
82  const clock::time_point &_time);
83 
86  public: const Angle &Heading() const;
87 
90  public: double X() const;
91 
94  public: double Y() const;
95 
98  public: double LinearVelocity() const;
99 
102  public: double LateralVelocity() const;
103 
106  public: const Angle &AngularVelocity() const;
107 
113  public: void SetWheelParams(double _wheelSeparation, double _wheelBase,
114  double _leftWheelRadius, double _rightWheelRadius);
117  public: void SetVelocityRollingWindowSize(size_t _size);
118 
121  public: double WheelSeparation() const;
122 
125  public: double WheelBase() const;
126 
129  public: double LeftWheelRadius() const;
130 
133  public: double RightWheelRadius() const;
134 
135 
136 #ifdef _WIN32
137 // Disable warning C4251 which is triggered by
138 // std::unique_ptr
139 #pragma warning(push)
140 #pragma warning(disable: 4251)
141 #endif
144 #ifdef _WIN32
145 #pragma warning(pop)
146 #endif
147  };
148  } // namespace GZ_MATH_VERSION_NAMESPACE
149 } // namespace gz::math
150 #endif // GZ_MATH_MECANUMDRIVEODOMETRY_HH_