Gazebo Math

API Reference

9.0.0~pre1
OccupancyGrid.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2025 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_OCCUPANCY_GRID_HH_
18#define GZ_MATH_OCCUPANCY_GRID_HH_
19
20#include <cstdint>
21#include <vector>
22
23#include <gz/math/Helpers.hh>
24#include <gz/utils/ImplPtr.hh>
25
26namespace gz::math
27{
28inline namespace GZ_MATH_VERSION_NAMESPACE {
29
33{
35 Free,
40};
41
45{
55 int _heightCells, double _originX = 0.0, double _originY = 0.0);
56
63 // be false if resolution is set to zero.
64 public: bool WorldToGrid(double _worldX, double _worldY, int &_gridX,
65 int &_gridY) const;
66
73 public: void GridToWorld(int _gridX, int _gridY, double &_worldX,
74 double &_worldY) const;
75
80 public: bool IsValidGridCoordinate(int _gridX, int _gridY) const;
81
86 public: OccupancyCellState CellState(int _gridX, int _gridY) const;
87
93
101 public: int CalculateIGain(int _x0, int _y0, int _x1, int _y1);
102
111 public: void MarkLine(int _x0, int _y0, int _x1, int _y1,
113
119 public: bool MarkOccupied(double _worldX, double _worldY);
120
127 public: bool MarkFree(double _worldX0, double _worldY0, double _worldX1,
128 double _worldY1);
129
133
137
140 public: double Resolution() const;
141
144 public: int Width() const;
145
148 public: int Height() const;
149
152 public: double OriginX() const;
153
156 public: double OriginY() const;
157
159 GZ_UTILS_IMPL_PTR(dataPtr)
160};
161}
162} // namespace gz::math
163
164#endif