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 /// A box obstacle in the ground plane, optionally rotated about its own centre.
40 struct Box
41 {
42 Eigen::Vector2f min;
43
44 Eigen::Vector2f max;
45
46 /// Rotation about the box centre [rad]. Zero leaves the box axis-aligned, which is
47 /// what a scene description without a `yaw` field means.
48 ///
49 /// Real furniture is rarely axis-aligned, and enclosing a rotated table in its
50 /// axis-aligned bounding box inflates it by up to 41% on the diagonal -- which would
51 /// show up directly in any clearance the evaluation reports.
52 float yaw{0.F};
53
54 /// Distance from `p` to the box surface. Zero if `p` is inside the box.
55 float distanceTo(const Eigen::Vector2f& p) const;
56 };
57
58 /// The synthetic scene: what the world looks like, independent of the planner.
59 struct Scene
60 {
62
63 /// Edge length of a costmap cell [mm].
64 float cellSize{100.F};
65
66 std::vector<Box> obstacles;
67 };
68
69 /// Everything the application needs, as read from the scene description file.
70 struct Config
71 {
73
75
77
79
80 /// Obstacle distances are clipped to this value [mm].
81 float costmapMaxDistance{2000.F};
82
84
86
87 /// Simulate the low-level controller following the planned trajectory.
88 bool simulate{true};
89
91
92 /// Platform name selecting `PlatformDynamics<robot>.json`, spelled as the rest of the
93 /// codebase does: `Armar7`, `Armar6`, `ArmarDE`. Kept so the reparametrization loads the
94 /// same file the simulation did.
95 std::string robot{"Armar7"};
96
97 /// How the velocities along the planned path are (re-)assigned before simulating.
98 ///
99 /// Defaults to `None` rather than the stack's `Ramping`: this application exists to
100 /// compare the modes, so it should apply nothing unless asked.
102
103 /// Waypoints the reparametrization should return. 0 keeps the input count.
104 ///
105 /// This matters more than it looks. TOPPRA bounds the accelerations along a *smooth*
106 /// path, but a GlobalTrajectory is a polyline: the heading changes discontinuously at
107 /// every vertex, and the controller executes that turn in a single control cycle. At the
108 /// planner's ~195 mm spacing a 7 deg vertex at 1000 mm/s alone demands 12500 mm/s^2,
109 /// which swamps everything TOPPRA achieved. Resampling so the spacing is on the order of
110 /// the distance travelled per cycle spreads the turn out and the guarantee transfers.
112
113 /// Fraction of the motor torque the reparametrization may use.
115 };
116
117 /// Read the scene description. Throws on malformed input.
118 Config readConfig(const std::filesystem::path& filename);
119
120 /**
121 * @brief Build a costmap holding, per cell, the distance to the closest obstacle
122 * reduced by the robot radius (clipped to [0, costmapMaxDistance]).
123 *
124 * A value of zero marks a cell in collision, which is what `Costmap::isInCollision`
125 * tests for. Distances are computed analytically from the box obstacles, so the grid
126 * is exact up to the cell discretization.
127 */
128 algorithms::Costmap buildCostmap(const Config& config);
129
130} // 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:86
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:301
TrajectoryParametrization
How the velocities along a planned path are assigned.
Eigen::Isometry3f Pose
Definition basic_types.h:31
A box obstacle in the ground plane, optionally rotated about its own centre.
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
float yaw
Rotation about the box centre [rad].
Definition Scene.h:52
Everything the application needs, as read from the scene description file.
Definition Scene.h:71
core::GeneralConfig generalConfig
Definition Scene.h:85
global_planning::SPFAParams plannerParams
Definition Scene.h:83
int parametrizationSamples
Waypoints the reparametrization should return.
Definition Scene.h:111
bool simulate
Simulate the low-level controller following the planned trajectory.
Definition Scene.h:88
std::string robot
Platform name selecting PlatformDynamics<robot>.json, spelled as the rest of the codebase does: Armar...
Definition Scene.h:95
algorithms::Costmap::Parameters costmapParams
Definition Scene.h:78
core::TrajectoryParametrization parametrization
How the velocities along the planned path are (re-)assigned before simulating.
Definition Scene.h:101
float parametrizationTorqueFraction
Fraction of the motor torque the reparametrization may use.
Definition Scene.h:114
float costmapMaxDistance
Obstacle distances are clipped to this value [mm].
Definition Scene.h:81
simulation::TrajectoryFollowingSimulation::Parameters simulationParams
Definition Scene.h:90
The synthetic scene: what the world looks like, independent of the planner.
Definition Scene.h:60
algorithms::SceneBounds bounds
Definition Scene.h:61
float cellSize
Edge length of a costmap cell [mm].
Definition Scene.h:64
std::vector< Box > obstacles
Definition Scene.h:66