Scene.h
Go to the documentation of this file.
1/**
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @author Fabian Reister ( fabian dot reister at kit dot edu )
17 * @date 2026
18 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19 * GNU General Public License
20 */
21
22#pragma once
23
24#include <filesystem>
25#include <vector>
26
27#include <Eigen/Core>
28
35
37{
38
39 /// An axis-aligned box obstacle in the ground plane.
40 struct Box
41 {
42 Eigen::Vector2f min;
43
44 Eigen::Vector2f max;
45
46 /// Distance from `p` to the box surface. Zero if `p` is inside the box.
47 float distanceTo(const Eigen::Vector2f& p) const;
48 };
49
50 /// The synthetic scene: what the world looks like, independent of the planner.
51 struct Scene
52 {
54
55 /// Edge length of a costmap cell [mm].
56 float cellSize{100.F};
57
58 std::vector<Box> obstacles;
59 };
60
61 /// Everything the application needs, as read from the scene description file.
62 struct Config
63 {
65
67
69
71
72 /// Obstacle distances are clipped to this value [mm].
73 float costmapMaxDistance{2000.F};
74
76
78
79 /// Simulate the low-level controller following the planned trajectory.
80 bool simulate{true};
81
83
84 /// Platform name selecting `PlatformDynamics<robot>.json`, spelled as the rest of the
85 /// codebase does: `Armar7`, `Armar6`, `ArmarDE`. Kept so the reparametrization loads the
86 /// same file the simulation did.
87 std::string robot{"Armar7"};
88
89 /// How the velocities along the planned path are (re-)assigned before simulating.
90 ///
91 /// Defaults to `None` rather than the stack's `Ramping`: this application exists to
92 /// compare the modes, so it should apply nothing unless asked.
94
95 /// Waypoints the reparametrization should return. 0 keeps the input count.
96 ///
97 /// This matters more than it looks. TOPPRA bounds the accelerations along a *smooth*
98 /// path, but a GlobalTrajectory is a polyline: the heading changes discontinuously at
99 /// every vertex, and the controller executes that turn in a single control cycle. At the
100 /// planner's ~195 mm spacing a 7 deg vertex at 1000 mm/s alone demands 12500 mm/s^2,
101 /// which swamps everything TOPPRA achieved. Resampling so the spacing is on the order of
102 /// the distance travelled per cycle spreads the turn out and the guarantee transfers.
104
105 /// Fraction of the motor torque the reparametrization may use.
107 };
108
109 /// Read the scene description. Throws on malformed input.
110 Config readConfig(const std::filesystem::path& filename);
111
112 /**
113 * @brief Build a costmap holding, per cell, the distance to the closest obstacle
114 * reduced by the robot radius (clipped to [0, costmapMaxDistance]).
115 *
116 * A value of zero marks a cell in collision, which is what `Costmap::isInCollision`
117 * tests for. Distances are computed analytically from the box obstacles, so the grid
118 * is exact up to the cell discretization.
119 */
120 algorithms::Costmap buildCostmap(const Config& config);
121
122} // namespace armarx::navigation::analysis
This file is part of ArmarX.
Definition io.cpp:36
Config readConfig(const std::filesystem::path &filename)
Read the scene description. Throws on malformed input.
Definition Scene.cpp:76
algorithms::Costmap buildCostmap(const Config &config)
Build a costmap holding, per cell, the distance to the closest obstacle reduced by the robot radius (...
Definition Scene.cpp:290
TrajectoryParametrization
How the velocities along a planned path are assigned.
Eigen::Isometry3f Pose
Definition basic_types.h:31
An axis-aligned box obstacle in the ground plane.
Definition Scene.h:41
float distanceTo(const Eigen::Vector2f &p) const
Distance from p to the box surface. Zero if p is inside the box.
Definition Scene.cpp:68
Everything the application needs, as read from the scene description file.
Definition Scene.h:63
core::GeneralConfig generalConfig
Definition Scene.h:77
global_planning::SPFAParams plannerParams
Definition Scene.h:75
int parametrizationSamples
Waypoints the reparametrization should return.
Definition Scene.h:103
bool simulate
Simulate the low-level controller following the planned trajectory.
Definition Scene.h:80
std::string robot
Platform name selecting PlatformDynamics<robot>.json, spelled as the rest of the codebase does: Armar...
Definition Scene.h:87
algorithms::Costmap::Parameters costmapParams
Definition Scene.h:70
core::TrajectoryParametrization parametrization
How the velocities along the planned path are (re-)assigned before simulating.
Definition Scene.h:93
float parametrizationTorqueFraction
Fraction of the motor torque the reparametrization may use.
Definition Scene.h:106
float costmapMaxDistance
Obstacle distances are clipped to this value [mm].
Definition Scene.h:73
simulation::TrajectoryFollowingSimulation::Parameters simulationParams
Definition Scene.h:82
The synthetic scene: what the world looks like, independent of the planner.
Definition Scene.h:52
algorithms::SceneBounds bounds
Definition Scene.h:53
float cellSize
Edge length of a costmap cell [mm].
Definition Scene.h:56
std::vector< Box > obstacles
Definition Scene.h:58