NavigationStackGeneralConfig.cpp
Go to the documentation of this file.
2
3#include <RobotAPI/interface/aron/Aron.h>
7
8#include <armarx/navigation/core/aron/GeneralConfig.aron.generated.h>
10
12{
13
14 std::string
15 ToString(const TrajectoryParametrization parametrization)
16 {
17 switch (parametrization)
18 {
20 return "none";
22 return "ramping";
24 return "toppra";
25 default:
26 return "unknown";
27 }
28 }
29
32 {
33 arondto::GeneralConfig dto;
34
36
37 return dto.toAron();
38 }
39
42 {
44
45 // `parametrization` was added after this config had already been deployed, and the
46 // generated reader throws on a member it cannot find rather than defaulting. A config
47 // serialized by an older client therefore has to be completed here.
48 //
49 // Ramping, not the enum's zero value: these configs predate the choice existing, and
50 // ramping is unconditionally what the navigator did for them. Defaulting to `None`
51 // would silently disable it on every robot still sending an old config.
52 if (not dict->hasElement("parametrization"))
53 {
54 dict->setElementCopy(
55 "parametrization",
56 std::make_shared<aron::data::Int>(arondto::TrajectoryParametrization::EnumToValueMap.at(
57 arondto::TrajectoryParametrization::RAMPING)));
58 }
59
60 arondto::GeneralConfig dto;
61 dto.fromAron(dict);
62
64 fromAron(dto, bo);
65
66 return bo;
67 }
68} // namespace armarx::navigation::core
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
std::shared_ptr< Dict > DictPtr
Definition Dict.h:42
This file is part of ArmarX.
TrajectoryParametrization
How the velocities along a planned path are assigned.
@ Ramping
Ramp down at the start, the goal and every corner. The stack's historical behaviour.
@ Toppra
Time-optimal under per-motor torque and command-ramp limits.
std::string ToString(const TrajectoryParametrization parametrization)
The lowercase name used in configs, logs and the analysis application's results.
void toAron(arondto::GlobalTrajectoryPoint &dto, const GlobalTrajectoryPoint &bo)
void fromAron(const arondto::GlobalTrajectoryPoint &dto, GlobalTrajectoryPoint &bo)
static GeneralConfig FromAron(const aron::data::DictPtr &dict)