Kinematics Animation Multithread
main.cpp
Go to the documentation of this file.
1
#include <iostream>
2
#include <vector>
3
4
#include <igl/opengl/glfw/Viewer.h>
5
#include <igl/opengl/glfw/imgui/ImGuiPlugin.h>
6
#include <igl/opengl/glfw/imgui/ImGuiMenu.h>
7
#include <igl/opengl/glfw/imgui/ImGuiHelpers.h>
8
#include <igl/slim.h>
9
10
#include "
./include/euler_rotations.h
"
11
#include "
./include/exoskeleton.h
"
12
#include "
./include/menu_handler.h
"
13
#include "
./include/animated_hand.h
"
14
#include "
./include/kinematic_animation.h
"
15
22
int
main
(
void
)
23
{
24
// Initialize viewer
25
igl::opengl::glfw::Viewer viewer;
26
27
// Attach a menu plugin
28
igl::opengl::glfw::imgui::ImGuiPlugin plugin;
29
viewer.plugins.push_back(&plugin);
30
igl::opengl::glfw::imgui::ImGuiMenu menu;
31
plugin.widgets.push_back(&menu);
32
33
// Menu handler
34
MenuHandler
menu_handler(&menu);
35
36
// Generate lamda function pointing to the menu callback
37
auto
lamda_menu_fun = [&menu_handler]() {
return
menu_handler.
callback
(); };
38
menu.callback_draw_viewer_menu = lamda_menu_fun;
39
40
// Initialize left exoskeleton handle
41
Exoskeleton
left_exoskeleton;
42
43
// Initialize animated hand handler
44
AnimatedHand
anim_hand;
45
46
// Initialize kinematic animation
47
KinematicAnimation
ka;
48
ka.
initialize
(&viewer, &left_exoskeleton, &anim_hand, &menu_handler);
49
50
// Generate lamda function pointing to the animation loop member function
51
auto
lamda_anim_fun =
52
[&ka](igl::opengl::glfw::Viewer& viewer) {
return
ka.
animation_loop
(viewer); };
53
54
55
// Set animation
56
viewer.data().show_overlay_depth =
false
;
57
viewer.data().line_width = 1;
58
viewer.data().show_lines =
false
;
59
viewer.callback_pre_draw = lamda_anim_fun;
60
viewer.core().is_animating =
true
;
61
viewer.core().animation_max_fps = 30;
62
viewer.launch();
63
}
animated_hand.h
AnimatedHand
Definition:
animated_hand.h:10
Exoskeleton
Class Exoskeleton.
Definition:
exoskeleton.h:20
KinematicAnimation
Class KinematicAnimation.
Definition:
kinematic_animation.h:16
KinematicAnimation::initialize
void initialize(igl::opengl::glfw::Viewer *viewer, Exoskeleton *left_exo, AnimatedHand *anim_hand, MenuHandler *menu_handler)
Initialize animation.
Definition:
kinematic_animation.cpp:11
KinematicAnimation::animation_loop
bool animation_loop(igl::opengl::glfw::Viewer &viewer)
Animation loop callback.
Definition:
kinematic_animation.cpp:36
MenuHandler
Class MenuHandler.
Definition:
menu_handler.h:23
MenuHandler::callback
void callback(void)
Menu callback function.
Definition:
menu_handler.cpp:19
euler_rotations.h
exoskeleton.h
kinematic_animation.h
main
int main(void)
This is the main execution function. It first initiates the libigl viewer and then calls the menu han...
Definition:
main.cpp:22
menu_handler.h
Generated by
1.9.4