-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhelp.cpp
More file actions
94 lines (88 loc) · 2.92 KB
/
Copy pathhelp.cpp
File metadata and controls
94 lines (88 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include "help.h"
#include "imgui.h"
#include "raylib.h"
inline void ShowBulletPoints(std::initializer_list<const char *> strings)
{
for(const auto & s : strings)
{
ImGui::Bullet();
ImGui::TextWrapped("%s", s);
}
}
inline void ShowLIPMWalkingHelp()
{
if(ImGui::BeginTabItem("LIPMWalking"))
{
// clang-format off
ShowBulletPoints({
"Click the \"Start standing\" button to start the stabilizer",
"Move the marker on the ground to set the destination or choose a pre-defined plan",
"The marker is only available when a custom_* plan is selected",
"Click on \"Start walking\" to execute the plan",
"This controller is only compatible with humanoid robots"
});
// clang-format on
ImGui::EndTabItem();
}
}
inline void ShowGeneralHelp()
{
if(ImGui::BeginTabItem("General"))
{
// clang-format off
ShowBulletPoints({
"The \"Tasks\" tab lets you edit the active tasks properties",
"You can also interact with 3D markers to change some tasks objectives",
"You can also remove tasks from there",
"The \"Global/Add tasks\" tab lets you add tasks into the controller, you should first select a task from the dropdown menu then fill the required and optional parameters as you see fit",
"Some tasks will not work correctly in this demo (e.g. force tasks)"
});
// clang-format on
ImGui::EndTabItem();
}
}
inline void ShowTickerHelp()
{
if(ImGui::BeginTabItem("Ticker"))
{
// clang-format off
ShowBulletPoints({
"Click the \"Stop\" button to stop the controller",
"You can then select a different robot, controller and timestep to run",
#ifdef __EMSCRIPTEN__
"You can also edit the robot and controller parameters in the address bar for the same effect, this can also be used as a permanent link to a specific robot/controller combination",
#endif
"The combination of robot/controller/timestep might fail, if so an error message should be displayed in the \"Console\" window"
});
// clang-format on
ImGui::EndTabItem();
}
}
void ShowHelpWindow(bool & show, const std::string & controller)
{
auto left_margin = 15;
auto right_margin = 15;
auto top_margin = 50;
auto bottom_margin = 50;
auto width = GetScreenWidth() - left_margin - right_margin;
auto height = GetScreenHeight() - top_margin - bottom_margin;
auto w_width = 0.3 * width;
auto w_height = 0.45 * height;
ImGui::SetNextWindowPos(ImVec2(left_margin + width - w_width, top_margin), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(w_width, w_height), ImGuiCond_FirstUseEver);
if(show && ImGui::Begin("Help", &show))
{
ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags_None;
if(ImGui::BeginTabBar("#HelpTabs", tab_bar_flags))
{
if(controller == "LIPMWalking")
{
ShowLIPMWalkingHelp();
}
ShowGeneralHelp();
ShowTickerHelp();
ImGui::EndTabBar();
}
ImGui::End();
}
}