Gazebo Math

API Reference

7.4.0
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
26namespace gz
27{
28 namespace math
29 {
30 // Inline bracket to help doxygen filtering.
31 inline namespace GZ_MATH_VERSION_NAMESPACE {
32 // Forward declarations.
33 class MecanumDriveOdometryPrivate;
34
52 class GZ_MATH_VISIBLE MecanumDriveOdometry
53 {
54 // Use a steady clock
56
60 public: explicit MecanumDriveOdometry(size_t _windowSize = 10);
61
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 GZ_MATH_VERSION_NAMESPACE
151 } // namespace math
152} // namespace gz
153#endif // GZ_MATH_MECANUMDRIVEODOMETRY_HH_